Home | History | Annotate | Download | only in debian
      1 #! /usr/bin/make -f
      2 
      3 #export DH_VERBOSE=1
      4 
      5 export DEB_BUILD_MAINT_OPTIONS = hardening=+all
      6 DPKG_EXPORT_BUILDFLAGS = 1
      7 include /usr/share/dpkg/buildflags.mk
      8 
      9 CFLAGS += -Wall -g
     10 
     11 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
     12   CFLAGS += -O0
     13 else
     14   CFLAGS += -O2
     15 endif
     16 
     17 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
     18   NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
     19   MAKEFLAGS += -j$(NUMJOBS)
     20 endif
     21 
     22 DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
     23 DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
     24 DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
     25 
     26 arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x
     27 ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map)))
     28   HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \
     29 	     $(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu
     30   CC64 = gcc -m64
     31   extra_build_targets += build64-stamp
     32 endif
     33 
     34 ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
     35   CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
     36 else
     37   CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
     38 endif
     39 
     40 all build: build-stamp $(extra_build_targets)
     41 
     42 %-stamp: %/Makefile
     43 	$(MAKE) -C $*
     44 ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
     45 	$(MAKE) -C $* check
     46 endif
     47 	touch $@
     48 
     49 build/Makefile:
     50 	mkdir -p $(@D)
     51 	cd $(@D); sh ../configure --prefix=/usr $(CONFIG_OPTS)
     52 
     53 build64/Makefile:
     54 	mkdir -p $(@D)
     55 	cd $(@D); CC="$(CC64)" sh ../configure --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
     56 
     57 clean:
     58 	dh_testdir
     59 	dh_testroot
     60 	rm -rf build build64 strace64.1
     61 	dh_clean
     62 
     63 binary: binary-indep binary-arch
     64 
     65 binary-indep:
     66 
     67 binary-arch: build
     68 	test -f build-stamp || make $(MFLAGS) -f debian/rules build
     69 
     70 	# prepare 64bit executable and manpage, if it has been built
     71 	test -f build64-stamp && ( mv build64/strace build64/strace64 ; \
     72 		cp strace.1 strace64.1 ) || true
     73 
     74 	dh_testdir -s
     75 	dh_testroot -s
     76 	dh_installdirs -s
     77 	dh_installdocs -s
     78 	dh_installman -s
     79 	dh_installexamples -s
     80 	dh_installchangelogs -s
     81 	dh_install -s
     82 	dh_link -s
     83 	dh_strip -s
     84 	dh_compress -s
     85 	dh_fixperms -s
     86 	dh_installdeb -s
     87 	dh_shlibdeps -s
     88 	dh_gencontrol -s
     89 	dh_md5sums -s
     90 	dh_builddeb -s
     91