-
Notifications
You must be signed in to change notification settings - Fork 20
/
Makefrag
executable file
·339 lines (291 loc) · 5.68 KB
/
Makefrag
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
ifeq ($(OS),linux)
PLAN9VX=1
PLAN9GUI=x11
PLAN9AUDIO=unix
PLAN9PCAP=nopcap
PLAN9TAP=ethertap
endif
ifeq ($(OS),darwin)
PLAN9VX=1
PLAN9GUI=osx
PLAN9AUDIO=none
PLAN9PCAP=nopcap
PLAN9TAP=ethertap
endif
ifeq ($(OS),freebsd)
PLAN9VX=1
PLAN9GUI=x11
PLAN9AUDIO=unix
PLAN9PCAP=nopcap
PLAN9TAP=notap
endif
# Boot files
# Do not remove:
# - boot, needed to boot
# - factotum, used by libauth
PLAN9BOOT=\
9660srv \
boot \
bzfs \
factotum \
fossil \
kfs \
rootfs \
venti \
# Default argument to boot
PLAN9BOOTARG=local!/boot/rootfs
# If you don't have/want X11
#PLAN9GUI=nogui
# Virtual ethernet devices
#PLAN9PCAP=etherpcap
#PLAN9PCAP=nopcap
#PLAN9TAP=ethertap
#PLAN9TAP=notap
ifeq ($(PLAN9VX),1)
PLAN9SCRIPTS = \
$(addprefix $(BINDIR)/, \
9vxc \
9vxp \
acmevx \
rcvx \
tap \
)
all: 9vx/9vx
9vx/install: $(BINDIR)/9vx $(PLAN9SCRIPTS)
$(BINDIR)/9vx: 9vx/9vx
$(INSTALL) $< $@
$(BINDIR)/%: ../bin/%
$(INSTALL) $< $@
PLAN9_BOOT_OBJS = $(PLAN9BOOT:%=9vx/%.o)
PLAN9_OBJS = \
$(addprefix 9vx/, \
bootinit.o \
conf.o \
devaudio.o \
devaudio-$(PLAN9AUDIO).o \
devfs-posix.o \
devmntloop.o \
devmouse.o \
devram.o \
devtab.o \
kprocdev.o \
label.o \
load.o \
main.o \
mmu.o \
sched.o \
sdloop.o \
stub.o \
term.o \
time.o \
trap.o \
tty.o \
vx32.o \
)
ifeq ($(OS),darwin)
PLAN9_OBJS := $(PLAN9_OBJS) 9vx/osx/signal.o 9vx/osx/cmpswap.o
endif
# While we could do an || here on the os, leave this: linux
# or freebsd may later differ in what they do.
ifeq ($(OS),linux)
PLAN9_OBJS := $(PLAN9_OBJS) 9vx/gccmagic/cmpswap.o
endif
ifeq ($(OS),freebsd)
PLAN9_OBJS := $(PLAN9_OBJS) 9vx/gccmagic/cmpswap.o
endif
PLAN9_A_OBJS = \
$(addprefix 9vx/a/, \
allocb.o \
auth.o \
chan.o \
classmask.o \
cleanname.o \
convD2M.o \
convM2D.o \
convS2M.o \
convM2S.o \
dev.o \
devcap.o \
devcons.o \
devdraw.o \
devdup.o \
devenv.o \
devmnt.o \
devproc.o \
devpipe.o \
devroot.o \
devsd.o \
devsrv.o \
devssl.o \
devtls.o \
eipfmt.o \
encodefmt.o \
fault.o \
fcallfmt.o \
fmt.o \
getfields.o \
ipaux.o \
latin1.o \
page.o \
parse.o \
parseip.o \
part.o \
pgrp.o \
print.o \
proc.o \
qio.o \
qlock.o \
sdscsi.o \
segment.o \
strecpy.o \
swap.o \
sysfile.o \
sysproc.o \
thwack.o \
tokenize.o \
u16.o \
u32.o \
u64.o \
unthwack.o \
utf.o \
)
PLAN9_IP_OBJS = \
$(addprefix 9vx/,\
devip.o \
devip-posix.o \
$(PLAN9PCAP).o \
$(PLAN9TAP).o \
vether.o \
) \
$(addprefix 9vx/a/,\
devaoe.o \
devether.o \
netif.o \
sdaoe.o \
) \
$(addprefix 9vx/a/ip/,\
arp.o \
chandial.o \
devip.o \
esp.o \
ethermedium.o \
gre.o \
icmp.o \
icmp6.o \
il.o \
inferno.o \
ip.o \
ipaux.o \
ipifc.o \
ipmux.o \
iproute.o \
ipv6.o \
loopbackmedium.o \
netdevmedium.o \
netlog.o \
nullmedium.o \
pktmedium.o \
ptclbsum.o \
tcp.o \
udp.o \
)
ifneq ($(PLAN9PCAP), nopcap)
PLAN9_IP_LIBS = -lpcap
else
PLAN9_IP_LIBS =
endif
PLAN9_nogui_OBJS = \
$(addprefix 9vx/,\
nogui.o \
)
PLAN9_nogui_LIBS =
PLAN9_x11_OBJS = \
$(addprefix 9vx/x11/, \
x11-draw.o \
x11-init.o \
x11-itrans.o \
x11-kernel.o \
x11-keysym2rune.o \
)
PLAN9_x11_LIBS = -L/usr/X11R6/lib -L/usr/local/lib -lX11
PLAN9_osx_OBJS =\
$(addprefix 9vx/osx/, \
screen.o \
draw.o \
)
PLAN9_osx_LIBS = -ggdb -framework Carbon -framework QuickTime
PLAN9_GUI_OBJS = $(PLAN9_$(PLAN9GUI)_OBJS)
PLAN9_GUI_LIBS = $(PLAN9_$(PLAN9GUI)_LIBS)
PLAN9_DEPS = \
$(PLAN9_OBJS) \
$(PLAN9_A_OBJS) \
$(PLAN9_BOOT_OBJS) \
$(PLAN9_IP_OBJS) \
$(PLAN9_GUI_OBJS) \
9vx/libsec/libsec.a \
9vx/libmemlayer/libmemlayer.a \
9vx/libmemdraw/libmemdraw.a \
9vx/libdraw/libdraw.a \
libvx32/libvx32.a \
9vx/9vx: $(PLAN9_DEPS)
$(HOST_CC) -o $@ $(HOST_LDFLAGS) $(PLAN9_DEPS) $(PLAN9_GUI_LIBS) $(PLAN9_IP_LIBS) -lpthread
9vx/a/%.o: 9vx/a/%.c
$(HOST_CC) $(HOST_CFLAGS) -I. -I9vx -I9vx/a -Wall -Wno-missing-braces -c -o $@ $<
9vx/a/ip/%.o: 9vx/a/ip/%.c
$(HOST_CC) $(HOST_CFLAGS) -I. -I9vx -I9vx/a -Wall -Wno-missing-braces -c -o $@ $<
9vx/x11/%.o: 9vx/x11/%.c
$(HOST_CC) $(HOST_CFLAGS) -I. -I9vx -I9vx/a -I/usr/X11R6/include -I/usr/local/include -Wall -Wno-missing-braces -c -o $@ $<
9vx/osx/%.o: 9vx/osx/%.c
$(HOST_CC) $(HOST_CFLAGS) -I. -I9vx -I9vx/a -Wall -Wno-missing-braces -c -o $@ $<
9vx/%.o: 9vx/%.c
$(HOST_CC) $(HOST_CFLAGS) -D "BOOTARG=\"$(PLAN9BOOTARG)\"" -I. -I9vx -I9vx/a -Wall -Wno-missing-braces -c -o $@ $<
9vx/%.o: 9vx/%.S
$(HOST_CC) $(HOST_CFLAGS) -I. -I9vx -I9vx/a -Wall -Wno-missing-braces -c -o $@ $<
9vx/bootinit.c: 9vx/mkbootinitc
9vx/mkbootinitc $(PLAN9BOOT) >$@
9vx/data2s: 9vx/data2s.c
$(HOST_CC) -o $@ $<
# We need the sed command to have a correct variable name for 9660srv
9vx/%.S: 9vx/%.9 9vx/data2s
./9vx/data2s `echo $* | sed 's/^[0-9]/_&/'` < $< >$@_ && mv $@_ $@
9vx/%.S: 9vx/%.bz2 9vx/data2s
./9vx/data2s `echo $* | sed 's/^[0-9]/_&/'` < $< >$@_ && mv $@_ $@
9vx/a/errstr.h: 9vx/a/error.h
sed 's/extern //; s!;.*/\* ! = "!; s! \*\/!";!' 9vx/a/error.h >9vx/a/errstr.h
9vx/a/proc.o: 9vx/a/errstr.h
9vx/stub.o: 9vx/kerndate.h
9vx/kerndate.h:
echo 'ulong kerndate =' `date +%s` ';' >9vx/kerndate.h
.PHONY: 9vx/kerndate.h
9vx/AUTOGEN: 9vx/a/AUTOGEN 9vx/9vx
.PHONY: 9vx/AUTOGEN
9vx/a/AUTOGEN:
cd 9vx/a/; ./AUTOGEN -r $(ROOT)
.PHONY: 9vx/a/AUTOGEN
CLEAN_FILES += \
9vx/*.d \
9vx/*.o \
9vx/a/*.d \
9vx/a/*.o \
9vx/a/ip/*.d \
9vx/a/ip/*.o \
9vx/x11/*.d \
9vx/x11/*.o \
9vx/kerndate.h \
9vx/a/errstr.h \
9vx/9vx \
9vx/bootinit.c \
9vx/data2s \
9vx/9660srv.S \
9vx/boot.S \
9vx/bzfs.S \
9vx/factotum.S \
9vx/fossil.S \
9vx/kfs.S \
9vx/rootfs.S \
9vx/venti.S
include 9vx/libdraw/Makefrag
include 9vx/libmemlayer/Makefrag
include 9vx/libmemdraw/Makefrag
include 9vx/libsec/Makefrag
endif