File: rules

package info (click to toggle)
bit-babbler 0.8
  • links: PTS
  • area: main
  • in suites: buster
  • size: 1,900 kB
  • sloc: cpp: 10,297; sh: 4,301; perl: 1,017; ansic: 1,013; makefile: 84
file content (122 lines) | stat: -rwxr-xr-x 3,063 bytes parent folder | download
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
113
114
115
116
117
118
119
120
121
122
#!/usr/bin/make -f
#
# Copyright 2003 - 2018 Ron Lee.

SHELL = /bin/bash

export DH_OPTIONS

NUM_CPUS = $(shell getconf _NPROCESSORS_ONLN 2>/dev/null)
PARALLEL = $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NJOBS    = -j$(or $(PARALLEL),$(NUM_CPUS),1)

DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_HOST_ARCH      ?= $(shell dpkg-architecture -qDEB_HOST_ARCH)


# We don't need this one here, -Wformat=2 is already part of our standard set.
#HARD_CFLAGS  = -Wformat=2
HARD_CPPFLAGS = -D_FORTIFY_SOURCE=2
HARD_LDFLAGS  = -Wl,-z,now

ifneq (,$(filter-out alpha hppa arm, $(DEB_HOST_ARCH)))
	HARD_CFLAGS += -fstack-protector --param ssp-buffer-size=4
endif
ifneq (,$(filter-out ia64 hppa avr32, $(DEB_HOST_ARCH)))
	HARD_LDFLAGS += -Wl,-z,relro
endif



build_arch_stamps = build-shared-stamp
install_arch_stamps = install-stamp

objdir_shared = objs_sh

all_stamps = $(build_arch_stamps) $(install_arch_stamps)

config_cache = ../config_deb.cache



clean:
	dh_testdir
	$(RM) -r $(objdir_shared)
	$(RM) $(all_stamps)
	dh_clean


$(objdir_shared)/config.status: configure
	dh_testdir

	mkdir $(objdir_shared)
	cd $(objdir_shared) && ../configure --host=$(DEB_HOST_GNU_TYPE)      \
					    --build=$(DEB_BUILD_GNU_TYPE)    \
					    --cache-file=$(config_cache)     \
					    --prefix=/usr                    \
					    $(EXTRA_CONFIG_OPTS)             \
					    EXTRACPPFLAGS="$(HARD_CPPFLAGS)" \
					    EXTRACFLAGS="$(HARD_CFLAGS)"     \
					    EXTRACXXFLAGS="$(HARD_CFLAGS)"   \
					    EXTRALDFLAGS="$(HARD_LDFLAGS)"


build: build-arch build-indep
build-arch: $(build_arch_stamps)
build-indep:

build-shared-stamp: $(objdir_shared)/config.status
	dh_testdir
	$(MAKE) $(NJOBS) -C $(objdir_shared)
	touch $@


install: install-arch install-indep
install-arch: build-arch $(install_arch_stamps)
install-indep:


install-stamp: DH_OPTIONS = -pbit-babbler
install-stamp: build-shared-stamp
	dh_testdir
	dh_testroot
	dh_prep
	$(MAKE) -C $(objdir_shared) install DESTDIR=$(CURDIR)/debian/bit-babbler
	dh_install debian/bit-babbler-sysctl.conf etc/sysctl.d
	dh_systemd_enable seedd.service
	dh_systemd_enable --no-enable seedd-wait.service
	dh_installinit --restart-after-upgrade --name seedd
	dh_systemd_start --restart-after-upgrade seedd.service
	dh_systemd_start --no-start seedd-wait.service
	dh_installudev
	dh_installexamples doc/examples/* libvirt/qemu-hook
	touch $@


binary: binary-arch

binary-common:
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_strip --dbg-package=bit-babbler-dbg
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary-arch: build-arch install-arch
	$(MAKE) -f debian/rules DH_OPTIONS="-a" binary-common

binary-indep: build-indep install-indep
	$(MAKE) -f debian/rules DH_OPTIONS="-i" binary-common


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