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 ### for the Motorola 68040 Floating Point Software Product 42 .include "$S/arch/m68k/fpsp/Makefile.inc" 43 44 INCLUDES= -I. -I$S/arch -I$S -I$S/sys 45 COPTS= ${INCLUDES} ${IDENT} -DKERNEL -DREFBIT -Dmac68k 46 CFLAGS= -O ${COPTS} 47 48 # compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP} 49 # where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix, 50 # capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file 51 # is marked as config-dependent. 52 53 NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $< 54 NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 55 56 DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $< 57 DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 58 59 PROFILE_C= ${CC} -S -c ${COPTS} $<; \ 60 ex - $*.s < ${GPROF.EX}; \ 61 ${AS} -o $@ $*.s; \ 62 rm -f $*.s 63 64 # This really bites for now, but we need to run assembly through sed 65 # until the real problem (cpp, I think) is fixed. 66 NORMAL_S= ${CPP} ${COPTS} $< | ${AS} -o $@ 67 NORMAL_S_C= ${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@ 68 69 %OBJS 70 71 %CFILES 72 73 # load lines for config "xxx" will be emitted as: 74 # xxx: ${SYSTEM_DEP} swapxxx.o 75 # ${SYSTEM_LD_HEAD} 76 # ${SYSTEM_LD} swapxxx.o 77 # ${SYSTEM_LD_TAIL} 78 SYSTEM_OBJ= locore.o vnode_if.o ${OBJS} param.o ioconf.o conf.o \ 79 ${FPSP} ${LIBKERN} 80 SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 81 SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ 82 SYSTEM_LD= @strip=-x; [ X${DEBUG} = X-g ] && strip=-X || true; \ 83 ${LD} $$strip -n -T 0 -e start -o $@ \ 84 ${SYSTEM_OBJ} vers.o ${LIBKERN} 85 #SYSTEM_LD_TAIL= @echo rearranging symbols;\ 86 # symorder symbols.sort $@;\ 87 SYSTEM_LD_TAIL= @chmod 755 $@; size $@; \ 88 [ X${DEBUG} = X-g ] && { \ 89 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 90 echo strip -d $@; strip -d $@; } || true 91 92 %LOAD 93 94 newvers: 95 sh $S/conf/newvers.sh "${KERN_IDENT}" ${IDENT} 96 ${CC} ${CFLAGS} -c vers.c 97 98 clean: 99 rm -f eddep *vmunix tags *.o locore.i [a-z]*.s \ 100 Errs errs linterrs makelinks 101 102 lint: /tmp param.c 103 @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \ 104 ${MAC68K}/mac68k/Locore.c ${CFILES} \ 105 ioconf.c param.c| \ 106 grep -v 'struct/union .* never defined' | \ 107 grep -v 'possible pointer alignment problem' 108 109 symbols.sort: ${MAC68K}/mac68k/symbols.raw 110 grep -v '^#' ${MAC68K}/mac68k/symbols.raw \ 111 | sed 's/^ //' | sort -u > symbols.sort 112 113 locore.o: assym.s ${MAC68K}/mac68k/vectors.s ${MAC68K}/mac68k/locore.s 114 locore.o: ${MAC68K}/include/trap.h ${MAC68K}/include/psl.h ${MAC68K}/include/pte.h 115 locore.o: ${MAC68K}/include/cpu.h 116 ${CPP} -DLOCORE ${COPTS} ${MAC68K}/mac68k/locore.s | ${AS} -o locore.o 117 118 # the following is necessary because autoconf.o depends on #if GENERIC 119 autoconf.o: Makefile 120 121 # the following are necessary because the files depend on the types of 122 # hp cpu's included in the system configuration 123 clock.o machdep.o autoconf.o conf.o: Makefile 124 125 # depend on network configuration 126 af.o uipc_proto.o locore.o: Makefile 127 128 # depend on maxusers 129 assym.s: Makefile 130 131 assym.s: genassym 132 ./genassym >assym.s 133 134 genassym: 135 ${LOCAL_CC} ${INCLUDES} ${IDENT} -DKERNEL ${PARAM} -o genassym \ 136 ${MAC68K}/mac68k/genassym.c 137 138 depend: assym.s param.c vnode_if.h 139 mkdep ${COPTS} ${CFILES} ioconf.c param.c 140 mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${MAC68K}/mac68k/genassym.c 141 142 links: 143 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 144 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 145 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 146 sort -u | comm -23 - dontlink | \ 147 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 148 sh makelinks && rm -f dontlink 149 150 tags: 151 @echo "see $S/kern/Makefile for tags" 152 153 ioconf.o: ioconf.c 154 ${CC} -c ${CFLAGS} ioconf.c 155 156 conf.o: ${MAC68K}/mac68k/conf.c 157 ${NORMAL_C} 158 159 param.c: $S/conf/param.c 160 rm -f param.c 161 cp $S/conf/param.c . 162 163 param.o: param.c Makefile 164 ${CC} -c ${CFLAGS} ${PARAM} -DHZ=60 param.c 165 166 vnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 167 AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 168 169 %RULES 170