upload tizen1.0 source
[kernel/linux-2.6.36.git] / debian / rules
1 #!/usr/bin/make -f
2
3 SHELL    := sh -e
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')
9
10 include debian/rules.defs
11
12 stamp = [ -d $(dir $@) ] || mkdir $(dir $@); touch $@
13
14 .NOTPARALLEL:
15
16 source: debian/control $(STAMPS_DIR)/source-base
17 $(STAMPS_DIR)/source-base:
18         dh_testdir
19         $(MAKE) -f debian/rules.gen source_$(DEB_HOST_ARCH)
20         @$(stamp)
21
22 source-all: debian/control
23         dh_testdir
24         $(MAKE) -f debian/rules.gen source
25
26 setup: debian/control $(STAMPS_DIR)/setup-base
27 $(STAMPS_DIR)/setup-base: $(STAMPS_DIR)/source-base
28         dh_testdir
29         $(MAKE) -f debian/rules.gen setup_$(DEB_HOST_ARCH)
30         @$(stamp)
31
32 build: debian/control $(STAMPS_DIR)/build-base
33 $(STAMPS_DIR)/build-base: $(STAMPS_DIR)/setup-base
34         dh_testdir
35         $(MAKE) -f debian/rules.gen build_$(DEB_HOST_ARCH)
36         @$(stamp)
37
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)))
41
42 orig: $(DIR_ORIG)
43         rsync --delete --exclude debian --exclude .svk --exclude .svn --link-dest=$(DIR_ORIG)/ -a $(DIR_ORIG)/ .
44
45 $(DIR_ORIG):
46 ifeq ($(TAR_ORIG),)
47         $(error Cannot find orig tarball $(TAR_ORIG_NAME))
48 else
49         mkdir -p ../orig
50         tar -C ../orig -xzf $(TAR_ORIG)
51 endif
52
53 maintainerclean:
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 * .[^.]*))
56
57 clean: debian/control
58         dh_testdir
59         rm -rf $(BUILD_DIR) $(STAMPS_DIR) debian/lib/python/debian_linux/*.pyc debian/linux-headers-* debian/linux-image-* debian/linux-tools-*
60         dh_clean
61
62 binary-indep: $(STAMPS_DIR)/source-base
63         dh_testdir
64         $(MAKE) -f debian/rules.gen binary-indep
65
66 binary-arch: $(STAMPS_DIR)/build-base
67         dh_testdir
68         $(MAKE) -f debian/rules.gen binary-arch_$(DEB_HOST_ARCH)
69
70 binary: binary-indep binary-arch
71
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
80 else
81         grep -v debian/changelog debian/control.md5sum | md5sum --check - --status || \
82                 $(MAKE) -f debian/rules debian/control-real
83 endif
84
85 debian/control-real: debian/bin/gencontrol.py $(CONTROL_FILES)
86         chmod +x $<
87         $<
88         md5sum $^ > debian/control.md5sum
89 #       @echo
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.
94 #       @echo
95 #       exit 1
96
97 .PHONY: clean build setup binary-indep binary-arch binary