1 __MODULES_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
3 DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
4 DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
6 include $(__MODULES_DIR)rules.defs
8 __BINNMU := $(shell dpkg-parsechangelog | sed -rne 's,^Version: .*\+b([0-9]+)$$,\1,p')
10 BUILD_STAMP = $(STAMPS_DIR)/build-base
12 build: debian/control $(BUILD_STAMP)
13 $(BUILD_STAMP): $(BUILD_DIR) $(STAMPS_DIR)
15 $(MAKE) -f debian/rules.gen build_$(DEB_HOST_ARCH)
18 $(BUILD_DIR) $(STAMPS_DIR):
19 @[ -d $@ ] || mkdir $@
23 rm -rf $(BUILD_DIR) $(STAMPS_DIR)
28 $(MAKE) -f debian/rules.gen binary-indep
32 $(MAKE) -f debian/rules.gen binary-arch_$(DEB_HOST_ARCH)
34 binary: binary-indep binary-arch
36 CONTROL_FILES += debian/changelog $(wildcard debian/templates/control.*)
37 CONTROL_FILES += $(wildcard debian/arch/defines) $(wildcard debian/arch/*/defines) $(wildcard debian/arch/*/*/defines)
38 GENCONTROL = $(__MODULES_DIR)gencontrol.py
39 debian/control debian/rules.gen: $(CONTROL_FILES)
40 ifeq ($(wildcard debian/control.md5sum),)
41 $(MAKE) -f debian/rules debian/control-real
42 else ifeq ($(__BINNMU),)
43 md5sum --check debian/control.md5sum --status || \
44 $(MAKE) -f debian/rules debian/control-real
46 grep -v debian/changelog debian/control.md5sum | md5sum --check - --status || \
47 $(MAKE) -f debian/rules debian/control-real
50 debian/control-real: $(CONTROL_FILES)
51 $(GENCONTROL) $(__MODULES_DIR)..
52 md5sum $^ > debian/control.md5sum
54 # @echo This target is made to fail intentionally, to make sure
55 # @echo that it is NEVER run during the automated build. Please
56 # @echo ignore the following error, the debian/control file has
57 # @echo been generated SUCCESSFULLY.
61 .PHONY: clean build binary-indep binary-arch binary