4 DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
5 SOURCE := $(shell dpkg-parsechangelog | sed -ne 's,^Source: *\(.*\)$$,\1,p')
6 VERSION := $(shell dpkg-parsechangelog | sed -ne 's,^Version: *\(.*\)$$,\1,p')
7 VERSION_UPSTREAM := $(shell echo "$(VERSION)" | sed -e 's,-[^-]*$$,,')
8 VERSION_BINNMU := $(shell echo "$(VERSION)" | sed -ne 's,.*\+b\(.*\)$$,\1,p')
10 include debian/rules.defs
12 stamp = [ -d $(dir $@) ] || mkdir $(dir $@); touch $@
16 source: debian/control $(STAMPS_DIR)/source-base
17 $(STAMPS_DIR)/source-base:
19 $(MAKE) -f debian/rules.gen source_$(DEB_HOST_ARCH)
22 source-all: debian/control
24 $(MAKE) -f debian/rules.gen source
26 setup: debian/control $(STAMPS_DIR)/setup-base
27 $(STAMPS_DIR)/setup-base: $(STAMPS_DIR)/source-base
29 $(MAKE) -f debian/rules.gen setup_$(DEB_HOST_ARCH)
32 build: debian/control $(STAMPS_DIR)/build-base
33 $(STAMPS_DIR)/build-base: $(STAMPS_DIR)/setup-base
35 $(MAKE) -f debian/rules.gen build_$(DEB_HOST_ARCH)
38 DIR_ORIG = ../orig/$(SOURCE)-$(VERSION_UPSTREAM)
39 TAR_ORIG_NAME = $(SOURCE)_$(VERSION_UPSTREAM).orig.tar.gz
40 TAR_ORIG = $(firstword $(wildcard ../$(TAR_ORIG_NAME)) $(wildcard ../orig/$(TAR_ORIG_NAME)))
43 rsync --delete --exclude debian --exclude .svk --exclude .svn --link-dest=$(DIR_ORIG)/ -a $(DIR_ORIG)/ .
47 $(error Cannot find orig tarball $(TAR_ORIG_NAME))
50 tar -C ../orig -xzf $(TAR_ORIG)
54 rm -f debian/config.defines.dump debian/control debian/control.md5sum debian/rules.gen debian/bin/patch.*
55 rm -rf $(filter-out debian .svk .svn, $(wildcard * .[^.]*))
59 rm -rf $(BUILD_DIR) $(STAMPS_DIR) debian/lib/python/debian_linux/*.pyc debian/linux-headers-* debian/linux-image-* debian/linux-tools-*
62 binary-indep: $(STAMPS_DIR)/source-base
64 $(MAKE) -f debian/rules.gen binary-indep
66 binary-arch: $(STAMPS_DIR)/build-base
68 $(MAKE) -f debian/rules.gen binary-arch_$(DEB_HOST_ARCH)
70 binary: binary-indep binary-arch
72 CONTROL_FILES = debian/changelog $(wildcard debian/templates/*.in)
73 CONTROL_FILES += debian/config/defines $(wildcard debian/config/*/defines) $(wildcard debian/config/*/*/defines)
74 debian/control debian/rules.gen: debian/bin/gencontrol.py $(CONTROL_FILES)
75 ifeq ($(wildcard debian/control.md5sum),)
76 $(MAKE) -f debian/rules debian/control-real
77 else ifeq ($(VERSION_BINNMU),)
78 md5sum --check debian/control.md5sum --status || \
79 $(MAKE) -f debian/rules debian/control-real
81 grep -v debian/changelog debian/control.md5sum | md5sum --check - --status || \
82 $(MAKE) -f debian/rules debian/control-real
85 debian/control-real: debian/bin/gencontrol.py $(CONTROL_FILES)
88 md5sum $^ > debian/control.md5sum
90 # @echo This target is made to fail intentionally, to make sure
91 # @echo that it is NEVER run during the automated build. Please
92 # @echo ignore the following error, the debian/control file has
93 # @echo been generated SUCCESSFULLY.
97 .PHONY: clean build setup binary-indep binary-arch binary