xref: /unit/pkg/deb/debian.module/rules-noarch.in (revision 2103:6e61a013417e)
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_compress
98	dh_fixperms
99	dh_installdeb
100	dh_perl
101	dh_gencontrol
102	dh_md5sums
103	dh_builddeb
104
105binary-arch: install
106
107binary: binary-indep binary-arch
108
109.PHONY: clean binary-indep binary-arch binary install build
110