site: end of line message, adesklets is not dead.
[adesklets.git] / utils / GNUmakefile.desklet
blob0792cfaa5216e946d0def08bf70f0b809faaea31
1 #--------------------------------------------------------------
2 # Written by S.Fourmanoit <syfou@users.sourceforge.net>, 
3 #       2004, 2005.
5 # This is a minimal makefile to facilitate packaging operation
6 # of adesklets's desklets, following a syntax similar 
7 # to automake's
8
9 # Some possible invocations would be:
11 # make [dist-bzip2]       - create an updated bzip'ed tarball
12 # make dist-bzip2-sign    - also create an open PGP signature
13 # make clean              - just clean up current directory
14 # make promote            - auto update current package directory
15 #                           to next version one on the system:
16 #                           adapts $(HOME)/.adesklets accordingly
17
18 # You can also set the VER environment variable to 
19 # any string if you wish to bypass package naming 
20 # auto-incrementation scheme. For instance:
22 # make VER=0.666.0 
23
24 # will force creation of $(PACKAGE)-0.666.0.tar.bz2 
26 # Portability warning:
28 # This was not meant to be portable, but to work on a GNU
29 # system (GNU sed, GNU make, bc, portable bourne shell, 
30 # GNU findutils, GNU coreutils). It also need base directory 
31 # to be named in a standard 'NAME-MAJOR.MINOR.REVISION' 
32 # fashion.
34 #--------------------------------------------------------------
35 GPG-LOCAL-USER=syfou       # User for GnuPG signing the package
37 #--------------------------------------------------------------
38 # Do not edit anything below this point, unless you know 
39 # what you are doing.
41 #--------------------------------------------------------------
42 NAME=$(shell basename `pwd` | sed 's/^\(.*\)-.*/\1/')
43 REV=$(shell basename `pwd` | \
44         sed 's/.*-\(.*\)$$/\1/;s/.*\.\([0-9]\+\)$$/\1 + 1/' | \
45         bc)
46 MAJ-MIN=$(shell basename `pwd` | \
47         sed 's/.*-\(.*\)$$/\1/;s/^\(.*\.\)[0-9]\+/\1/')
48 VERSION=$(if $(VER),$(VER),$(MAJ-MIN)$(REV))
49 P=$(NAME)-$(VERSION)
50 PWD_ESC=$(shell pwd | sed 's/\//\\\//g')
51 PPWD_ESC=$(shell cd .. && pwd | sed 's/\//\\\//g')
52 PWD=$(shell pwd)
54 #--------------------------------------------------------------
55 %.asc: %
56         gpg --local-user $(GPG-LOCAL-USER) \
57                 --armor --detach-sign $<
59 $(P).tar.bz2: $(wildcard *.py) README clean
60         -mkdir /tmp/$(P)
61         cp -r . /tmp/$(P)
62         tar --exclude='config.txt' -C /tmp -cvjf $@ $(P)
63         -rm -rf /tmp/$(P)
65 #--------------------------------------------------------------
66 .INTERMEDIATE: clean
67 .PHONY: clean promote dist-bzip2 dist-bzip2-sign
68 promote: clean
69         -killall -9 adesklets python && sleep .2
70         cd $(PWD)/.. && \
71                 rm -rf $(P) && \
72                 cp -rav `basename $(PWD)` $(P) && \
73         sed -i 's/^\[$(PWD_ESC)\(.*\)/\[$(PPWD_ESC)\/$(P)\1/'\
74                 $(HOME)/.adesklets
75         -adesklets
76 clean:
77         -rm `find . -name '*~' -or -name '*.pyc' \
78                 -or -name '*.bz2' -or -name '*.asc'`
79         -rm -rf `find . -mindepth 1 -maxdepth 1 \
80                 -type d -name '$(PACKAGE)-*'`
81 dist-bzip2: $(P).tar.bz2
82 dist-bzip2-sign: $(P).tar.bz2.asc
84 #--------------------------------------------------------------