xref: /unit/pkg/deb/debian.module/rules.in (revision 1316:5b767c6bfd0a)
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 $(BUILDDIR_$*)/
30	cp -Pa $(CURDIR)/go $(BUILDDIR_$*)/
31	touch $@
32
33configure.unit: config.env.unit
34	cd $(BUILDDIR_unit) && \
35	CFLAGS= ./configure \
36		%%CONFIGURE_ARGS%% \
37		--modules=/usr/lib/unit/modules \
38		--cc-opt="$(CFLAGS)" && \
39	./configure %%MODULE_CONFARGS%%
40	touch $@
41
42configure.unit_debug: config.env.unit_debug
43	cd $(BUILDDIR_unit_debug) && \
44	CFLAGS= ./configure \
45		%%CONFIGURE_ARGS%% \
46		--modules=/usr/lib/unit/debug-modules \
47		--cc-opt="$(CFLAGS)" \
48		--debug && \
49	./configure %%MODULE_CONFARGS%%
50	touch $@
51
52build-arch.%: configure.%
53	dh_testdir
54	$(MAKE) -C $(BUILDDIR_$*) %%MODULE_MAKEARGS%%
55	touch $@
56
57build-indep:
58	dh_testdir
59	touch $@
60
61build-arch: build-arch.unit build-arch.unit_debug
62	dh_testdir
63	touch $@
64
65build: build-arch build-indep
66	dh_testdir
67	touch $@
68
69clean:
70	dh_testdir
71	dh_testroot
72	dh_clean
73	find $(CURDIR) -maxdepth 1 -size 0 -delete
74	rm -rf $(BUILDDIR_unit) $(BUILDDIR_unit_debug)
75
76install: build
77	dh_testdir
78	dh_testroot
79	dh_prep
80	dh_installdirs
81	dh_installinit
82	dh_installlogrotate
83%%MODULE_PREINSTALL%%
84	cd $(BUILDDIR_unit) && \
85	DESTDIR=$(INSTALLDIR) make %%MODULE_INSTARGS%%
86	cd $(BUILDDIR_unit_debug) && \
87	DESTDIR=$(INSTALLDIR) make %%MODULE_INSTARGS%%
88%%MODULE_POSTINSTALL%%
89
90binary-indep: build install
91	dh_testdir
92	dh_testroot
93	dh_installdocs
94	dh_installchangelogs
95	dh_link
96	dh_strip --dbg-package=%%NAME%%-dbg
97	dh_shlibdeps
98	dh_compress
99	dh_fixperms
100	dh_installdeb
101	dh_perl
102	dh_gencontrol
103	dh_md5sums
104	dh_builddeb
105
106binary-arch: install
107
108binary: binary-indep binary-arch
109
110.PHONY: clean binary-indep binary-arch binary install build
111