summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 770984edbab555b6f24b0159828c72752adc7785 (plain)
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
123
124
125
126
#!/usr/bin/make -f
#
# Based on the work by Marcus Brinkmann <brinkmd@debian.org>
# Rewritten by Guillem Jover <guillem@debian.org>
#

pkg := gnumach
pkg_dbg := gnumach-dbg
pkg_dev := gnumach-dev

DEB_BUILD_GNU_TYPE := $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)

CFLAGS = -Wall -g -pipe

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

include debian/rules.options

patch::
	# XXX: Should be removed once the autoconf patch is in upstream
	test -f i386/linux/configure.ac || \
	  cp i386/linux/Drivers.in i386/linux/configure.ac

include debian/patch.mk

configure: patch stamp-configure
stamp-configure:
	dh_testdir
	-mkdir build
	cd build && ../configure $(drivers) \
		CFLAGS="$(CFLAGS)" \
		--build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
	touch stamp-configure

configure-dbg: patch stamp-configure-dbg
stamp-configure-dbg:
	dh_testdir
	-mkdir build-dbg
	cd build-dbg && ../configure --enable-kdb $(drivers) \
		CFLAGS="$(CFLAGS)" \
		--build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
	touch stamp-configure-dbg

all build:

build-gnumach: configure
	dh_testdir
	$(MAKE) -C build
	$(MAKE) -C build/doc

build-gnumach-dbg: configure-dbg
	dh_testdir
	$(MAKE) -C build-dbg

clean::
	dh_testdir
	-rm -f machine stamp-configure
	-rm -rf build build-dbg
	-rm -f core `find . \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
                -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
                -o -name '.*.rej' -o -name '.SUMS' -o -size 0 \) -print`
	# XXX: Should be removed once the autoconf patch is in upstream
	rm -f i386/linux/configure.ac
	
	dh_clean

install-gnumach: build-gnumach
	dh_testdir
	dh_testroot
	dh_clean -p$(pkg) -k
	dh_installdirs -p$(pkg)
	
	$(MAKE) -C build install-kernel \
		prefix=$(CURDIR)/debian/$(pkg)/usr \
		exec_prefix=$(CURDIR)/debian/$(pkg)

install-gnumach-dev: build-gnumach
	dh_testdir
	dh_testroot
	dh_clean -p$(pkg_dev) -k
	dh_installdirs -p$(pkg_dev)
	
	$(MAKE) -C build install-headers \
		prefix=$(CURDIR)/debian/$(pkg_dev)/usr \
		exec_prefix=$(CURDIR)/debian/$(pkg_dev) \
		includedir=\$${prefix}/include

install-gnumach-dbg: build-gnumach-dbg
	dh_testdir
	dh_testroot
	dh_clean -p$(pkg_dbg) -k
	dh_installdirs -p$(pkg_dbg)
	
	$(MAKE) -C build-dbg install-kernel \
		prefix=$(CURDIR)/debian/$(pkg_dbg)/usr \
		exec_prefix=$(CURDIR)/debian/$(pkg_dbg)
	mv debian/$(pkg_dbg)/boot/gnumach debian/$(pkg_dbg)/boot/gnumach-dbg

binary: binary-indep binary-arch

binary-indep:

binary-arch: install-gnumach install-gnumach-dev install-gnumach-dbg
	dh_testdir
	dh_testroot
	dh_installdocs -a
	dh_installchangelogs -a -k ChangeLog
	dh_installinfo -a
	dh_link -a
	dh_strip -a -N$(pkg_dbg)
	dh_compress -p$(pkg) boot/gnumach
	dh_compress -p$(pkg_dbg) boot/gnumach-dbg
	dh_compress -p$(pkg_dev)
	dh_fixperms -a
	dh_installdeb -a
	dh_gencontrol -a
	dh_md5sums -a
	dh_builddeb -a

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