Makefile.pc98 revision 46750
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.62 1999/04/25 04:04:24 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= 400014 23 24KERNFORMAT?= elf 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?= C0100000 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 81# setdef0.c and 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 93.if ${KERNFORMAT} == aout || ${KERNFORMAT} == aoutkld 94SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o 95SYSTEM_LD= @${LD} -aout -Bforcedynamic -Z -T ${LOAD_ADDRESS} -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 96SYSTEM_LD_TAIL= @echo rearranging symbols; \ 97 symorder -m ${SYMORDER_EXCLUDE} symbols.sort ${.TARGET}; \ 98 size -aout ${.TARGET} ; chmod 755 ${.TARGET} 99.endif 100 101.if ${KERNFORMAT} == elf 102SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o param.o config.o \ 103 setdef1.o hack.So 104SYSTEM_LD= @${LD} -elf -Bdynamic -T $S/i386/conf/kernel.script \ 105 -export-dynamic -dynamic-linker /red/herring \ 106 -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 107SYSTEM_LD_TAIL= @size -elf ${.TARGET} ; chmod 755 ${.TARGET} 108SYSTEM_DEP+= $S/i386/conf/kernel.script 109.endif 110 111.if defined(DEBUG) 112FULLKERNEL= ${KERNEL}.debug 113.else 114FULLKERNEL= ${KERNEL} 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 131.if !exists(.depend) 132${SYSTEM_OBJS}: vnode_if.h ${BEFORE_DEPEND:M*.h} 133.endif 134 135clean: 136 rm -f *.o *.so *.So *.ko *.s eddep errs genassym gensetdefs \ 137 ${KERNEL} ${FULLKERNEL} linterrs makelinks param.c \ 138 setdef[01].c setdefs.h symbols.exclude symbols.sort tags \ 139 vers.c vnode_if.c vnode_if.h ${CLEAN} 140 141#lint: /tmp param.c 142# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \ 143# ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \ 144# grep -v 'struct/union .* never defined' | \ 145# grep -v 'possible pointer alignment problem' 146 147symbols.exclude: 148 echo "gcc2_compiled." >symbols.exclude 149 echo "___gnu_compiled_c" >>symbols.exclude 150 151symbols.sort: ${I386}/i386/symbols.raw 152 grep -v '^#' ${I386}/i386/symbols.raw \ 153 | sed 's/^ //' | sort -u > symbols.sort 154 155locore.o: ${I386}/i386/locore.s assym.s 156 ${NORMAL_S} 157 158.if ${KERNFORMAT} == elf 159# This is a hack. BFD "optimizes" away dynamic mode if there are no 160# dynamic references. We could probably do a '-Bforcedynamic' mode like 161# in the a.out ld. For now, this works. 162hack.So: Makefile 163 touch hack.c 164 ${CC} -elf -shared -nostdlib hack.c -o hack.So 165 rm -f hack.c 166.endif 167 168.ORDER: setdefs.h setdef0.c setdef1.c 169 170setdef0.o: setdef0.c setdefs.h 171 ${NORMAL_C} 172 173setdef1.o: setdef1.c setdefs.h 174 ${NORMAL_C} 175 176setdef0.c setdef1.c setdefs.h: ${OBJS} 177 @echo generating linker set emulation glue for ELF 178 @gensetdefs ${OBJS} 179 180# this rule stops ./assym.s in .depend from causing problems 181./assym.s: assym.s 182 183assym.s: genassym 184 ./genassym >assym.s 185 186genassym.o: ${I386}/i386/genassym.c 187 rm -f ./machine ; ln -s ${I386}/include ./machine 188 ${CC} -c ${GEN_CFLAGS} ${I386}/i386/genassym.c 189 190genassym: genassym.o 191 ${CC} ${GEN_CFLAGS} genassym.o -o ${.TARGET} 192 193${SYSTEM_OBJS} genassym.o vers.o: opt_global.h 194 195# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical. 196depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} 197 rm -f .newdep 198 mkdep -a -f .newdep ${CFLAGS} ${CFILES} ${SYSTEM_CFILES} 199 mkdep -a -f .newdep ${GEN_CFLAGS} ${GEN_CFILES} 200 env MKDEP_CPP="${CC} -E" \ 201 mkdep -a -f .newdep ${ASM_CFLAGS} ${SFILES} ${SYSTEM_SFILES} 202 rm -f .depend 203 mv -f .newdep .depend 204 205cleandepend: 206 rm -f .depend 207 208links: 209 egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \ 210 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 211 echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 212 sort -u | comm -23 - dontlink | \ 213 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 214 sh makelinks && rm -f dontlink 215 216tags: 217 @echo "see $S/kern/Makefile for tags" 218 219.if defined(DEBUG) 220${KERNEL}: ${FULLKERNEL} 221.if ${KERNFORMAT} == "elf" 222 objcopy --strip-debug ${FULLKERNEL} ${KERNEL} 223.else 224 cp ${FULLKERNEL} ${KERNEL} 225 strip -d kernel 226.endif 227.endif 228 229install install.debug: 230 @if [ ! -f ${KERNEL}${.TARGET:S/install//} ] ; then \ 231 echo "You must first build a kernel first." ; \ 232 exit 1 ; \ 233 fi 234.if exists(${DESTDIR}/${KERNEL}) 235 -chflags noschg ${DESTDIR}/${KERNEL} 236 mv ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old 237.endif 238 PATH=$${PATH}:/sbin:/usr/sbin; \ 239 if [ `sysctl -n kern.bootfile` = ${DESTDIR}/${KERNEL} ] ; then \ 240 sysctl -w kern.bootfile=${DESTDIR}/${KERNEL}.old ; \ 241 if [ -f /var/db/kvm_kernel.db ] ; then \ 242 mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \ 243 fi \ 244 fi 245 install -c -m 555 -o root -g wheel -fschg \ 246 ${KERNEL}${.TARGET:S/install//} ${DESTDIR}/${KERNEL} 247 248reinstall reinstall.debug: 249 install -c -m 555 -o root -g wheel -fschg \ 250 ${KERNEL}${.TARGET:S/reinstall//} ${DESTDIR}/${KERNEL} 251 252config.o: 253 ${NORMAL_C} 254 255ioconf.o: 256 ${NORMAL_C} 257 258param.c: $S/conf/param.c 259 -rm -f param.c 260 cp $S/conf/param.c . 261 262param.o: 263 ${NORMAL_C} 264 265vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} 266 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 267 268# XXX strictly, everything depends on Makefile because changes to ${PROF} 269# only appear there, but we don't handle that. 270vers.o: 271 ${NORMAL_C} 272 273.ORDER: vnode_if.c vnode_if.h 274vnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 275 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 276 277vnode_if.o: 278 ${NORMAL_C} 279 280.if exists($S/../share/mk) 281.include "$S/../share/mk/bsd.kern.mk" 282.else 283.include <bsd.kern.mk> 284.endif 285 286%RULES 287 288# DO NOT DELETE THIS LINE -- make depend uses it 289