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