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