1 ###########################################################################
2 # Standard debian rules
5 fakeroot debian/rules clean
12 dpkg-buildpackage -us -uc -rfakeroot -I.git -I.gitignore -I.gitmodules
15 ###########################################################################
16 # Generate debian/changelog from git log
18 NAME := $(shell awk '/^Source:/{print $$2}' debian/control)
19 CLOGDIR := .git/changelogs
20 CHANGELOGS := $(shell lasttag=HEAD; \
21 (git tag -l 'v*'; echo) \
22 | while read tag; do \
23 echo $(CLOGDIR)/$${tag}$${tag:+-}$$lasttag; \
27 # Author/Date formating could as simple as git log --format=' -- %an <%ae> %cD'
28 # however, we want the tagger not the author and git log doesn't show tags, only commits ...
31 @mkdir -p "$(CLOGDIR)"
33 version="$@"; version="$${version#$(CLOGDIR)/}"; \
34 from="$${version%-*}"; version="$${version#*-}"; to="$$version"; \
35 if [ "$$from" == "$$to" ]; then from=""; fi; \
37 if [ "$$version" == "HEAD" ]; then \
38 version="`git describe --tag --match='v*' | sed -e 's/-/~/' -e 's/-/./g'`"; \
39 release="UNRELEASED"; \
41 version="$${version#v}"; \
42 echo "$(NAME) ($$version) $$release; urgency=low"; \
44 git log --format=' * [%h] %s' $$from$${from:+..}$$to; \
45 date="`echo $$to | git cat-file --batch \
47 -e 's/^\(tagger\|committer\) \(.*\)00$$/\2/' \
48 -eT -e 'y/+-/-+/' -ep`"; \
49 author="$${date% * *}"; date="$${date#$$author }"; zone="$${date#* }"; \
50 date="`TZ="UTC$$zone" date -d "1/1/1970 0:0 UTC + $${date% *} seconds" --rfc-2822`"; \
51 echo; echo " -- $$author $$date"; echo; \
52 ) >$@ || (rm -f $@; false)
53 .PHONY: $(word 1,$(CHANGELOGS)) # The first changelog entry must be recreated on each call
55 debian/changelog: $(CHANGELOGS)
56 cat $^ > $@ || (rm -f $@; false)
59 rm -f debian/changelog
62 prepare:: debian/changelog
64 ###########################################################################
65 ###########################################################################
68 echo "version='`git describe --tag`'" >lib/00_version.sh
70 rm -f lib/00_version.sh
73 # The $(wildcard ...) return value is sorted and duplicates are
74 # removed from the list of dependencies. I need to mention
75 # lib/00_version.sh explicitly since it might not yet exist
76 mapsectorsh: mapsector lib/00_version.sh $(wildcard lib/[0-9][0-9]_*.sh)
81 echo "# $@ automatically generated from"; \
82 for script in $^; do \
85 sed -n -e '2,/^load$$/p' $<; \
86 for script in $^; do \
87 if [ "$$script" == "$<" ]; then continue; fi; \
88 echo "#### $$script"; \
93 sed -n -e '/^load$$/,$$p' $<; \
94 ) >$@ || (rm -f $@; false)
95 @sed -i -e 's/^load$$/####/' -eT -eh -eG -eH -eG -eH -eG -e'y/\n/#/' $@