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 include /usr/share/dpkg/architecture.mk
      9 
     10 CFLAGS += -Wall -g
     11 
     12 ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
     13   CFLAGS += -O0
     14 else
     15   CFLAGS += -O2
     16 endif
     17 
     18 ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
     19   NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
     20   MAKEFLAGS += -j$(NUMJOBS)
     21 endif
     22 
     23 extra_build_targets += build-udeb-stamp
     24 
     25 arch64_map = i386=x86_64 powerpc=powerpc64 sparc=sparc64 s390=s390x
     26 ifneq (,$(filter $(DEB_HOST_ARCH)=%, $(arch64_map)))
     27   HOST64 = $(strip $(patsubst $(DEB_HOST_ARCH)=%, %, \
     28 	     $(filter $(DEB_HOST_ARCH)=%, $(arch64_map))))-linux-gnu
     29   CC64 = gcc -m64
     30   extra_build_targets += build64-stamp
     31 endif
     32 
     33 ifeq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
     34   CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE)
     35 else
     36   CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
     37 endif
     38 
     39 all: build
     40 
     41 build: build-arch build-indep
     42 
     43 build-arch: build-stamp $(extra_build_targets)
     44 build-indep: build-stamp $(extra_build_targets)
     45 
     46 configure:
     47 	./bootstrap
     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: configure
     58 	mkdir -p $(@D)
     59 	cd $(@D); sh ../configure --enable-mpers=check --prefix=/usr $(CONFIG_OPTS)
     60 
     61 build-udeb/Makefile: configure
     62 	mkdir -p $(@D)
     63 	cd $(@D); sh ../configure --enable-mpers=check --prefix=/usr \
     64 		--without-stacktrace --without-libiberty $(CONFIG_OPTS)
     65 
     66 build64/Makefile: configure
     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 		mv build64/strace.1 build64/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