Makefile.pc98 revision 41974
1112918Sjeff# Makefile for FreeBSD(98) after: 2153496Sdavidxu# 3112918Sjeff# Makefile.i386 -- with config changes. 4112918Sjeff# Copyright 1990 W. Jolitz 5112918Sjeff# from: @(#)Makefile.i386 7.1 5/10/91 6112918Sjeff# $Id: Makefile.pc98,v 1.46 1998/12/08 08:19:45 kato Exp $ 7112918Sjeff# 8112918Sjeff# Makefile for FreeBSD 9153496Sdavidxu# 10153496Sdavidxu# This makefile is constructed from a machine description: 11112918Sjeff# config machineid 12112918Sjeff# Most changes should be made in the machine description 13112918Sjeff# /sys/i386/conf/``machineid'' 14112918Sjeff# after which you should do 15153496Sdavidxu# config machineid 16153496Sdavidxu# Generic makefile changes should be made in 17153496Sdavidxu# /sys/i386/conf/Makefile.i386 18153496Sdavidxu# after which config should be rerun for all machines. 19153496Sdavidxu# 20153496Sdavidxu 21153496Sdavidxu# Which version of config(8) is required. 22153496Sdavidxu%VERSREQ= 300009 23153496Sdavidxu 24153496SdavidxuKERNFORMAT?= aout 25112918Sjeff 26112918Sjeff#STD8X16FONT?= iso 27153496Sdavidxu 28112918Sjeff.if exists(./@/.) 29144518SdavidxuS= ./@ 30144518Sdavidxu.else 31112918SjeffS= ../.. 32144518Sdavidxu.endif 33144518SdavidxuPC98= ${S}/pc98 34112918SjeffI386= ${S}/i386 35112918Sjeff 36112918SjeffCOPTFLAGS?=-O 37112918SjeffINCLUDES= -nostdinc -I- -I. -I$S 38144518Sdavidxu# This hack is to allow kernel compiles to succeed on machines w/out srcdist 39144518Sdavidxu.if exists($S/../include) 40144518SdavidxuINCLUDES+= -I$S/../include 41179417Sdavidxu.else 42144518SdavidxuINCLUDES+= -I/usr/include 43144518Sdavidxu.endif 44144518SdavidxuCOPTS= ${INCLUDES} ${IDENT} -DKERNEL -include opt_global.h 45144518SdavidxuCFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} 46144518Sdavidxu 47144518Sdavidxu# XXX LOCORE means "don't declare C stuff" not "for locore.s". 48144518SdavidxuASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} 49144518Sdavidxu 50144518Sdavidxu# Use the default object format for genassym, etc. 51144518SdavidxuGEN_CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} 52144518Sdavidxu 53144518Sdavidxu# Select the correct set of tools. Can't set OBJFORMAT here because it 54144518Sdavidxu# doesn't get exported into the environment, and if it were exported 55179417Sdavidxu# then it might break building of genassym, etc. 56179417Sdavidxu.if ${KERNFORMAT} == "elf" 57179417SdavidxuCFLAGS+= -elf 58179417Sdavidxu.else 59144518SdavidxuCFLAGS+= -aout 60144518Sdavidxu.endif 61112918Sjeff 62144518SdavidxuLOAD_ADDRESS?= F0100000 63112918SjeffDEFINED_PROF= ${PROF} 64172695Sdavidxu.if defined(PROF) 65179417SdavidxuCFLAGS+= -malign-functions=4 66144518Sdavidxu.if ${PROFLEVEL} >= 2 67179417SdavidxuIDENT+= -DGPROF4 -DGUPROF 68179417SdavidxuPROF+= -mprofiler-epilogue 69179417Sdavidxu.endif 70179417Sdavidxu.endif 71179417Sdavidxu 72179417SdavidxuNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $< 73179417SdavidxuNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} $< 74179417SdavidxuNORMAL_S= ${CC} -c ${ASM_CFLAGS} $< 75179417SdavidxuDRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $< 76179417SdavidxuDRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} $< 77179417SdavidxuDRIVER_S= ${CC} -c -x ${ASM_CFLAGS} $< 78179417SdavidxuPROFILE_C= ${CC} -c ${CFLAGS} $< 79179417Sdavidxu 80179417SdavidxuGEN_CFILES= ${I386}/i386/genassym.c ${I386}/i386/gensetdefs.c 81179417Sdavidxu# ${I386}/i386/setdef0.c and ${I386}/i386/setdef1.c are intentionally 82179417Sdavidxu# omitted from SYSTEM_CFILES. They include setdefs.h, a header which 83179417Sdavidxu# is generated from all of ${OBJS}. We don't want to have to compile 84179417Sdavidxu# everything just to do a make depend. 85179417SdavidxuSYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c 86179417SdavidxuSYSTEM_SFILES= ${I386}/i386/locore.s 87179417SdavidxuSYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} 88144518Sdavidxu.if ${CFLAGS:M-g} == "" 89179417SdavidxuSYMORDER_EXCLUDE=-x symbols.exclude 90179417Sdavidxu.endif 91112918SjeffSYSTEM_LD_HEAD= @echo loading ${.TARGET}; rm -f ${.TARGET} 92112918Sjeff.if ${KERNFORMAT} == aout || ${KERNFORMAT} == aoutkld 93144518SdavidxuSYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o 94155739SdavidxuSYSTEM_LD= @${LD} -aout -Bforcedynamic -Z -T ${LOAD_ADDRESS} -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 95155739SdavidxuSYSTEM_LD_TAIL= @echo rearranging symbols; \ 96155739Sdavidxu symorder -m ${SYMORDER_EXCLUDE} symbols.sort ${.TARGET}; \ 97155739Sdavidxu size -aout ${.TARGET} ; chmod 755 ${.TARGET} 98.endif 99.if ${KERNFORMAT} == elf 100SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o \ 101 setdef0.o setdef1.o hack.so 102SYSTEM_LD= @${LD} -elf -Bdynamic -T $S/i386/conf/kernel.script \ 103 -export-dynamic -dynamic-linker /red/herring \ 104 -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 105SYSTEM_LD_TAIL= @size -elf ${.TARGET} ; chmod 755 ${.TARGET} 106SYSTEM_DEP+= $S/i386/conf/kernel.script 107.endif 108 109%BEFORE_DEPEND 110 111%OBJS 112 113%CFILES 114 115%SFILES 116 117%MFILES 118 119%LOAD 120 121%CLEAN 122 123.if !exists(.depend) 124${SYSTEM_OBJS}: ${BEFORE_DEPEND:M*.h} 125.endif 126 127clean: 128 rm -f *.o *.so *.ko *.s eddep errs genassym gensetdefs kernel linterrs \ 129 makelinks param.c setdefs.h symbols.exclude symbols.sort tags \ 130 vers.c vnode_if.c vnode_if.h ${CLEAN} 131 132#lint: /tmp param.c 133# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \ 134# ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \ 135# grep -v 'struct/union .* never defined' | \ 136# grep -v 'possible pointer alignment problem' 137 138symbols.exclude: 139 echo "gcc2_compiled." >symbols.exclude 140 echo "___gnu_compiled_c" >>symbols.exclude 141 142symbols.sort: ${I386}/i386/symbols.raw 143 grep -v '^#' ${I386}/i386/symbols.raw \ 144 | sed 's/^ //' | sort -u > symbols.sort 145 146locore.o: ${I386}/i386/locore.s assym.s 147 ${NORMAL_S} 148 149.if ${KERNFORMAT} == elf 150# This is a hack. BFD "optimizes" away dynamic mode if there are no 151# dynamic references. We could probably do a '-Bforcedynamic' mode like 152# in the a.out ld. For now, this works. 153hack.so: Makefile 154 touch hack.c 155 ${CC} -elf -shared -nostdlib hack.c -o hack.so 156 rm -f hack.c 157.endif 158 159setdef0.o: ${I386}/i386/setdef0.c setdefs.h 160 ${NORMAL_C} 161 162setdef1.o: ${I386}/i386/setdef1.c setdefs.h 163 ${NORMAL_C} 164 165setdefs.h: gensetdefs ${OBJS} 166 ./gensetdefs ${OBJS} >setdefs.h 167 168gensetdefs: gensetdefs.o 169 ${CC} ${GEN_CFLAGS} gensetdefs.o -o ${.TARGET} 170 171gensetdefs.o: ${I386}/i386/gensetdefs.c 172 ${CC} -c ${GEN_CFLAGS} ${I386}/i386/gensetdefs.c 173 174# this rule stops ./assym.s in .depend from causing problems 175./assym.s: assym.s 176 177assym.s: genassym 178 ./genassym >assym.s 179 180genassym.o: ${I386}/i386/genassym.c 181 rm -f ./machine ; ln -s ${I386}/include ./machine 182 ${CC} -c ${GEN_CFLAGS} ${I386}/i386/genassym.c 183 184genassym: genassym.o 185 ${CC} ${GEN_CFLAGS} genassym.o -o ${.TARGET} 186 187${SYSTEM_OBJS} genassym.o gensetdefs.o vers.o: opt_global.h 188 189# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical. 190depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} 191 rm -f .newdep 192 mkdep -a -f .newdep ${CFLAGS} ${CFILES} ${SYSTEM_CFILES} 193 mkdep -a -f .newdep ${GEN_CFLAGS} ${GEN_CFILES} 194 env MKDEP_CPP="${CC} -E" \ 195 mkdep -a -f .newdep ${ASM_CFLAGS} ${SFILES} ${SYSTEM_SFILES} 196 rm -f .depend 197 mv -f .newdep .depend 198 199cleandepend: 200 rm -f .depend 201 202links: 203 egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \ 204 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 205 echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 206 sort -u | comm -23 - dontlink | \ 207 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 208 sh makelinks && rm -f dontlink 209 210tags: 211 @echo "see $S/kern/Makefile for tags" 212 213install: 214 @if [ ! -f kernel ] ; then \ 215 echo "You must first build your kernel before trying to install." ; \ 216 exit 1 ; \ 217 fi 218.if exists(${DESTDIR}/kernel) 219 chflags noschg ${DESTDIR}/kernel 220 mv ${DESTDIR}/kernel ${DESTDIR}/kernel.old 221.endif 222 PATH=$${PATH}:/sbin:/usr/sbin; \ 223 if [ `sysctl -n kern.bootfile` = ${DESTDIR}/kernel ] ; then \ 224 sysctl -w kern.bootfile=${DESTDIR}/kernel.old ; \ 225 if [ -f /var/db/kvm_kernel.db ] ; then \ 226 mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \ 227 fi \ 228 fi 229 install -c -m 555 -o root -g wheel -fschg kernel ${DESTDIR}/ 230 231config.o: 232 ${NORMAL_C} 233 234ioconf.o: 235 ${NORMAL_C} 236 237param.c: $S/conf/param.c 238 -rm -f param.c 239 cp $S/conf/param.c . 240 241param.o: 242 ${NORMAL_C} 243 244vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} 245 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 246 247# XXX strictly, everything depends on Makefile because changes to ${PROF} 248# only appear there, but we don't handle that. 249vers.o: 250 ${NORMAL_C} 251 252.ORDER: vnode_if.c vnode_if.h 253vnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 254 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 255 256vnode_if.o: 257 ${NORMAL_C} 258 259.if exists($S/../share/mk) 260.include "$S/../share/mk/bsd.kern.mk" 261.else 262.include <bsd.kern.mk> 263.endif 264 265%RULES 266 267# DO NOT DELETE THIS LINE -- make depend uses it 268