blob: 62903fd3aa74577a54669061b9658384cdddae2c [file] [log] [blame]
Wichert Akkermand321ff92002-03-31 18:45:45 +00001#! /usr/bin/make -f
2
Frederik Schüler881f5732010-02-04 12:14:56 -08003export DH_VERBOSE=1
4
5CFLAGS = -Wall -g
6
7ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
8 CFLAGS += -O0
9else
10 CFLAGS += -O2
11endif
Wichert Akkermand321ff92002-03-31 18:45:45 +000012
Roland McGrath38d88e62004-10-19 23:23:34 +000013DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
Roland McGrathc9b624f2004-08-31 08:40:50 +000014DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
Roland McGrath98d5f012005-02-03 03:19:34 +000015DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
16
Roland McGrath75df90e2007-08-03 09:59:09 +000017arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x
18ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map)))
19 HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \
20 $(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu
Roland McGrathc9b624f2004-08-31 08:40:50 +000021 CC64 = gcc -m64
Roland McGrath75df90e2007-08-03 09:59:09 +000022 extra_build_targets += stamp-build64
Roland McGrathc9b624f2004-08-31 08:40:50 +000023endif
24
Roland McGrath38d88e62004-10-19 23:23:34 +000025ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
26 CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
27else
28 CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
29endif
30
Roland McGrath75df90e2007-08-03 09:59:09 +000031all build: stamp-build $(extra_build_targets)
Roland McGrathc9b624f2004-08-31 08:40:50 +000032
33stamp-%: %/Makefile
34 $(MAKE) -C $*
35 touch $@
36
37build/Makefile:
38 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000039 cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
Roland McGrathc9b624f2004-08-31 08:40:50 +000040
41build64/Makefile:
42 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000043 cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
Roland McGrathc9b624f2004-08-31 08:40:50 +000044
Wichert Akkermand321ff92002-03-31 18:45:45 +000045clean:
Frederik Schüler881f5732010-02-04 12:14:56 -080046 dh_testdir
47 dh_testroot
48 dh_prep
Roland McGrath6019fbb2008-07-18 00:18:27 +000049 dh_clean
Roland McGrath9a001a72008-07-18 00:49:31 +000050 rm -rf debian/strace debian/strace-udeb debian/substvars debian/files debian/files~
Roland McGratha04e2132008-07-22 00:27:31 +000051 rm -rf build64 stamp-build64 strace64.1
Roland McGrathc9b624f2004-08-31 08:40:50 +000052 rm -rf build stamp-build
Wichert Akkermand321ff92002-03-31 18:45:45 +000053
54binary: binary-indep binary-arch
55
56binary-indep:
57
Frederik Schüler881f5732010-02-04 12:14:56 -080058binary-arch: build
Wichert Akkermand321ff92002-03-31 18:45:45 +000059 test -f stamp-build || make $(MFLAGS) -f debian/rules build
Dmitry V. Levin414fe7d2009-07-08 11:21:17 +000060
Roland McGratha04e2132008-07-22 00:27:31 +000061 # prepare 64bit executable and manpage, if it has been built
62 test -f stamp-build64 && ( mv build64/strace build64/strace64 ; \
63 cp strace.1 strace64.1 ) || true
Dmitry V. Levin414fe7d2009-07-08 11:21:17 +000064
Roland McGratha04e2132008-07-22 00:27:31 +000065 dh_testdir -s
66 dh_testroot -s
67 dh_installdirs -s
68 dh_installdocs -s
69 dh_installman -s
70 dh_installexamples -s
Frederik Schülerf786da52009-10-05 20:50:07 +000071 dh_installchangelogs -s
Roland McGratha04e2132008-07-22 00:27:31 +000072 dh_install -s
73 dh_link -s
74 dh_strip -s
75 dh_compress -s
76 dh_fixperms -s
77 dh_installdeb -s
78 dh_shlibdeps -s
79 dh_gencontrol -s
80 dh_md5sums -s
81 dh_builddeb -s