Makefile.pc98 revision 39335
11573Srgrimes# Makefile for FreeBSD(98) after: 21573Srgrimes# 31573Srgrimes# Makefile.i386 -- with config changes. 41573Srgrimes# Copyright 1990 W. Jolitz 51573Srgrimes# from: @(#)Makefile.i386 7.1 5/10/91 61573Srgrimes# $Id: Makefile.pc98,v 1.38 1998/09/15 03:49:43 kato Exp $ 71573Srgrimes# 81573Srgrimes# Makefile for FreeBSD 91573Srgrimes# 101573Srgrimes# This makefile is constructed from a machine description: 111573Srgrimes# config machineid 121573Srgrimes# Most changes should be made in the machine description 131573Srgrimes# /sys/i386/conf/``machineid'' 141573Srgrimes# after which you should do 151573Srgrimes# config machineid 161573Srgrimes# Generic makefile changes should be made in 171573Srgrimes# /sys/i386/conf/Makefile.i386 181573Srgrimes# after which config should be rerun for all machines. 191573Srgrimes# 201573Srgrimes 211573Srgrimes# Which version of config(8) is required. 221573Srgrimes%VERSREQ= 300007 231573Srgrimes 241573SrgrimesKERNFORMAT?= aout 251573Srgrimes 261573Srgrimes#STD8X16FONT?= iso 271573Srgrimes 281573Srgrimes.if exists(./@/.) 291573SrgrimesS= ./@ 301573Srgrimes.else 311573SrgrimesS= ../.. 321573Srgrimes.endif 331573SrgrimesPC98= ${S}/pc98 341573SrgrimesI386= ${S}/i386 3530510Sache 361573SrgrimesCOPTFLAGS?=-O 3730510SacheINCLUDES= -nostdinc -I- -I. -I$S 3830510Sache# This hack is to allow kernel compiles to succeed on machines w/out srcdist 3950476Speter.if exists($S/../include) 401573SrgrimesINCLUDES+= -I$S/../include 411573Srgrimes.else 4230510SacheINCLUDES+= -I/usr/include 4330510Sache.endif 4430479SacheCOPTS= ${INCLUDES} ${IDENT} -DKERNEL -include opt_global.h 451573SrgrimesCFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} 461573Srgrimes 471573Srgrimes# Use the system default for genassym 4855837SjasoneGEN_CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} 491573Srgrimes 501573Srgrimes# Select the correct set of tools. Can't set OBJFORMAT here because it 5138938Sache# doesn't get exported into the environment. 5238938Sache.if ${KERNFORMAT} == "elf" 5313545SjulianCFLAGS+= -elf 5438938SacheAFLAGS= -elf 5538938Sache.else 5638938SacheCFLAGS+= -aout 5738938SacheAFLAGS= -aout 5838938Sache.endif 5955837Sjasone 6030510SacheLOAD_ADDRESS?= F0100000 6138938SacheDEFINED_PROF= ${PROF} 6238938Sache.if defined(PROF) 6356698SjasoneCFLAGS+= -malign-functions=4 6438938Sache.if ${PROFLEVEL} >= 2 6538938SacheIDENT+= -DGPROF4 -DGUPROF 6638938SachePROF+= -mprofiler-epilogue 6738938Sache.endif 6838938Sache.endif 691573Srgrimes 7055837SjasoneNORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $< 7156698SjasoneNORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} $< 72# XXX LOCORE means "don't declare C stuff" not "for locore.s". 73NORMAL_S= ${CC} -c ${AFLAGS} -x assembler-with-cpp -DLOCORE ${COPTS} $< 74DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $< 75DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} $< 76DRIVER_S= ${CC} -c ${AFLAGS} -x assembler-with-cpp -DLOCORE ${COPTS} $< 77PROFILE_C= ${CC} -c ${CFLAGS} $< 78 79# ${I386}/i386/setdef0.c and ${I386}/i386/setdef1.c are intentionally 80# omitted from SYSTEM_CFILES. They depend on setdefs.h, a header which 81# is generated from all of ${OBJS}. We don't want to have to compile 82# everything just to do a make depend. 83SYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c 84SYSTEM_SFILES= ${I386}/i386/locore.s 85SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} 86.if ${CFLAGS:M-g} == "" 87SYMORDER_EXCLUDE=-x symbols.exclude 88.endif 89SYSTEM_LD_HEAD= @echo loading ${.TARGET}; rm -f ${.TARGET} 90.if ${KERNFORMAT} == aout 91SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o 92SYSTEM_LD= @${LD} -aout -Bstatic -Z -T ${LOAD_ADDRESS} -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 93SYSTEM_LD_TAIL= @echo rearranging symbols; \ 94 symorder -m ${SYMORDER_EXCLUDE} symbols.sort ${.TARGET}; \ 95 size -aout ${.TARGET} ; chmod 755 ${.TARGET} 96.endif 97.if ${KERNFORMAT} == aoutkld 98SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o 99SYSTEM_LD= @${LD} -aout -Bforcedynamic -Z -T ${LOAD_ADDRESS} -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 100SYSTEM_LD_TAIL= @echo rearranging symbols; \ 101 symorder -m ${SYMORDER_EXCLUDE} symbols.sort ${.TARGET}; \ 102 size -aout ${.TARGET} ; chmod 755 ${.TARGET} 103.endif 104.if ${KERNFORMAT} == elf 105SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o param.o config.o \ 106 setdef1.o 107SYSTEM_LD= @${LD} -elf -Bstatic -Ttext ${LOAD_ADDRESS} -e btext -defsym _DYNAMIC=0 \ 108 -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 109SYSTEM_LD_TAIL= @size -elf ${.TARGET} ; chmod 755 ${.TARGET} 110.endif 111 112%BEFORE_DEPEND 113 114%OBJS 115 116%CFILES 117 118%SFILES 119 120%MFILES 121 122%LOAD 123 124%CLEAN 125 126clean: 127 rm -f *.o *.s eddep errs genassym gensetdefs kernel linterrs \ 128 makelinks param.c setdefs.h symbols.exclude symbols.sort tags \ 129 vers.c vnode_if.c vnode_if.h ${CLEAN} 130 131#lint: /tmp param.c 132# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \ 133# ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \ 134# grep -v 'struct/union .* never defined' | \ 135# grep -v 'possible pointer alignment problem' 136 137symbols.exclude: 138 echo "gcc2_compiled." >symbols.exclude 139 echo "___gnu_compiled_c" >>symbols.exclude 140 141symbols.sort: ${I386}/i386/symbols.raw 142 grep -v '^#' ${I386}/i386/symbols.raw \ 143 | sed 's/^ //' | sort -u > symbols.sort 144 145locore.o: ${I386}/i386/locore.s assym.s 146 ${NORMAL_S} 147 148setdef0.o: ${I386}/i386/setdef0.c setdefs.h 149 ${NORMAL_C} 150 151setdef1.o: ${I386}/i386/setdef1.c setdefs.h 152 ${NORMAL_C} 153 154setdefs.h: gensetdefs ${OBJS} 155 ./gensetdefs ${OBJS} >setdefs.h 156 157gensetdefs: gensetdefs.o 158 ${CC} ${CFLAGS} gensetdefs.o -o ${.TARGET} 159 160gensetdefs.o: ${I386}/i386/gensetdefs.c 161 ${CC} -c ${CFLAGS} ${I386}/i386/gensetdefs.c 162 163# this rule stops ./assym.s in .depend from causing problems 164./assym.s: assym.s 165 166assym.s: genassym 167 ./genassym >assym.s 168 169genassym.o: ${I386}/i386/genassym.c 170 rm -f ./machine ; ln -s ${I386}/include ./machine 171 ${CC} -c ${GEN_CFLAGS} -UKERNEL ${I386}/i386/genassym.c 172 173genassym: genassym.o 174 ${CC} ${GEN_CFLAGS} genassym.o -o ${.TARGET} 175 176${SYSTEM_OBJS}: opt_global.h 177 178# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical. 179depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} 180 rm -f .newdep 181 mkdep -a -f .newdep ${COPTS} ${CFILES} ${SYSTEM_CFILES} 182 mkdep -a -f .newdep ${COPTS} -UKERNEL ${I386}/i386/genassym.c 183 MKDEP_CPP="${CC} -E ${AFLAGS} -x assembler-with-cpp" ; export MKDEP_CPP ; \ 184 mkdep -a -f .newdep -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES} 185 rm -f .depend 186 mv -f .newdep .depend 187 188cleandepend: 189 rm -f .depend 190 191links: 192 egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \ 193 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 194 echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 195 sort -u | comm -23 - dontlink | \ 196 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 197 sh makelinks && rm -f dontlink 198 199tags: 200 @echo "see $S/kern/Makefile for tags" 201 202install: 203 @if [ ! -f kernel ] ; then \ 204 echo "You must first build your kernel before trying to install." ; \ 205 exit 1 ; \ 206 fi 207.if exists(${DESTDIR}/kernel) 208 chflags noschg ${DESTDIR}/kernel 209 mv ${DESTDIR}/kernel ${DESTDIR}/kernel.old 210.endif 211 PATH=$${PATH}:/sbin:/usr/sbin; \ 212 if [ `sysctl -n kern.bootfile` = ${DESTDIR}/kernel ] ; then \ 213 sysctl -w kern.bootfile=${DESTDIR}/kernel.old ; \ 214 if [ -f /var/db/kvm_kernel.db ] ; then \ 215 mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \ 216 fi \ 217 fi 218 install -c -m 555 -o root -g wheel -fschg kernel ${DESTDIR}/ 219 220config.o: 221 ${NORMAL_C} 222 223ioconf.o: 224 ${NORMAL_C} 225 226param.c: $S/conf/param.c 227 -rm -f param.c 228 cp $S/conf/param.c . 229 230param.o: 231 ${NORMAL_C} 232 233vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} 234 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 235 236# XXX strictly, everything depends on Makefile because changes to ${PROF} 237# only appear there, but we don't handle that. 238vers.o: 239 ${NORMAL_C} 240 241.ORDER: vnode_if.c vnode_if.h 242vnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 243 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 244 245vnode_if.o: 246 ${NORMAL_C} 247 248.if exists($S/../share/mk) 249.include "$S/../share/mk/bsd.kern.mk" 250.else 251.include <bsd.kern.mk> 252.endif 253 254%RULES 255 256# DO NOT DELETE THIS LINE -- make depend uses it 257