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