1 #--------------------------------------------------------------
2 # Written by S.Fourmanoit <syfou@users.sourceforge.net>,
5 # This is a minimal makefile to facilitate packaging operation
6 # of adesklets's desklets, following a syntax similar
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
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:
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'
34 #--------------------------------------------------------------
35 GPG-LOCAL-USER=syfou # User for GnuPG signing the package
37 #--------------------------------------------------------------
38 # Do not edit anything below this point, unless you know
41 #--------------------------------------------------------------
42 NAME=$(shell basename `pwd` | sed 's/^\(.*\)-.*/\1/')
43 REV=$(shell basename `pwd` | \
44 sed 's/.*-\(.*\)$$/\1/;s/.*\.\([0-9]\+\)$$/\1 + 1/' | \
46 MAJ-MIN=$(shell basename `pwd` | \
47 sed 's/.*-\(.*\)$$/\1/;s/^\(.*\.\)[0-9]\+/\1/')
48 VERSION=$(if $(VER),$(VER),$(MAJ-MIN)$(REV))
50 PWD_ESC=$(shell pwd | sed 's/\//\\\//g')
51 PPWD_ESC=$(shell cd .. && pwd | sed 's/\//\\\//g')
54 #--------------------------------------------------------------
56 gpg --local-user $(GPG-LOCAL-USER) \
57 --armor --detach-sign $<
59 $(P).tar.bz2: $(wildcard *.py) README clean
62 tar --exclude='config.txt' -C /tmp -cvjf $@ $(P)
65 #--------------------------------------------------------------
67 .PHONY: clean promote dist-bzip2 dist-bzip2-sign
69 -killall -9 adesklets python && sleep .2
72 cp -rav `basename $(PWD)` $(P) && \
73 sed -i 's/^\[$(PWD_ESC)\(.*\)/\[$(PPWD_ESC)\/$(P)\1/'\
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 #--------------------------------------------------------------