summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 2e35a433ac2d61008698f3f0395088ae5342b6be (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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/usr/bin/make -f
#
# Based on the work by Marcus Brinkmann <brinkmd@debian.org>
# Rewritten by Guillem Jover <guillem@debian.org>
#

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

D := $(CURDIR)/debian/tmp
D_DBG := $(D)-dbg

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 -fno-strict-aliasing

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

ifneq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	CHECKS :=
else
	CHECKS := check-gnumach check-gnumach-dbg
endif

drivers := \
	--enable-sis900

include /usr/share/quilt/quilt.make

# To be run manually when packaging a new upstream version to update the
# autogenerated autoconf patch. Assumes the patch is the last one.
autoregen:
	quilt push -fa || true
	autoreconf -fi
	find -name autom4te.cache -o -name '*~' -o \
	     -name '*.rej' -o -name '*.orig' | xargs rm -rf
	quilt refresh -p ab
	quilt pop -a

configure: patch build/config.status
build/config.status:
	dh_testdir
	
	-mkdir build
	cd build && ../configure $(drivers) \
		CFLAGS="$(CFLAGS)" \
		--build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE) \
		--prefix=/usr \
		--exec-prefix=/

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

build:

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

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

check-gnumach: build-gnumach
	dh_testdir
	
	$(MAKE) -C build check

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

clean: unpatch
	dh_testdir
	
	rm -f machine
	rm -rf build build-dbg
	
	dh_clean

install: build-gnumach build-gnumach-dbg $(CHECKS)
	dh_testdir
	dh_testroot
	dh_clean -a -k
	-rm -rf $(D_DBG)
	dh_installdirs -a
	
	$(MAKE) -C build install \
		DESTDIR=$(D)
	
	$(MAKE) -C build-dbg install-exec \
		DESTDIR=$(D_DBG) \
	
	mv $(D_DBG)/boot/gnumach $(D_DBG)/boot/gnumach-dbg

binary: binary-indep binary-arch

binary-indep:

binary-arch: install
	dh_testdir
	dh_testroot
	
	dh_install -a -N$(pkg_dbg) --sourcedir=$(D)
	dh_install -p$(pkg_dbg) --sourcedir=$(D_DBG)
	
	dh_installdocs -a
	dh_installchangelogs -a -k ChangeLog
#	dh_installinfo -a
	
	dh_link -a
	dh_strip -a -N$(pkg_dbg)
	dh_compress -p$(pkg) -p$(pkg_udeb) -A 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 build-gnumach build-gnumach-dbg clean configure configure-dbg
.PHONY: install-gnumach install-gnumach-dbg binary binary-indep binary-arch