Makefrag (5669B)
1 ifeq ($(OS),linux) 2 PLAN9VX=1 3 PLAN9GUI=x11 4 PLAN9AUDIO=unix 5 PLAN9PCAP=nopcap 6 PLAN9TAP=ethertap 7 endif 8 9 ifeq ($(OS),darwin) 10 PLAN9VX=1 11 PLAN9GUI=osx 12 PLAN9AUDIO=none 13 PLAN9PCAP=nopcap 14 PLAN9TAP=ethertap 15 endif 16 17 ifeq ($(OS),freebsd) 18 PLAN9VX=1 19 PLAN9GUI=x11 20 PLAN9AUDIO=unix 21 PLAN9PCAP=nopcap 22 PLAN9TAP=notap 23 endif 24 25 # Boot files 26 # Do not remove: 27 # - boot, needed to boot 28 # - factotum, used by libauth 29 PLAN9BOOT=\ 30 9660srv \ 31 boot \ 32 bzfs \ 33 factotum \ 34 fossil \ 35 kfs \ 36 rootfs \ 37 venti \ 38 39 # Default argument to boot 40 PLAN9BOOTARG=local!/boot/rootfs 41 42 # If you don't have/want X11 43 #PLAN9GUI=nogui 44 45 # Virtual ethernet devices 46 #PLAN9PCAP=etherpcap 47 #PLAN9PCAP=nopcap 48 #PLAN9TAP=ethertap 49 #PLAN9TAP=notap 50 51 ifeq ($(PLAN9VX),1) 52 53 PLAN9SCRIPTS = \ 54 $(addprefix $(BINDIR)/, \ 55 9vxc \ 56 9vxp \ 57 acmevx \ 58 rcvx \ 59 tap \ 60 ) 61 62 all: 9vx/9vx 63 9vx/install: $(BINDIR)/9vx $(PLAN9SCRIPTS) 64 65 $(BINDIR)/9vx: 9vx/9vx 66 $(INSTALL) $< $@ 67 68 $(BINDIR)/%: ../bin/% 69 $(INSTALL) $< $@ 70 71 PLAN9_BOOT_OBJS = $(PLAN9BOOT:%=9vx/%.o) 72 73 PLAN9_OBJS = \ 74 $(addprefix 9vx/, \ 75 bootinit.o \ 76 conf.o \ 77 devaudio.o \ 78 devaudio-$(PLAN9AUDIO).o \ 79 devfs-posix.o \ 80 devmntloop.o \ 81 devmouse.o \ 82 devram.o \ 83 devtab.o \ 84 kprocdev.o \ 85 label.o \ 86 load.o \ 87 main.o \ 88 mmu.o \ 89 sched.o \ 90 sdloop.o \ 91 stub.o \ 92 term.o \ 93 time.o \ 94 trap.o \ 95 tty.o \ 96 vx32.o \ 97 ) 98 99 ifeq ($(OS),darwin) 100 PLAN9_OBJS := $(PLAN9_OBJS) 9vx/osx/signal.o 9vx/osx/cmpswap.o 101 endif 102 103 # While we could do an || here on the os, leave this: linux 104 # or freebsd may later differ in what they do. 105 ifeq ($(OS),linux) 106 PLAN9_OBJS := $(PLAN9_OBJS) 9vx/gccmagic/cmpswap.o 107 endif 108 109 ifeq ($(OS),freebsd) 110 PLAN9_OBJS := $(PLAN9_OBJS) 9vx/gccmagic/cmpswap.o 111 endif 112 113 PLAN9_A_OBJS = \ 114 $(addprefix 9vx/a/, \ 115 allocb.o \ 116 auth.o \ 117 chan.o \ 118 classmask.o \ 119 cleanname.o \ 120 convD2M.o \ 121 convM2D.o \ 122 convS2M.o \ 123 convM2S.o \ 124 dev.o \ 125 devcap.o \ 126 devcons.o \ 127 devdraw.o \ 128 devdup.o \ 129 devenv.o \ 130 devmnt.o \ 131 devproc.o \ 132 devpipe.o \ 133 devroot.o \ 134 devsd.o \ 135 devsrv.o \ 136 devssl.o \ 137 devtls.o \ 138 eipfmt.o \ 139 encodefmt.o \ 140 fault.o \ 141 fcallfmt.o \ 142 fmt.o \ 143 getfields.o \ 144 ipaux.o \ 145 latin1.o \ 146 page.o \ 147 parse.o \ 148 parseip.o \ 149 part.o \ 150 pgrp.o \ 151 print.o \ 152 proc.o \ 153 qio.o \ 154 qlock.o \ 155 sdscsi.o \ 156 segment.o \ 157 strecpy.o \ 158 swap.o \ 159 sysfile.o \ 160 sysproc.o \ 161 thwack.o \ 162 tokenize.o \ 163 u16.o \ 164 u32.o \ 165 u64.o \ 166 unthwack.o \ 167 utf.o \ 168 ) 169 170 PLAN9_IP_OBJS = \ 171 $(addprefix 9vx/,\ 172 devip.o \ 173 devip-posix.o \ 174 $(PLAN9PCAP).o \ 175 $(PLAN9TAP).o \ 176 vether.o \ 177 ) \ 178 $(addprefix 9vx/a/,\ 179 devaoe.o \ 180 devether.o \ 181 netif.o \ 182 sdaoe.o \ 183 ) \ 184 $(addprefix 9vx/a/ip/,\ 185 arp.o \ 186 chandial.o \ 187 devip.o \ 188 esp.o \ 189 ethermedium.o \ 190 gre.o \ 191 icmp.o \ 192 icmp6.o \ 193 il.o \ 194 inferno.o \ 195 ip.o \ 196 ipaux.o \ 197 ipifc.o \ 198 ipmux.o \ 199 iproute.o \ 200 ipv6.o \ 201 loopbackmedium.o \ 202 netdevmedium.o \ 203 netlog.o \ 204 nullmedium.o \ 205 pktmedium.o \ 206 ptclbsum.o \ 207 tcp.o \ 208 udp.o \ 209 ) 210 ifneq ($(PLAN9PCAP), nopcap) 211 PLAN9_IP_LIBS = -lpcap 212 else 213 PLAN9_IP_LIBS = 214 endif 215 216 PLAN9_nogui_OBJS = \ 217 $(addprefix 9vx/,\ 218 nogui.o \ 219 ) 220 221 PLAN9_nogui_LIBS = 222 223 PLAN9_x11_OBJS = \ 224 $(addprefix 9vx/x11/, \ 225 x11-draw.o \ 226 x11-init.o \ 227 x11-itrans.o \ 228 x11-kernel.o \ 229 x11-keysym2rune.o \ 230 ) 231 PLAN9_x11_LIBS = -L/usr/X11R6/lib -L/usr/local/lib -lX11 232 233 PLAN9_osx_OBJS =\ 234 $(addprefix 9vx/osx/, \ 235 screen.o \ 236 draw.o \ 237 ) 238 PLAN9_osx_LIBS = -ggdb -framework Carbon -framework QuickTime 239 240 241 PLAN9_GUI_OBJS = $(PLAN9_$(PLAN9GUI)_OBJS) 242 PLAN9_GUI_LIBS = $(PLAN9_$(PLAN9GUI)_LIBS) 243 244 PLAN9_DEPS = \ 245 $(PLAN9_OBJS) \ 246 $(PLAN9_A_OBJS) \ 247 $(PLAN9_BOOT_OBJS) \ 248 $(PLAN9_IP_OBJS) \ 249 $(PLAN9_GUI_OBJS) \ 250 9vx/libsec/libsec.a \ 251 9vx/libmemlayer/libmemlayer.a \ 252 9vx/libmemdraw/libmemdraw.a \ 253 9vx/libdraw/libdraw.a \ 254 libvx32/libvx32.a \ 255 256 9vx/9vx: $(PLAN9_DEPS) 257 $(HOST_CC) -o $@ $(HOST_LDFLAGS) $(PLAN9_DEPS) $(PLAN9_GUI_LIBS) $(PLAN9_IP_LIBS) -lpthread 258 259 9vx/a/%.o: 9vx/a/%.c 260 $(HOST_CC) $(HOST_CFLAGS) -I. -I9vx -I9vx/a -Wall -Wno-missing-braces -c -o $@ $< 261 262 9vx/x11/%.o: 9vx/x11/%.c 263 $(HOST_CC) $(HOST_CFLAGS) -I. -I9vx -I9vx/a -I/usr/X11R6/include -I/usr/local/include -Wall -Wno-missing-braces -c -o $@ $< 264 265 9vx/osx/%.o: 9vx/osx/%.c 266 $(HOST_CC) $(HOST_CFLAGS) -I. -I9vx -I9vx/a -Wall -Wno-missing-braces -c -o $@ $< 267 268 9vx/%.o: 9vx/%.c 269 $(HOST_CC) $(HOST_CFLAGS) -D "BOOTARG=\"$(PLAN9BOOTARG)\"" -I. -I9vx -I9vx/a -Wall -Wno-missing-braces -c -o $@ $< 270 271 9vx/%.o: 9vx/%.S 272 $(HOST_CC) $(HOST_CFLAGS) -I. -I9vx -I9vx/a -Wall -Wno-missing-braces -c -o $@ $< 273 274 9vx/bootinit.c: 9vx/mkbootinitc 275 9vx/mkbootinitc $(PLAN9BOOT) >$@ 276 277 9vx/data2s: 9vx/data2s.c 278 $(HOST_CC) -o $@ $< 279 280 # We need the sed command to have a correct variable name for 9660srv 281 9vx/%.S: 9vx/%.9 9vx/data2s 282 ./9vx/data2s `echo $* | sed 's/^[0-9]/_&/'` < $< >$@_ && mv $@_ $@ 283 284 9vx/%.S: 9vx/%.bz2 9vx/data2s 285 ./9vx/data2s `echo $* | sed 's/^[0-9]/_&/'` < $< >$@_ && mv $@_ $@ 286 287 9vx/a/errstr.h: 9vx/a/error.h 288 sed 's/extern //; s!;.*/\* ! = "!; s! \*\/!";!' 9vx/a/error.h >9vx/a/errstr.h 289 290 9vx/a/proc.o: 9vx/a/errstr.h 291 292 9vx/stub.o: 9vx/kerndate.h 293 294 9vx/kerndate.h: 295 echo 'ulong kerndate =' `date +%s` ';' >9vx/kerndate.h 296 297 .PHONY: 9vx/kerndate.h 298 299 9vx/AUTOGEN: 9vx/a/AUTOGEN 9vx/9vx 300 301 .PHONY: 9vx/AUTOGEN 302 303 9vx/a/AUTOGEN: 304 cd 9vx/a/; ./AUTOGEN -r $(ROOT) 305 306 .PHONY: 9vx/a/AUTOGEN 307 308 CLEAN_FILES += \ 309 9vx/*.d \ 310 9vx/*.o \ 311 9vx/a/*.d \ 312 9vx/a/*.o \ 313 9vx/x11/*.d \ 314 9vx/x11/*.o \ 315 9vx/kerndate.h \ 316 9vx/a/errstr.h \ 317 9vx/9vx \ 318 9vx/bootinit.c \ 319 9vx/data2s \ 320 9vx/9660srv.S \ 321 9vx/boot.S \ 322 9vx/bzfs.S \ 323 9vx/factotum.S \ 324 9vx/fossil.S \ 325 9vx/kfs.S \ 326 9vx/rootfs.S \ 327 9vx/venti.S 328 329 include 9vx/libdraw/Makefrag 330 include 9vx/libmemlayer/Makefrag 331 include 9vx/libmemdraw/Makefrag 332 include 9vx/libsec/Makefrag 333 334 endif