Makefile.pc98 revision 40221
1# Makefile for FreeBSD(98) after: 2# 3# Makefile.i386 -- with config changes. 4# Copyright 1990 W. Jolitz 5# from: @(#)Makefile.i386 7.1 5/10/91 6# $Id: Makefile.pc98,v 1.41 1998/10/05 08:57:17 kato Exp $ 7# 8# Makefile for FreeBSD 9# 10# This makefile is constructed from a machine description: 11# config machineid 12# Most changes should be made in the machine description 13# /sys/i386/conf/``machineid'' 14# after which you should do 15# config machineid 16# Generic makefile changes should be made in 17# /sys/i386/conf/Makefile.i386 18# after which config should be rerun for all machines. 19# 20 21# Which version of config(8) is required. 22%VERSREQ= 300007 23 24KERNFORMAT?= aout 25 26#STD8X16FONT?= iso 27 28.if exists(./@/.) 29S= ./@ 30.else 31S= ../.. 32.endif 33PC98= ${S}/pc98 34I386= ${S}/i386 35 36COPTFLAGS?=-O 37INCLUDES= -nostdinc -I- -I. -I$S 38# This hack is to allow kernel compiles to succeed on machines w/out srcdist 39.if exists($S/../include) 40INCLUDES+= -I$S/../include 41.else 42INCLUDES+= -I/usr/include 43.endif 44COPTS= ${INCLUDES} ${IDENT} -DKERNEL -include opt_global.h 45CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} 46 47# XXX LOCORE means "don't declare C stuff" not "for locore.s". 48ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} 49 50# Use the default object format for genassym, etc. 51GEN_CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} 52 53# Select the correct set of tools. Can't set OBJFORMAT here because it 54# doesn't get exported into the environment, and if it were exported 55# then it might break building of genassym, etc. 56.if ${KERNFORMAT} == "elf" 57CFLAGS+= -elf 58.else 59CFLAGS+= -aout 60.endif 61 62LOAD_ADDRESS?= F0100000 63DEFINED_PROF= ${PROF} 64.if defined(PROF) 65CFLAGS+= -malign-functions=4 66.if ${PROFLEVEL} >= 2 67IDENT+= -DGPROF4 -DGUPROF 68PROF+= -mprofiler-epilogue 69.endif 70.endif 71 72NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $< 73NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} $< 74NORMAL_S= ${CC} -c ${ASM_CFLAGS} $< 75DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $< 76DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} $< 77DRIVER_S= ${CC} -c -x ${ASM_CFLAGS} $< 78PROFILE_C= ${CC} -c ${CFLAGS} $< 79 80GEN_CFILES= ${I386}/i386/genassym.c ${I386}/i386/gensetdefs.c 81# ${I386}/i386/setdef0.c and ${I386}/i386/setdef1.c are intentionally 82# omitted from SYSTEM_CFILES. They include setdefs.h, a header which 83# is generated from all of ${OBJS}. We don't want to have to compile 84# everything just to do a make depend. 85SYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c 86SYSTEM_SFILES= ${I386}/i386/locore.s 87SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} 88.if ${CFLAGS:M-g} == "" 89SYMORDER_EXCLUDE=-x symbols.exclude 90.endif 91SYSTEM_LD_HEAD= @echo loading ${.TARGET}; rm -f ${.TARGET} 92.if ${KERNFORMAT} == aout 93SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o 94SYSTEM_LD= @${LD} -aout -Bstatic -Z -T ${LOAD_ADDRESS} -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 95SYSTEM_LD_TAIL= @echo rearranging symbols; \ 96 symorder -m ${SYMORDER_EXCLUDE} symbols.sort ${.TARGET}; \ 97 size -aout ${.TARGET} ; chmod 755 ${.TARGET} 98.endif 99.if ${KERNFORMAT} == aoutkld 100SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o 101SYSTEM_LD= @${LD} -aout -Bforcedynamic -Z -T ${LOAD_ADDRESS} -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 102SYSTEM_LD_TAIL= @echo rearranging symbols; \ 103 symorder -m ${SYMORDER_EXCLUDE} symbols.sort ${.TARGET}; \ 104 size -aout ${.TARGET} ; chmod 755 ${.TARGET} 105.endif 106.if ${KERNFORMAT} == elf 107# kld compatable export of symbols. 108SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o param.o config.o \ 109 setdef1.o hack.so 110SYSTEM_LD= @${LD} -elf -Bdynamic -T $S/i386/conf/kernel.script \ 111 -export-dynamic -dynamic-linker /red/herring \ 112 -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 113SYSTEM_LD_TAIL= @size -elf ${.TARGET} ; chmod 755 ${.TARGET} 114SYSTEM_DEP+= $S/i386/conf/kernel.script 115.endif 116 117%BEFORE_DEPEND 118 119%OBJS 120 121%CFILES 122 123%SFILES 124 125%MFILES 126 127%LOAD 128 129%CLEAN 130 131clean: 132 rm -f *.o *.so *.ko *.s eddep errs genassym gensetdefs kernel linterrs \ 133 makelinks param.c setdefs.h symbols.exclude symbols.sort tags \ 134 vers.c vnode_if.c vnode_if.h ${CLEAN} 135 136#lint: /tmp param.c 137# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \ 138# ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \ 139# grep -v 'struct/union .* never defined' | \ 140# grep -v 'possible pointer alignment problem' 141 142symbols.exclude: 143 echo "gcc2_compiled." >symbols.exclude 144 echo "___gnu_compiled_c" >>symbols.exclude 145 146symbols.sort: ${I386}/i386/symbols.raw 147 grep -v '^#' ${I386}/i386/symbols.raw \ 148 | sed 's/^ //' | sort -u > symbols.sort 149 150locore.o: ${I386}/i386/locore.s assym.s 151 ${NORMAL_S} 152 153.if ${KERNFORMAT} == elf 154# This is a hack. BFD "optimizes" away dynamic mode if there are no 155# dynamic references. We could probably do a '-Bforcedynamic' mode like 156# in the a.out ld. For now, this works. 157hack.so: Makefile 158 touch hack.c 159 ${CC} -elf -shared -nostdlib hack.c -o hack.so 160 rm -f hack.c 161.endif 162 163setdef0.o: ${I386}/i386/setdef0.c setdefs.h 164 ${NORMAL_C} 165 166setdef1.o: ${I386}/i386/setdef1.c setdefs.h 167 ${NORMAL_C} 168 169setdefs.h: gensetdefs ${OBJS} 170 ./gensetdefs ${OBJS} >setdefs.h 171 172gensetdefs: gensetdefs.o 173 ${CC} ${GEN_CFLAGS} gensetdefs.o -o ${.TARGET} 174 175gensetdefs.o: ${I386}/i386/gensetdefs.c 176 ${CC} -c ${GEN_CFLAGS} ${I386}/i386/gensetdefs.c 177 178# this rule stops ./assym.s in .depend from causing problems 179./assym.s: assym.s 180 181assym.s: genassym 182 ./genassym >assym.s 183 184genassym.o: ${I386}/i386/genassym.c 185 rm -f ./machine ; ln -s ${I386}/include ./machine 186 ${CC} -c ${GEN_CFLAGS} ${I386}/i386/genassym.c 187 188genassym: genassym.o 189 ${CC} ${GEN_CFLAGS} genassym.o -o ${.TARGET} 190 191${SYSTEM_OBJS} genassym.o gensetdefs.o vers.o: opt_global.h 192 193# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical. 194depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} 195 rm -f .newdep 196 mkdep -a -f .newdep ${CFLAGS} ${CFILES} ${SYSTEM_CFILES} 197 mkdep -a -f .newdep ${GEN_CFLAGS} ${GEN_CFILES} 198 env MKDEP_CPP="${CC} -E" \ 199 mkdep -a -f .newdep ${ASM_CFLAGS} ${SFILES} ${SYSTEM_SFILES} 200 rm -f .depend 201 mv -f .newdep .depend 202 203cleandepend: 204 rm -f .depend 205 206links: 207 egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \ 208 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 209 echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 210 sort -u | comm -23 - dontlink | \ 211 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 212 sh makelinks && rm -f dontlink 213 214tags: 215 @echo "see $S/kern/Makefile for tags" 216 217install: 218 @if [ ! -f kernel ] ; then \ 219 echo "You must first build your kernel before trying to install." ; \ 220 exit 1 ; \ 221 fi 222.if exists(${DESTDIR}/kernel) 223 chflags noschg ${DESTDIR}/kernel 224 mv ${DESTDIR}/kernel ${DESTDIR}/kernel.old 225.endif 226 PATH=$${PATH}:/sbin:/usr/sbin; \ 227 if [ `sysctl -n kern.bootfile` = ${DESTDIR}/kernel ] ; then \ 228 sysctl -w kern.bootfile=${DESTDIR}/kernel.old ; \ 229 if [ -f /var/db/kvm_kernel.db ] ; then \ 230 mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \ 231 fi \ 232 fi 233 install -c -m 555 -o root -g wheel -fschg kernel ${DESTDIR}/ 234 235config.o: 236 ${NORMAL_C} 237 238ioconf.o: 239 ${NORMAL_C} 240 241param.c: $S/conf/param.c 242 -rm -f param.c 243 cp $S/conf/param.c . 244 245param.o: 246 ${NORMAL_C} 247 248vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} 249 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 250 251# XXX strictly, everything depends on Makefile because changes to ${PROF} 252# only appear there, but we don't handle that. 253vers.o: 254 ${NORMAL_C} 255 256.ORDER: vnode_if.c vnode_if.h 257vnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 258 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 259 260vnode_if.o: 261 ${NORMAL_C} 262 263.if exists($S/../share/mk) 264.include "$S/../share/mk/bsd.kern.mk" 265.else 266.include <bsd.kern.mk> 267.endif 268 269%RULES 270 271# DO NOT DELETE THIS LINE -- make depend uses it 272