-default: mapsectorsh
-
-###########################################################################
-# Standard debian rules
-
-clean::
- fakeroot debian/rules clean
-.PHONY: clean
-
-prepare::
-.PHONY: prepare
-
-deb: prepare
- dpkg-buildpackage -us -uc -rfakeroot -I.git -I.gitignore -I.gitmodules
-.PHONY: deb
-
-###########################################################################
-# Generate debian/changelog from git log
-
-NAME := $(shell awk '/^Source:/{print $$2}' debian/control)
-CLOGDIR := .git/changelogs
-CHANGELOGS := $(shell lasttag=HEAD; \
- (git tag -l 'v*'; echo) \
- | while read tag; do \
- echo $(CLOGDIR)/$${tag}$${tag:+-}$$lasttag; \
- lasttag=$$tag; \
- done)
+# -*- makefile -*-
-# Author/Date formating could as simple as git log --format=' -- %an <%ae> %cD'
-# however, we want the tagger not the author and git log doesn't show tags, only commits ...
-$(CHANGELOGS): %:
- @echo "generating $@"
- @mkdir -p "$(CLOGDIR)"
- @( \
- version="$@"; version="$${version#$(CLOGDIR)/}"; \
- from="$${version%-*}"; version="$${version#*-}"; to="$$version"; \
- if [ "$$from" = "$$to" ]; then from=""; fi; \
- release="unstable"; \
- if [ "$$version" = "HEAD" ]; then \
- version="`git describe --tag --match='v*' | sed -e 's/-/~/' -e 's/-/./g'`"; \
- release="UNRELEASED"; \
- fi; \
- version="$${version#v}"; \
- echo "$(NAME) ($$version) $$release; urgency=low"; \
- echo; \
- git log --format=' * [%h] %s' $$from$${from:+..}$$to; \
- date="`echo $$to | git cat-file --batch \
- | sed -n \
- -e 's/^\(tagger\|committer\) \(.*\)00$$/\2/' \
- -eT -e 'y/+-/-+/' -ep`"; \
- author="$${date% * *}"; date="$${date#$$author }"; zone="$${date#* }"; \
- date="`TZ="UTC$$zone" date -d "1/1/1970 0:0 UTC + $${date% *} seconds" --rfc-2822`"; \
- echo; echo " -- $$author $$date"; echo; \
- ) >$@ || (rm -f $@; false)
-.PHONY: $(word 1,$(CHANGELOGS)) # The first changelog entry must be recreated on each call
+default: mapsectorsh
-debian/changelog: $(CHANGELOGS)
- cat $^ > $@ || (rm -f $@; false)
+####################
+# debian package generation
-clean::
- rm -f debian/changelog
- rm -rf $(CLOGDIR)
+include gitdeb/Makefile.gitdeb
-prepare:: debian/changelog
+prepare:: lib/00_version.sh
-###########################################################################
-###########################################################################
+####################
+# Place version into lib/00_version.sh
+# Marked as phony so it is regenerated on each call to make
-prepare:: lib/00_version.sh
lib/00_version.sh:
- echo "version='`git describe --tag`'" >lib/00_version.sh
-.PHONY: lib/00_version.sh
+ echo "version='`git describe --tag`'" >lib/00_version.sh
clean::
- rm -f lib/00_version.sh
-
+ rm -f lib/00_version.sh
+.PHONY: lib/00_version.sh
+####################
+# Build combined 'mapsectorsh' script
# The $(wildcard ...) return value is sorted and duplicates are
# removed from the list of dependencies. I need to mention
# lib/00_version.sh explicitly since it might not yet exist
+
mapsectorsh: mapsector lib/00_version.sh $(wildcard lib/[0-9][0-9]_*.sh)
- @echo "generating $@"
- @( \
- sed -n -e '1p' $<; \
- echo "#"; \
- echo "# $@ automatically generated from"; \
- for script in $^; do \
- echo "# $$script"; \
- done; \
- sed -n -e '2,/^load$$/p' $<; \
- for script in $^; do \
- if [ "$$script" = "$<" ]; then continue; fi; \
- echo "#### $$script"; \
- echo; \
- cat $$script; \
- echo; \
- done; \
- sed -n -e '/^load$$/,$$p' $<; \
- ) >$@ || (rm -f $@; false)
- @sed -i -e 's/^load$$/####/' -eT -eh -eG -eH -eG -eH -eG -e'y/\n/#/' $@
- chmod ugo+rx $@
+ @echo "generating $@"
+ @( \
+ sed -n -e '1p' $<; \
+ echo "#"; \
+ echo "# $@ automatically generated from"; \
+ for script in $^; do \
+ echo "# $$script"; \
+ done; \
+ sed -n -e '2,/^load$$/p' $<; \
+ for script in $^; do \
+ if [ "$$script" = "$<" ]; then continue; fi; \
+ echo "#### $$script"; \
+ echo; \
+ cat $$script; \
+ echo; \
+ done; \
+ sed -n -e '/^load$$/,$$p' $<; \
+ ) >$@ || (rm -f $@; false)
+ @sed -i -e 's/^load$$/####/' -eT -eh -eG -eH -eG -eH -eG -e'y/\n/#/' $@
+ chmod ugo+rx $@
clean::
- rm -f mapsectorsh
+ rm -f mapsectorsh