upload tizen1.0 source
[kernel/linux-2.6.36.git] / debian / modules / rules.include
1 __MODULES_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
2
3 DEB_HOST_ARCH  := $(shell dpkg-architecture -qDEB_HOST_ARCH)
4 DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
5
6 include $(__MODULES_DIR)rules.defs
7
8 __BINNMU := $(shell dpkg-parsechangelog | sed -rne 's,^Version: .*\+b([0-9]+)$$,\1,p')
9
10 BUILD_STAMP = $(STAMPS_DIR)/build-base
11
12 build: debian/control $(BUILD_STAMP)
13 $(BUILD_STAMP): $(BUILD_DIR) $(STAMPS_DIR)
14         dh_testdir
15         $(MAKE) -f debian/rules.gen build_$(DEB_HOST_ARCH)
16         touch $@
17
18 $(BUILD_DIR) $(STAMPS_DIR):
19         @[ -d $@ ] || mkdir $@
20
21 clean: debian/control
22         dh_testdir
23         rm -rf $(BUILD_DIR) $(STAMPS_DIR)
24         dh_clean
25
26 binary-indep:
27         dh_testdir
28         $(MAKE) -f debian/rules.gen binary-indep
29
30 binary-arch:
31         dh_testdir
32         $(MAKE) -f debian/rules.gen binary-arch_$(DEB_HOST_ARCH)
33
34 binary: binary-indep binary-arch
35
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
45 else
46         grep -v debian/changelog debian/control.md5sum | md5sum --check - --status || \
47                 $(MAKE) -f debian/rules debian/control-real
48 endif
49
50 debian/control-real: $(CONTROL_FILES)
51         $(GENCONTROL) $(__MODULES_DIR)..
52         md5sum $^ > debian/control.md5sum
53 #       @echo
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.
58 #       @echo
59 #       exit 1
60
61 .PHONY: clean build binary-indep binary-arch binary