xref: /unit/pkg/deb/debian/rules.in (revision 980)
1373Sdefan@nginx.com#!/usr/bin/make -f
2373Sdefan@nginx.com
3373Sdefan@nginx.com# Uncomment this to turn on verbose mode.
4373Sdefan@nginx.com#export DH_VERBOSE=1
5373Sdefan@nginx.com
6442Sdefan@nginx.comexport DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie
7442Sdefan@nginx.comexport DEB_CFLAGS_MAINT_APPEND=-Wp,-D_FORTIFY_SOURCE=2 -fPIC
8442Sdefan@nginx.comexport DEB_LDFLAGS_MAINT_APPEND=-Wl,--as-needed -pie
9442Sdefan@nginx.comDPKG_EXPORT_BUILDFLAGS = 1
10442Sdefan@nginx.cominclude /usr/share/dpkg/buildflags.mk
11442Sdefan@nginx.com
12815Sdefan@nginx.comDEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
13815Sdefan@nginx.com
14373Sdefan@nginx.comBUILDDIR_unit = $(CURDIR)/debian/build-unit
15373Sdefan@nginx.comBUILDDIR_unit_debug = $(CURDIR)/debian/build-unit-debug
16373Sdefan@nginx.comINSTALLDIR = $(CURDIR)/debian/unit
17815Sdefan@nginx.comINSTALLDIR_dev = $(CURDIR)/debian/unit-dev
18373Sdefan@nginx.comBASEDIR = $(CURDIR)
19373Sdefan@nginx.com
20373Sdefan@nginx.comDOTESTS = 0
21373Sdefan@nginx.com
22373Sdefan@nginx.comconfig.env.%:
23373Sdefan@nginx.com	dh_testdir
24373Sdefan@nginx.com	mkdir -p $(BUILDDIR_$*)
25373Sdefan@nginx.com	cp -Pa $(CURDIR)/auto $(BUILDDIR_$*)/
26373Sdefan@nginx.com	cp -Pa $(CURDIR)/configure $(BUILDDIR_$*)/
27373Sdefan@nginx.com	cp -Pa $(CURDIR)/src $(BUILDDIR_$*)/
28373Sdefan@nginx.com	cp -Pa $(CURDIR)/test $(BUILDDIR_$*)/
29957Sdefan@nginx.com	cp -Pa $(CURDIR)/version $(BUILDDIR_$*)/
30*980Sdefan@nginx.com	cp -Pa $(CURDIR)/CHANGES $(BUILDDIR_$*)/
31*980Sdefan@nginx.com	cp -Pa $(CURDIR)/LICENSE $(BUILDDIR_$*)/
32*980Sdefan@nginx.com	cp -Pa $(CURDIR)/NOTICE $(BUILDDIR_$*)/
33*980Sdefan@nginx.com	cp -Pa $(CURDIR)/README $(BUILDDIR_$*)/
34373Sdefan@nginx.com	touch $@
35373Sdefan@nginx.com
36373Sdefan@nginx.comconfigure.unit: config.env.unit
37373Sdefan@nginx.com	cd $(BUILDDIR_unit) && \
38442Sdefan@nginx.com	CFLAGS= ./configure \
39373Sdefan@nginx.com		%%CONFIGURE_ARGS%% \
40442Sdefan@nginx.com		--modules=/usr/lib/unit/modules \
41815Sdefan@nginx.com		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
42442Sdefan@nginx.com		--cc-opt="$(CFLAGS)" \
43442Sdefan@nginx.com		--ld-opt="$(LDFLAGS)"
44373Sdefan@nginx.com	touch $@
45373Sdefan@nginx.com
46373Sdefan@nginx.comconfigure.unit_debug: config.env.unit_debug
47373Sdefan@nginx.com	cd $(BUILDDIR_unit_debug) && \
48442Sdefan@nginx.com	CFLAGS= ./configure \
49373Sdefan@nginx.com		%%CONFIGURE_ARGS%% \
50373Sdefan@nginx.com		--modules=/usr/lib/unit/debug-modules \
51815Sdefan@nginx.com		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
52442Sdefan@nginx.com		--cc-opt="$(CFLAGS)" \
53442Sdefan@nginx.com		--ld-opt="$(LDFLAGS)" \
54373Sdefan@nginx.com		--debug
55373Sdefan@nginx.com	touch $@
56373Sdefan@nginx.com
57373Sdefan@nginx.combuild-arch.%: configure.%
58373Sdefan@nginx.com	dh_testdir
59373Sdefan@nginx.com	$(MAKE) -C $(BUILDDIR_$*)
60815Sdefan@nginx.com	$(MAKE) -C $(BUILDDIR_$*) build/libunit.a
61373Sdefan@nginx.comifeq ($(DOTESTS), 1)
62373Sdefan@nginx.com	$(MAKE) -C $(BUILDDIR_$*) tests
63373Sdefan@nginx.comendif
64373Sdefan@nginx.com	touch $@
65373Sdefan@nginx.com
66373Sdefan@nginx.comdo.tests: build
67373Sdefan@nginx.com	dh_testdir
68373Sdefan@nginx.comifeq ($(DOTESTS), 1)
69373Sdefan@nginx.com	cd $(BUILDDIR_unit) && ./build/tests
70373Sdefan@nginx.com	cd $(BUILDDIR_unit_debug) && ./build/tests
71373Sdefan@nginx.comendif
72373Sdefan@nginx.com	touch $@
73373Sdefan@nginx.com
74373Sdefan@nginx.combuild-indep:
75373Sdefan@nginx.com	dh_testdir
76373Sdefan@nginx.com	touch $@
77373Sdefan@nginx.com
78373Sdefan@nginx.combuild-arch: build-arch.unit build-arch.unit_debug
79373Sdefan@nginx.com	dh_testdir
80373Sdefan@nginx.com	touch $@
81373Sdefan@nginx.com
82373Sdefan@nginx.combuild: build-arch build-indep
83373Sdefan@nginx.com	dh_testdir
84373Sdefan@nginx.com	touch $@
85373Sdefan@nginx.com
86373Sdefan@nginx.comclean:
87373Sdefan@nginx.com	dh_testdir
88373Sdefan@nginx.com	dh_testroot
89373Sdefan@nginx.com	dh_clean
90373Sdefan@nginx.com	find $(CURDIR) -maxdepth 1 -size 0 -delete
91957Sdefan@nginx.com	rm -rf $(BUILDDIR_unit) $(BUILDDIR_unit_debug)
92373Sdefan@nginx.com
93373Sdefan@nginx.cominstall: build do.tests
94373Sdefan@nginx.com	dh_testdir
95373Sdefan@nginx.com	dh_testroot
96373Sdefan@nginx.com	dh_prep
97373Sdefan@nginx.com	dh_installdirs
98373Sdefan@nginx.com	dh_installinit
99373Sdefan@nginx.com	dh_installlogrotate
100373Sdefan@nginx.com	cd $(BUILDDIR_unit) && DESTDIR=$(INSTALLDIR) make install
101815Sdefan@nginx.com	cd $(BUILDDIR_unit) && DESTDIR=$(INSTALLDIR_dev) make libunit-install
102373Sdefan@nginx.com	install -m 755 $(BUILDDIR_unit_debug)/build/unitd $(INSTALLDIR)/usr/sbin/unitd-debug
103815Sdefan@nginx.com	install -m 644 $(BUILDDIR_unit_debug)/build/libunit.a $(INSTALLDIR_dev)/usr/lib/$(DEB_HOST_MULTIARCH)/libunit-debug.a
104373Sdefan@nginx.com	mkdir -p $(INSTALLDIR)/usr/share/doc/unit/examples
105373Sdefan@nginx.com	install -m 644 debian/unit.example.config $(INSTALLDIR)/usr/share/doc/unit/examples/example.config
106373Sdefan@nginx.com	install -m 644 CHANGES $(INSTALLDIR)/usr/share/doc/unit/
107373Sdefan@nginx.com	install -m 644 README $(INSTALLDIR)/usr/share/doc/unit/
108373Sdefan@nginx.com
109373Sdefan@nginx.combinary-indep: build install
110373Sdefan@nginx.com	dh_testdir
111373Sdefan@nginx.com	dh_testroot
112373Sdefan@nginx.com	dh_installdocs
113373Sdefan@nginx.com	dh_installchangelogs
114373Sdefan@nginx.com	dh_link
115373Sdefan@nginx.com	dh_strip --dbg-package=unit-dbg
116373Sdefan@nginx.com	dh_shlibdeps
117373Sdefan@nginx.com	dh_compress
118373Sdefan@nginx.com	dh_fixperms
119373Sdefan@nginx.com	dh_installdeb
120373Sdefan@nginx.com	dh_perl
121373Sdefan@nginx.com	dh_gencontrol
122373Sdefan@nginx.com	dh_md5sums
123373Sdefan@nginx.com	dh_builddeb
124373Sdefan@nginx.com
125373Sdefan@nginx.combinary-arch: install
126373Sdefan@nginx.com
127373Sdefan@nginx.combinary: binary-indep binary-arch
128373Sdefan@nginx.com
129373Sdefan@nginx.com.PHONY: clean binary-indep binary-arch binary install build
130