summaryrefslogtreecommitdiffhomepage
path: root/pkg/deb/debian.module/rules.in
blob: 7814fbfd3c89f8f6fdaacb3cfae1a32f228dcd59 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie
export DEB_CFLAGS_MAINT_APPEND=-Wp,-D_FORTIFY_SOURCE=2 -fPIC
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

BUILDDIR_unit = $(CURDIR)/debian/build-unit
BUILDDIR_unit_debug = $(CURDIR)/debian/build-unit-debug
INSTALLDIR = $(CURDIR)/debian/%%NAME%%
BASEDIR = $(CURDIR)

%%MODULE_DEFINITIONS%%

config.env.%:
	dh_testdir
%%MODULE_PREBUILD%%
	mkdir -p $(BUILDDIR_$*)
	cp -Pa $(CURDIR)/auto $(BUILDDIR_$*)/
	cp -Pa $(CURDIR)/configure $(BUILDDIR_$*)/
	cp -Pa $(CURDIR)/src $(BUILDDIR_$*)/
	cp -Pa $(CURDIR)/test $(BUILDDIR_$*)/
	cp -Pa $(CURDIR)/version $(BUILDDIR_$*)/
	cp -Pa $(CURDIR)/CHANGES $(BUILDDIR_$*)/
	cp -Pa $(CURDIR)/LICENSE $(BUILDDIR_$*)/
	cp -Pa $(CURDIR)/NOTICE $(BUILDDIR_$*)/
	cp -Pa $(CURDIR)/README.md $(BUILDDIR_$*)/
	cp -Pa $(CURDIR)/CONTRIBUTING.md $(BUILDDIR_$*)/
	cp -Pa $(CURDIR)/go $(BUILDDIR_$*)/
	touch $@

configure.unit: config.env.unit
	cd $(BUILDDIR_unit) && \
	CFLAGS= ./configure \
		%%CONFIGURE_ARGS%% \
		--modulesdir=/usr/lib/unit/modules \
		--cc-opt="$(CFLAGS)" && \
	./configure %%MODULE_CONFARGS%%
	touch $@

configure.unit_debug: config.env.unit_debug
	cd $(BUILDDIR_unit_debug) && \
	CFLAGS= ./configure \
		%%CONFIGURE_ARGS%% \
		--modulesdir=/usr/lib/unit/debug-modules \
		--cc-opt="$(CFLAGS)" \
		--debug && \
	./configure %%MODULE_CONFARGS%%
	touch $@

build-arch.%: configure.%
	dh_testdir
	$(MAKE) -C $(BUILDDIR_$*) %%MODULE_MAKEARGS%%
	touch $@

build-indep:
	dh_testdir
	touch $@

build-arch: build-arch.unit build-arch.unit_debug
	dh_testdir
	touch $@

build: build-arch build-indep
	dh_testdir
	touch $@

clean:
	dh_testdir
	dh_testroot
	dh_clean
	find $(CURDIR) -maxdepth 1 -size 0 -delete
	rm -rf $(BUILDDIR_unit) $(BUILDDIR_unit_debug)

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	dh_installinit
	dh_installlogrotate
%%MODULE_PREINSTALL%%
	cd $(BUILDDIR_unit) && \
	DESTDIR=$(INSTALLDIR) make %%MODULE_INSTARGS%%
	cd $(BUILDDIR_unit_debug) && \
	DESTDIR=$(INSTALLDIR) make %%MODULE_INSTARGS%%
%%MODULE_POSTINSTALL%%

binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installdocs
	dh_installchangelogs
	dh_link
	dh_strip --dbg-package=%%NAME%%-dbg
	dh_shlibdeps
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_perl
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch: install

binary: binary-indep binary-arch

.PHONY: clean binary-indep binary-arch binary install build