3 ###########################################################################
4 # Standard debian rules
7 fakeroot debian/rules clean
14 dpkg-buildpackage -us -uc -rfakeroot -I.git -I.gitignore -I.gitmodules
17 ###########################################################################
18 # Generate debian/changelog from git log
20 NAME := $(shell awk '/^Source:/{print $$2}' debian/control)
21 CLOGDIR := .git/changelogs
22 CHANGELOGS := $(shell lasttag=HEAD; \
23 (git tag -l 'v*'; echo) \
24 | while read tag; do \
25 echo $(CLOGDIR)/$${tag}$${tag:+-}$$lasttag; \
29 # Author/Date formating could as simple as git log --format=' -- %an <%ae> %cD'
30 # however, we want the tagger not the author and git log doesn't show tags, only commits ...
33 @mkdir -p "$(CLOGDIR)"
35 version="$@"; version="$${version#$(CLOGDIR)/}"; \
36 from="$${version%-*}"; version="$${version#*-}"; to="$$version"; \
37 if [ "$$from" = "$$to" ]; then from=""; fi; \
39 if [ "$$version" = "HEAD" ]; then \
40 version="`git describe --tag --match='v*' | sed -e 's/-/~/' -e 's/-/./g'`"; \
41 release="UNRELEASED"; \
43 version="$${version#v}"; \
44 echo "$(NAME) ($$version) $$release; urgency=low"; \
46 git log --format=' * [%h] %s' $$from$${from:+..}$$to; \
47 date="`echo $$to | git cat-file --batch \
49 -e 's/^\(tagger\|committer\) \(.*\)00$$/\2/' \
50 -eT -e 'y/+-/-+/' -ep`"; \
51 author="$${date% * *}"; date="$${date#$$author }"; zone="$${date#* }"; \
52 date="`TZ="UTC$$zone" date -d "1/1/1970 0:0 UTC + $${date% *} seconds" --rfc-2822`"; \
53 echo; echo " -- $$author $$date"; echo; \
54 ) >$@ || (rm -f $@; false)
55 .PHONY: $(word 1,$(CHANGELOGS)) # The first changelog entry must be recreated on each call
57 debian/changelog: $(CHANGELOGS)
58 cat $^ > $@ || (rm -f $@; false)
61 rm -f debian/changelog
64 prepare:: debian/changelog
66 ###########################################################################
67 ###########################################################################
69 prepare:: lib/00_version.sh
71 echo "version='`git describe --tag`'" >lib/00_version.sh
72 .PHONY: lib/00_version.sh
74 rm -f lib/00_version.sh
77 # The $(wildcard ...) return value is sorted and duplicates are
78 # removed from the list of dependencies. I need to mention
79 # lib/00_version.sh explicitly since it might not yet exist
80 mapsectorsh: mapsector lib/00_version.sh $(wildcard lib/[0-9][0-9]_*.sh)
85 echo "# $@ automatically generated from"; \
86 for script in $^; do \
89 sed -n -e '2,/^load$$/p' $<; \
90 for script in $^; do \
91 if [ "$$script" = "$<" ]; then continue; fi; \
92 echo "#### $$script"; \
97 sed -n -e '/^load$$/,$$p' $<; \
98 ) >$@ || (rm -f $@; false)
99 @sed -i -e 's/^load$$/####/' -eT -eh -eG -eH -eG -eH -eG -e'y/\n/#/' $@