1 # Makefile for NetBSD for the mac 2 # Derived from makefile for hp300 from NetBSD 3 # 4 # This makefile is constructed from a machine description: 5 # config machineid 6 # Most changes should be made in the machine description 7 # /sys/conf/``machineid'' 8 # after which you should do 9 # config machineid 10 # Machine generic makefile changes should be made in 11 # /sys/conf/Makefile.``machinetype'' 12 # after which config should be rerun for all machines of that type. 13 # 14 # N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE 15 # IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING 16 # 17 # -DTRACE compile in kernel tracing hooks 18 # -DQUOTA compile in file system quotas 19 20 21 # DEBUG is set to -g by config if debugging is requested (config -g). 22 # PROF is set to -pg by config if profiling is requested (config -p). 23 AS= /usr/bin/as ${DEBUG} 24 CC= /usr/bin/cc ${DEBUG} 25 LOCAL_CC=${CC} 26 CPP= /usr/bin/cpp 27 LD= /usr/bin/ld 28 TOUCH= touch -f -c 29 GPROF.EX=/usr/src/lib/libc/csu.mac68k/gmon.ex 30 31 # source tree is located via $S relative to the compilation directory 32 S= ../../../.. 33 MAC68K= ../.. 34 .include "$S/lib/libkern/Makefile.inc" 35 .ifndef PROF 36 LIBKERN=${KERNLIB} 37 .else 38 LIBKERN=${KERNLIB_PROF} 39 .endif 40 41 INCLUDES= -nostdinc -I. -I$S/arch -I$S -I$S/sys 42 COPTS= ${INCLUDES} ${IDENT} -DKERNEL -DREFBIT -Dmac68k 43 CFLAGS= -O ${COPTS} 44 45 # compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP} 46 # where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix, 47 # capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file 48 # is marked as config-dependent. 49 50 NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $< 51 NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 52 53 DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $< 54 DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 55 56 PROFILE_C= ${CC} -S -c ${COPTS} $<; \ 57 ex - $*.s < ${GPROF.EX}; \ 58 ${AS} -o $@ $*.s; \ 59 rm -f $*.s 60 61 # This really bites for now, but we need to run assembly through sed 62 # until the real problem (cpp, I think) is fixed. 63 NORMAL_S= ${CPP} ${COPTS} $< | ${AS} -o $@ 64 NORMAL_S_C= ${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@ 65 66 %OBJS 67 68 %CFILES 69 70 # load lines for config "xxx" will be emitted as: 71 # xxx: ${SYSTEM_DEP} swapxxx.o 72 # ${SYSTEM_LD_HEAD} 73 # ${SYSTEM_LD} swapxxx.o 74 # ${SYSTEM_LD_TAIL} 75 SYSTEM_OBJ= locore.o vnode_if.o ${OBJS} param.o ioconf.o conf.o ${LIBKERN} 76 SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 77 SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ 78 SYSTEM_LD= @strip=-x; [ X${DEBUG} = X-g ] && strip=-X || true; \ 79 ${LD} $$strip -n -T 0 -e start -o $@ \ 80 ${SYSTEM_OBJ} vers.o ${LIBKERN} 81 #SYSTEM_LD_TAIL= @echo rearranging symbols;\ 82 # symorder symbols.sort $@;\ 83 SYSTEM_LD_TAIL= @chmod 755 $@; size $@; \ 84 [ X${DEBUG} = X-g ] && { \ 85 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 86 echo strip -d $@; strip -d $@; } || true 87 88 %LOAD 89 90 newvers: 91 sh $S/conf/newvers.sh "${KERN_IDENT}" ${IDENT} 92 ${CC} ${CFLAGS} -c vers.c 93 94 clean: 95 rm -f eddep *vmunix tags *.o locore.i [a-z]*.s \ 96 Errs errs linterrs makelinks 97 98 lint: /tmp param.c 99 @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \ 100 ${MAC68K}/mac68k/Locore.c ${CFILES} \ 101 ioconf.c param.c| \ 102 grep -v 'struct/union .* never defined' | \ 103 grep -v 'possible pointer alignment problem' 104 105 symbols.sort: ${MAC68K}/mac68k/symbols.raw 106 grep -v '^#' ${MAC68K}/mac68k/symbols.raw \ 107 | sed 's/^ //' | sort -u > symbols.sort 108 109 locore.o: assym.s ${MAC68K}/mac68k/vectors.s ${MAC68K}/mac68k/locore.s 110 locore.o: ${MAC68K}/include/trap.h ${MAC68K}/include/psl.h ${MAC68K}/include/pte.h 111 locore.o: ${MAC68K}/include/cpu.h 112 ${CPP} -DLOCORE ${COPTS} ${MAC68K}/mac68k/locore.s | ${AS} -o locore.o 113 114 # the following is necessary because autoconf.o depends on #if GENERIC 115 autoconf.o: Makefile 116 117 # the following are necessary because the files depend on the types of 118 # hp cpu's included in the system configuration 119 clock.o machdep.o autoconf.o conf.o: Makefile 120 121 # depend on network configuration 122 af.o uipc_proto.o locore.o: Makefile 123 124 # depend on maxusers 125 assym.s: Makefile 126 127 assym.s: genassym 128 ./genassym >assym.s 129 130 genassym: 131 ${LOCAL_CC} ${INCLUDES} ${IDENT} -DKERNEL ${PARAM} -o genassym \ 132 ${MAC68K}/mac68k/genassym.c 133 134 depend: assym.s param.c vnode_if.h 135 mkdep ${COPTS} ${CFILES} ioconf.c param.c 136 mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${MAC68K}/mac68k/genassym.c 137 138 links: 139 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 140 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 141 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 142 sort -u | comm -23 - dontlink | \ 143 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 144 sh makelinks && rm -f dontlink 145 146 tags: 147 @echo "see $S/kern/Makefile for tags" 148 149 ioconf.o: ioconf.c 150 ${CC} -c ${CFLAGS} ioconf.c 151 152 conf.o: ${MAC68K}/mac68k/conf.c 153 ${NORMAL_C} 154 155 param.c: $S/conf/param.c 156 rm -f param.c 157 cp $S/conf/param.c . 158 159 param.o: param.c Makefile 160 ${CC} -c ${CFLAGS} ${PARAM} -DHZ=60 param.c 161 162 vnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 163 AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 164 165 %RULES 166