1#!/usr/bin/make -f 2 3# Uncomment this to turn on verbose mode. 4#export DH_VERBOSE=1 5 6export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie 7export DEB_CFLAGS_MAINT_APPEND=-Wp,-D_FORTIFY_SOURCE=2 -fPIC 8DPKG_EXPORT_BUILDFLAGS = 1 9include /usr/share/dpkg/buildflags.mk 10 11BUILDDIR_unit = $(CURDIR)/debian/build-unit 12BUILDDIR_unit_debug = $(CURDIR)/debian/build-unit-debug 13INSTALLDIR = $(CURDIR)/debian/%%NAME%% 14BASEDIR = $(CURDIR) 15 16%%MODULE_DEFINITIONS%% 17 18config.env.%: 19 dh_testdir 20 mkdir -p $(BUILDDIR_$*) 21 cp -Pa $(CURDIR)/auto $(BUILDDIR_$*)/ 22 cp -Pa $(CURDIR)/configure $(BUILDDIR_$*)/ 23 cp -Pa $(CURDIR)/src $(BUILDDIR_$*)/ 24 cp -Pa $(CURDIR)/test $(BUILDDIR_$*)/ 25 cp -Pa $(CURDIR)/version $(BUILDDIR_$*)/ 26 cp -Pa $(CURDIR)/CHANGES $(BUILDDIR_$*)/ 27 cp -Pa $(CURDIR)/LICENSE $(BUILDDIR_$*)/ 28 cp -Pa $(CURDIR)/NOTICE $(BUILDDIR_$*)/ 29 cp -Pa $(CURDIR)/README.md $(BUILDDIR_$*)/ 30 cp -Pa $(CURDIR)/CONTRIBUTING.md $(BUILDDIR_$*)/ 31 cp -Pa $(CURDIR)/go $(BUILDDIR_$*)/ 32 touch $@ 33 34configure.unit: config.env.unit 35 cd $(BUILDDIR_unit) && \ 36 CFLAGS= ./configure \ 37 %%CONFIGURE_ARGS%% \ 38 --modules=/usr/lib/unit/modules \ 39 --cc-opt="$(CFLAGS)" && \ 40 ./configure %%MODULE_CONFARGS%% 41 touch $@ 42 43configure.unit_debug: config.env.unit_debug 44 cd $(BUILDDIR_unit_debug) && \ 45 CFLAGS= ./configure \ 46 %%CONFIGURE_ARGS%% \ 47 --modules=/usr/lib/unit/debug-modules \ 48 --cc-opt="$(CFLAGS)" \ 49 --debug && \ 50 ./configure %%MODULE_CONFARGS%% 51 touch $@ 52 53build-arch.%: configure.% 54 dh_testdir 55 $(MAKE) -C $(BUILDDIR_$*) %%MODULE_MAKEARGS%% 56 touch $@ 57 58build-indep: 59 dh_testdir 60 touch $@ 61 62build-arch: build-arch.unit build-arch.unit_debug 63 dh_testdir 64 touch $@ 65 66build: build-arch build-indep 67 dh_testdir 68 touch $@ 69 70clean: 71 dh_testdir 72 dh_testroot 73 dh_clean 74 find $(CURDIR) -maxdepth 1 -size 0 -delete 75 rm -rf $(BUILDDIR_unit) $(BUILDDIR_unit_debug) 76 77install: build 78 dh_testdir 79 dh_testroot 80 dh_prep 81 dh_installdirs 82 dh_installinit 83 dh_installlogrotate 84%%MODULE_PREINSTALL%% 85 cd $(BUILDDIR_unit) && \ 86 DESTDIR=$(INSTALLDIR) make %%MODULE_INSTARGS%% 87 cd $(BUILDDIR_unit_debug) && \ 88 DESTDIR=$(INSTALLDIR) make %%MODULE_INSTARGS%% 89%%MODULE_POSTINSTALL%% 90 91binary-indep: build install 92 dh_testdir 93 dh_testroot 94 dh_installdocs 95 dh_installchangelogs 96 dh_link 97 dh_strip --dbg-package=%%NAME%%-dbg 98 dh_shlibdeps 99 dh_compress 100 dh_fixperms 101 dh_installdeb 102 dh_perl 103 dh_gencontrol 104 dh_md5sums 105 dh_builddeb 106 107binary-arch: install 108 109binary: binary-indep binary-arch 110 111.PHONY: clean binary-indep binary-arch binary install build 112