packaging: Add a makefile to directly build Debian packages.

This commit is contained in:
Tom Goff 2016-09-06 11:14:16 -04:00
parent 82f22fde5e
commit a85a1e4ece
2 changed files with 57 additions and 0 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
.debbuild
.deps
.version
.version.date

56
packaging/deb.mk Normal file
View file

@ -0,0 +1,56 @@
DEBBUILD = .debbuild
CORE_VERSION = $(shell cat .version 2> /dev/null)
COREBUILD = $(DEBBUILD)/core-$(CORE_VERSION)
.PHONY: all
all: clean .version build
.PHONY: clean
clean:
rm -rf $(DEBBUILD)
.PHONY: build
build: changelog
cd $(COREBUILD) && dpkg-buildpackage -b -us -uc
@printf "\ndebian packages built in $(DEBBUILD)\n\n"
.PHONY: changelog
changelog: debian
echo "core ($(CORE_VERSION)-1) unstable; urgency=low" > $(COREBUILD)/debian/changelog.generated
echo " * interim package generated from source" >> $(COREBUILD)/debian/changelog.generated
echo " -- CORE Developers <core-dev@pf.itd.nrl.navy.mil> $$(date -R)" >> $(COREBUILD)/debian/changelog.generated
cd $(COREBUILD)/debian && \
{ test ! -L changelog && mv -f changelog changelog.save; } && \
{ test "$$(readlink changelog)" = "changelog.generated" || \
ln -sf changelog.generated changelog; }
.PHONY: debian
debian: corebuild
cd $(COREBUILD) && ln -s packaging/deb debian
.PHONY: corebuild
corebuild: $(DEBBUILD) dist
tar -C $(DEBBUILD) -xzf core-$(CORE_VERSION).tar.gz
.PHONY: dist
dist: Makefile
$(MAKE) dist
Makefile: configure
./configure
configure: bootstrap.sh
./bootstrap.sh
bootstrap.sh:
@printf "\nERROR: make must be called from the top-level directory:\n"
@printf " make -f packaging/$(lastword $(MAKEFILE_LIST))\n\n"
@false
.version: Makefile
$(MAKE) $@
$(DEBBUILD):
mkdir -p $@