blob: 8e66ae9b6a985dc93817459bfefa4d23d9b71270 [file] [log] [blame]
Wichert Akkermand321ff92002-03-31 18:45:45 +00001#! /usr/bin/make -f
2
Frederik Schüler0c56f622010-04-13 13:04:00 +02003#export DH_VERBOSE=1
Frederik Schüler881f5732010-02-04 12:14:56 -08004
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
Frederik Schüler0c56f622010-04-13 13:04:00 +020013ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
14 NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
15 MAKEFLAGS += -j$(NUMJOBS)
16endif
17
Roland McGrath38d88e62004-10-19 23:23:34 +000018DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
Roland McGrathc9b624f2004-08-31 08:40:50 +000019DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
Roland McGrath98d5f012005-02-03 03:19:34 +000020DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
21
Roland McGrath75df90e2007-08-03 09:59:09 +000022arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x
23ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map)))
24 HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \
25 $(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu
Roland McGrathc9b624f2004-08-31 08:40:50 +000026 CC64 = gcc -m64
Frederik Schüler0c56f622010-04-13 13:04:00 +020027 extra_build_targets += build64-stamp
Roland McGrathc9b624f2004-08-31 08:40:50 +000028endif
29
Roland McGrath38d88e62004-10-19 23:23:34 +000030ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
31 CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
32else
33 CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
34endif
35
Frederik Schüler0c56f622010-04-13 13:04:00 +020036all build: build-stamp $(extra_build_targets)
Roland McGrathc9b624f2004-08-31 08:40:50 +000037
Frederik Schüler0c56f622010-04-13 13:04:00 +020038%-stamp: %/Makefile
Roland McGrathc9b624f2004-08-31 08:40:50 +000039 $(MAKE) -C $*
40 touch $@
41
42build/Makefile:
43 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000044 cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
Roland McGrathc9b624f2004-08-31 08:40:50 +000045
46build64/Makefile:
47 mkdir -p $(@D)
Roland McGrath38d88e62004-10-19 23:23:34 +000048 cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
Roland McGrathc9b624f2004-08-31 08:40:50 +000049
Wichert Akkermand321ff92002-03-31 18:45:45 +000050clean:
Frederik Schüler881f5732010-02-04 12:14:56 -080051 dh_testdir
52 dh_testroot
Frederik Schüler0c56f622010-04-13 13:04:00 +020053 rm -rf build build64 strace64.1
Roland McGrath6019fbb2008-07-18 00:18:27 +000054 dh_clean
Wichert Akkermand321ff92002-03-31 18:45:45 +000055
56binary: binary-indep binary-arch
57
58binary-indep:
59
Frederik Schüler881f5732010-02-04 12:14:56 -080060binary-arch: build
Frederik Schüler0c56f622010-04-13 13:04:00 +020061 test -f build-stamp || make $(MFLAGS) -f debian/rules build
Dmitry V. Levin414fe7d2009-07-08 11:21:17 +000062
Roland McGratha04e2132008-07-22 00:27:31 +000063 # prepare 64bit executable and manpage, if it has been built
Frederik Schüler0c56f622010-04-13 13:04:00 +020064 test -f build64-stamp && ( mv build64/strace build64/strace64 ; \
Roland McGratha04e2132008-07-22 00:27:31 +000065 cp strace.1 strace64.1 ) || true
Dmitry V. Levin414fe7d2009-07-08 11:21:17 +000066
Roland McGratha04e2132008-07-22 00:27:31 +000067 dh_testdir -s
68 dh_testroot -s
69 dh_installdirs -s
70 dh_installdocs -s
71 dh_installman -s
72 dh_installexamples -s
Frederik Schülerf786da52009-10-05 20:50:07 +000073 dh_installchangelogs -s
Roland McGratha04e2132008-07-22 00:27:31 +000074 dh_install -s
75 dh_link -s
76 dh_strip -s
77 dh_compress -s
78 dh_fixperms -s
79 dh_installdeb -s
80 dh_shlibdeps -s
81 dh_gencontrol -s
82 dh_md5sums -s
83 dh_builddeb -s