summaryrefslogtreecommitdiffstats
path: root/modules/rules.include
diff options
context:
space:
mode:
Diffstat (limited to 'modules/rules.include')
-rw-r--r--modules/rules.include61
1 files changed, 61 insertions, 0 deletions
diff --git a/modules/rules.include b/modules/rules.include
new file mode 100644
index 0000000..faf7e65
--- /dev/null
+++ b/modules/rules.include
@@ -0,0 +1,61 @@
+__MODULES_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
+
+DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
+DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
+
+include $(__MODULES_DIR)rules.defs
+
+__BINNMU := $(shell dpkg-parsechangelog | sed -ne 's,^Version: .*\+b\(.*\)$$,\1,p')
+
+BUILD_STAMP = $(STAMPS_DIR)/build-base
+
+build: debian/control $(BUILD_STAMP)
+$(BUILD_STAMP): $(BUILD_DIR) $(STAMPS_DIR)
+ dh_testdir
+ $(MAKE) -f debian/rules.gen build_$(DEB_HOST_ARCH)
+ touch $@
+
+$(BUILD_DIR) $(STAMPS_DIR):
+ @[ -d $@ ] || mkdir $@
+
+clean: debian/control
+ dh_testdir
+ rm -rf $(BUILD_DIR) $(STAMPS_DIR)
+ dh_clean
+
+binary-indep:
+ dh_testdir
+ $(MAKE) -f debian/rules.gen binary-indep
+
+binary-arch:
+ dh_testdir
+ $(MAKE) -f debian/rules.gen binary-arch_$(DEB_HOST_ARCH)
+
+binary: binary-indep binary-arch
+
+CONTROL_FILES += debian/changelog $(wildcard debian/templates/control.*)
+CONTROL_FILES += $(wildcard debian/arch/defines) $(wildcard debian/arch/*/defines) $(wildcard debian/arch/*/*/defines)
+GENCONTROL = $(__MODULES_DIR)gencontrol.py
+debian/control debian/rules.gen: $(CONTROL_FILES)
+ifeq ($(wildcard debian/control.md5sum),)
+ $(MAKE) -f debian/rules debian/control-real
+else ifeq ($(__BINNMU),)
+ md5sum --check debian/control.md5sum --status || \
+ $(MAKE) -f debian/rules debian/control-real
+else
+ grep -v debian/changelog debian/control.md5sum | md5sum --check - --status || \
+ $(MAKE) -f debian/rules debian/control-real
+endif
+
+debian/control-real: $(CONTROL_FILES)
+ $(GENCONTROL) $(__MODULES_DIR)..
+ md5sum $^ > debian/control.md5sum
+ @echo
+ @echo This target is made to fail intentionally, to make sure
+ @echo that it is NEVER run during the automated build. Please
+ @echo ignore the following error, the debian/control file has
+ @echo been generated SUCCESSFULLY.
+ @echo
+ exit 1
+
+.PHONY: clean build binary-indep binary-arch binary