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 extra_build_targets += build-udeb-stamp
     27 
     28 arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x
     29 ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map)))
     30   HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \
     31 	     $(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu
     32   CC64 = gcc -m64
     33   extra_build_targets += build64-stamp
     34 endif
     35 
     36 ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
     37   CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
     38 else
     39   CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
     40 endif
     41 
     42 all: build
     43 
     44 build: build-arch build-indep
     45 
     46 build-arch: build-stamp $(extra_build_targets)
     47 build-indep: build-stamp $(extra_build_targets)
     48 
     49 %-stamp: %/Makefile
     50 	$(MAKE) -C $*
     51 ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
     52 	$*/strace -V
     53 	$(MAKE) -C $* check VERBOSE=1
     54 endif
     55 	touch $@
     56 
     57 build/Makefile:
     58 	mkdir -p $(@D)
     59 	cd $(@D); sh ../configure --enable-mpers=check --prefix=/usr $(CONFIG_OPTS)
     60 
     61 build-udeb/Makefile:
     62 	mkdir -p $(@D)
     63 	cd $(@D); sh ../configure --enable-mpers=check --prefix=/usr \
     64 		--without-libunwind --without-libiberty $(CONFIG_OPTS)
     65 
     66 build64/Makefile:
     67 	mkdir -p $(@D)
     68 	cd $(@D); CC="$(CC64)" sh ../configure --enable-mpers=check --prefix=/usr --build=$(DEB_BUILD_GNU_TYPE) --host=$(HOST64)
     69 
     70 clean:
     71 	dh_testdir
     72 	dh_testroot
     73 	rm -rf build build-udeb build64 strace64.1 debian/strace64.substvars
     74 	dh_clean
     75 
     76 binary: binary-indep binary-arch
     77 
     78 binary-indep:
     79 
     80 binary-arch: build
     81 	test -f build-stamp || make $(MFLAGS) -f debian/rules build
     82 
     83 	# prepare 64bit executable and manpage, if it has been built
     84 	test -f build64-stamp && ( mv build64/strace build64/strace64 ; \
     85 		cp strace.1 strace64.1 ) || true
     86 
     87 	dh_testdir -a
     88 	dh_testroot -a
     89 	dh_installdirs -a
     90 	dh_installdocs -a
     91 	dh_installman -a
     92 	dh_installexamples -a
     93 	dh_installchangelogs -a
     94 	dh_install -a
     95 	dh_link -a
     96 	dh_strip -a
     97 	dh_compress -a
     98 	dh_fixperms -a
     99 	dh_installdeb -a
    100 	dh_shlibdeps -a
    101 	dh_gencontrol -a
    102 	dh_md5sums -a
    103 	dh_builddeb -a
    104