summaryrefslogtreecommitdiff
path: root/mdb/debian/rules
blob: f35506379b9f413244aea362209652fb295f3d25 (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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export DH_VERBOSE = 1

cmd := \
	mdb \

man := \
	usr/src/man/man1/adb.1 \
	usr/src/man/man1/kmdb.1 \
	usr/src/man/man1/mdb.1 \
	usr/src/man/man7d/kmdb.7d

ifeq (amd64,$(DEB_HOST_ARCH_CPU))
dirs = usr/src/cmd/mdb/intel/amd64
endif

COMMON_MODULES_PROC = \
dof \
libavl \
libc \
libcmdutils \
libnvpair \
libproc \
libsysevent \
libtopo \
libumem \
libuutil \
libzpool \
mdb_ds \
mdb_test \
svc.configd \
svc.startd \

COMMON_MODULES_KVM = \
arp \
cpc \
crypto	\
dtrace	\
emlxs \
fcip \
fcp \
fctl \
genunix \
hook \
neti \
idm \
ip \
ipc \
ipp \
krtld \
lofs \
logindmux \
mac \
md \
mpt_sas \
mr_sas \
nca \
nsctl \
nsmb \
pmcs \
ptm \
qlc \
random \
rdc \
s1394 \
scsi_vhci \
sctp \
sd \
sdbc \
smbfs \
smbsrv \
sockfs \
specfs \
sppp \
srpt \
stmf \
stmf_sbd \
sv \
ufs \
usba \
zfs \


unpack: unpack-stamp
unpack-stamp:
	dh_testdir
	dh_illumos_gate --build  -- \
		usr/src/common/ctf \
		usr/src/uts/intel/promif \
		usr/src/common/util \
		$(cmd:%=usr/src/cmd/%) \
		$(man) \
		usr/src/uts/common/sys/kmdb.h \
		usr/src/uts/common/kmdb

	# Buggy and unused:
	echo > usr/src/Makefile.msg.targ

	echo 'export YACC=/usr/bin/sgs-yacc' >> usr/env.sh
	echo 'export LEX=/usr/bin/sgs-lex' >> usr/env.sh

	# GCC still does not support -msave-args, and I'm not sure
	# if this option is good at all:
	echo 'export SAVEARGS=' >> usr/env.sh

	echo 'export COMMON_MODULES_PROC="$(COMMON_MODULES_PROC)"' >> usr/env.sh
	echo 'export COMMON_MODULES_KVM="$(COMMON_MODULES_KVM)"' >> usr/env.sh

	touch $@

patch: patch-stamp
patch-stamp: unpack-stamp
	dh_testdir
	[ ! -f debian/patches/series ] || QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2
	touch $@

unpatch:
	dh_testdir
	[ ! -f debian/patches/series ] || QUILT_PATCHES=debian/patches quilt pop -a -f || test $$? = 2
	rm -f patch-stamp

dirs-stamp: unpack-stamp
	. usr/env.sh; mkdir -p \
		debian/tmp/usr/bin \
		debian/tmp/usr/include/sys \
		debian/tmp$$DEB_LIBDIR_32 \
		debian/tmp$$DEB_LIBDIR_64 \
		debian/tmp$$DEB_USRLIBDIR_32 \
		debian/tmp$$DEB_USRLIBDIR_64

ifeq (amd64,$(DEB_HOST_ARCH_CPU))
	mkdir -p debian/tmp/usr/bin/amd64
	ln -sf amd64/mdb debian/tmp/usr/bin/mdb
endif
	touch $@

headers-stamp: patch-stamp dirs-stamp
	dh_illumos_make  -m sunmake usr/src/cmd/mdb/ -t install_h
	cp -f usr/src/uts/common/sys/kmdb.h debian/tmp/usr/include/sys/
	# GCC takes ./usr/src/cmd/mdb/common/modules/genunix/thread.h by accident,
	# we need "real" thread.h
	ln -sf /usr/include/thread.h debian/tmp/usr/include/thread.h
	touch $@

install: install-stamp

install-stamp: build-stamp
	touch $@

build build-arch build-indep: build-stamp
build-stamp: dirs-stamp patch-stamp headers-stamp kmdb
	dh_illumos_make -m sunmake --native \
		usr/src/cmd/mdb/tools
	dh_illumos_make -m sunmake \
		$(dirs)
	touch $@

kmdb: kdrv.o
	sunld -r -dy -Nmisc/kmdbmod -o $@ $<

# XXX yes, -mcmodel=kernel is for amd64 only
# Dyson runs on amd64 only for a while
kdrv.o: usr/src/uts/common/kmdb/kdrv.c
	$(CC) -O2 -D_KERNEL -I usr/src/uts/common -fno-builtin -mcmodel=kernel -c $< -o $@

binary binary-arch binary-indep: binary-stamp
binary-stamp: install-stamp
	dh_testdir
	dh_testroot
	dh_installdirs
	dh_install -p mdb usr/bin/mdb
ifeq (illumos-amd64,$(DEB_HOST_ARCH))
	dh_install -p mdb usr/bin/amd64/mdb
endif
	dh_install --list-missing
	dh_installman
	dh_installdocs
	dh_installexamples
	dh_installchangelogs
	dh_bash-completion
	dh_link
	dh_compress -X /examples/
	dh_fixperms
	dh_installdeb
	dh_shlibdeps -X kernel
	dh_strip -X kernel
	dh_gencontrol
	dh_md5sums
	dh_builddeb
	touch $@

clean: unpatch
	dh_testdir
	dh_testroot
	rm -rf usr .pc
	rm -f kmdb kdrv.o
	dh_clean