1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#!/usr/bin/make -f
install := install -o root -g root
install_exec := $(install) -m 0755 -s
install_nonex := $(install) -m 0644
install_dir := $(install) -m 0755 -d
install_script := $(install) -m 0755
install_symlink := ln -s
gzip := gzip -9
strip_lib := strip --strip-unneeded
tmpdir := $(shell pwd)/debian/tmp
# These must not be :='s!
rootdir = $(tmpdir)/$(package)
ctldir = $(rootdir)/DEBIAN
bindir = $(rootdir)/usr/bin
docdir = $(rootdir)/usr/share/doc/$(package)
build: hello hello++
binary: binary-arch binary-indep
define prebinary
$(RM) -r $(rootdir)
$(install_dir) $(ctldir)
$(install_dir) $(docdir)
$(install_script) debian/prerm $(ctldir)
$(install_script) debian/postinst $(ctldir)
$(install_nonex) debian/copyright $(docdir)
$(install_nonex) debian/changelog $(docdir)/changelog
$(gzip) $(docdir)/changelog
endef
define postbinary
chmod -R g-s $(rootdir)
dpkg-gencontrol -isp -p$(package) -P$(rootdir)
dpkg --build $(rootdir) ..
endef
binary-arch: package=hello-bess
binary-arch: build
$(prebinary)
$(install_dir) $(bindir)
$(install_exec) hello $(bindir)
$(install_exec) hello++ $(bindir)
dpkg-shlibdeps $(bindir)/*
$(postbinary)
binary-indep:
# Nothing to do
clean:
$(RM) hello hello++ debian/files debian/substvars
$(RM) -r debian/tmp
|