#!/usr/bin/make -f DEB_BUILD_ARCH=$(shell dpkg-architecture -qDEB_BUILD_ARCH) DEB_HOST_ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH) DEB_HOST_ARCH_OS=$(shell dpkg-architecture -qDEB_HOST_ARCH_OS) ifneq (${DEB_BUILD_ARCH},${DEB_HOST_ARCH}) DEB_HOST_GNU_TYPE=$(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) endif # is ${CC} defined anywhere (other than implicit rules?) ifneq (,$(findstring $(origin CC),default undefined)) # no - then default to gcc (or cross-gcc) ifneq (${DEB_BUILD_ARCH},${DEB_HOST_ARCH}) CC= ${DEB_HOST_GNU_TYPE}-gcc else CC= gcc endif endif EXTRA_CPPFLAGS= -DPAX_SAFE_PATH=\"/usr/bin:/bin\" EXTRA_CFLAGS= -Wall -Wextra -Wformat -fno-strict-aliasing EXTRA_LDFLAGS= -Wl,--as-needed ifneq (kfreebsd,${DEB_HOST_ARCH_OS}) ifneq (x32,${DEB_HOST_ARCH}) EXTRA_CPPFLAGS+= -DLONG_OFF_T endif endif # probably on all EXTRA_CPPFLAGS+= -DHAVE_LINKAT ifneq (,$(wildcard /usr/share/dpkg/buildflags.mk)) # dpkg-dev (>= 1.16.1~) dpkgbuildflagsmkescape=$(subst \,\\\,$(1)) DEB_CFLAGS_MAINT_APPEND=$(call dpkgbuildflagsmkescape,${EXTRA_CFLAGS}) DEB_CPPFLAGS_MAINT_APPEND=$(call dpkgbuildflagsmkescape,${EXTRA_CPPFLAGS}) DEB_LDFLAGS_MAINT_APPEND=$(call dpkgbuildflagsmkescape,${EXTRA_LDFLAGS}) DEB_BUILD_MAINT_OPTIONS=hardening=+all include /usr/share/dpkg/buildflags.mk else # old-fashioned way to determine build flags CFLAGS= -O$(if $(findstring noopt,${DEB_BUILD_OPTIONS}),0,2) -g CFLAGS+= ${EXTRA_CFLAGS} CPPFLAGS+= ${EXTRA_CPPFLAGS} LDFLAGS+= ${EXTRA_LDFLAGS} endif build: build-arch build-indep build-arch: debian/.build_stamp build-indep: debian/.build_stamp: dh_testdir ${CC} ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -o pax \ ar.c ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file_subs.c \ ftree.c gen_subs.c getoldopt.c options.c pat_rep.c pax.c \ sel_subs.c tables.c tar.c tty_subs.c test -x pax echo .nr g 2 | cat - cpio.1 >debian/paxcpio.1 echo .nr g 2 | cat - pax.1 >debian/pax.1 echo .nr g 2 | cat - tar.1 >debian/paxtar.1 @:>$@ clean: dh_testdir dh_clean -rm -f debian/.*_stamp \ debian/paxcpio.1 debian/pax.1 debian/paxtar.1 pax binary-indep: build-indep binary-arch: build-arch dh $@ # avoid dh7 being "too" automagic override_dh_auto_install: binary: binary-arch binary-indep .PHONY: binary binary-arch binary-indep build build-arch build-indep clean