Makefile.pc98 revision 38727
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.35 1998/08/28 12:48:38 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= 300005 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# Select the correct set of tools. Can't set OBJFORMAT here because it 48# doesn't get exported into the environment. 49.if ${KERNFORMAT} == "elf" 50CFLAGS+= -elf 51AFLAGS= -elf 52.else 53CFLAGS+= -aout 54AFLAGS= -aout 55.endif 56 57LOAD_ADDRESS?= F0100000 58DEFINED_PROF= ${PROF} 59.if defined(PROF) 60CFLAGS+= -malign-functions=4 61.if ${PROFLEVEL} >= 2 62IDENT+= -DGPROF4 -DGUPROF 63PROF+= -mprofiler-epilogue 64.endif 65.endif 66 67NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $< 68NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} $< 69# XXX LOCORE means "don't declare C stuff" not "for locore.s". 70NORMAL_S= ${CC} -c ${AFLAGS} -x assembler-with-cpp -DLOCORE ${COPTS} $< 71DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $< 72DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} $< 73DRIVER_S= ${CC} -c ${AFLAGS} -x assembler-with-cpp -DLOCORE ${COPTS} $< 74PROFILE_C= ${CC} -c ${CFLAGS} $< 75 76# ${I386}/i386/setdef0.c and ${I386}/i386/setdef1.c are intentionally 77# omitted from SYSTEM_CFILES. They depend on setdefs.h, a header which 78# is generated from all of ${OBJS}. We don't want to have to compile 79# everything just to do a make depend. 80SYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c 81SYSTEM_SFILES= ${I386}/i386/locore.s 82SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} 83.if ${CFLAGS:M-g} == "" 84SYMORDER_EXCLUDE=-x symbols.exclude 85.endif 86SYSTEM_LD_HEAD= @echo loading ${.TARGET}; rm -f ${.TARGET} 87.if ${KERNFORMAT} == aout 88SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o 89SYSTEM_LD= @${LD} -aout -Bstatic -Z -T ${LOAD_ADDRESS} -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 90SYSTEM_LD_TAIL= @echo rearranging symbols; \ 91 symorder -m ${SYMORDER_EXCLUDE} symbols.sort ${.TARGET}; \ 92 size -aout ${.TARGET} ; chmod 755 ${.TARGET} 93.endif 94.if ${KERNFORMAT} == aoutkld 95SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o 96SYSTEM_LD= @${LD} -aout -Bforcedynamic -Z -T ${LOAD_ADDRESS} -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 97SYSTEM_LD_TAIL= @echo rearranging symbols; \ 98 symorder -m ${SYMORDER_EXCLUDE} symbols.sort ${.TARGET}; \ 99 size -aout ${.TARGET} ; chmod 755 ${.TARGET} 100.endif 101.if ${KERNFORMAT} == elf 102SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o param.o config.o \ 103 setdef1.o 104SYSTEM_LD= @${LD} -elf -Bstatic -Ttext ${LOAD_ADDRESS} -e btext -defsym _DYNAMIC=0 \ 105 -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 106SYSTEM_LD_TAIL= @size -elf ${.TARGET} ; chmod 755 ${.TARGET} 107.endif 108 109%BEFORE_DEPEND 110 111%OBJS 112 113%CFILES 114 115%SFILES 116 117%LOAD 118 119%CLEAN 120 121clean: 122 rm -f *.o *.s eddep errs genassym gensetdefs kernel linterrs \ 123 makelinks param.c setdefs.h symbols.exclude symbols.sort tags \ 124 vers.c vnode_if.c vnode_if.h ${CLEAN} 125 126#lint: /tmp param.c 127# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \ 128# ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \ 129# grep -v 'struct/union .* never defined' | \ 130# grep -v 'possible pointer alignment problem' 131 132symbols.exclude: 133 echo "gcc2_compiled." >symbols.exclude 134 echo "___gnu_compiled_c" >>symbols.exclude 135 136symbols.sort: ${I386}/i386/symbols.raw 137 grep -v '^#' ${I386}/i386/symbols.raw \ 138 | sed 's/^ //' | sort -u > symbols.sort 139 140locore.o: ${I386}/i386/locore.s assym.s 141 ${NORMAL_S} 142 143setdef0.o: ${I386}/i386/setdef0.c setdefs.h 144 ${NORMAL_C} 145 146setdef1.o: ${I386}/i386/setdef1.c setdefs.h 147 ${NORMAL_C} 148 149setdefs.h: gensetdefs ${OBJS} 150 ./gensetdefs ${OBJS} >setdefs.h 151 152gensetdefs: gensetdefs.o 153 ${CC} ${CFLAGS} gensetdefs.o -o ${.TARGET} 154 155gensetdefs.o: ${I386}/i386/gensetdefs.c 156 ${CC} -c ${CFLAGS} ${I386}/i386/gensetdefs.c 157 158# this rule stops ./assym.s in .depend from causing problems 159./assym.s: assym.s 160 161assym.s: genassym 162 ./genassym >assym.s 163 164genassym.o: ${I386}/i386/genassym.c 165 rm -f ./machine ; ln -s ${I386}/include ./machine 166 ${CC} -c ${CFLAGS} -UKERNEL ${I386}/i386/genassym.c 167 168genassym: genassym.o 169 ${CC} ${CFLAGS} genassym.o -o ${.TARGET} 170 171${SYSTEM_OBJS}: opt_global.h 172 173# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical. 174depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} 175 rm -f .newdep 176 mkdep -a -f .newdep ${COPTS} ${CFILES} ${SYSTEM_CFILES} 177 mkdep -a -f .newdep ${COPTS} -UKERNEL ${I386}/i386/genassym.c 178 MKDEP_CPP="${CC} -E ${AFLAGS} -x assembler-with-cpp" ; export MKDEP_CPP ; \ 179 mkdep -a -f .newdep -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES} 180 rm -f .depend 181 mv -f .newdep .depend 182 183cleandepend: 184 rm -f .depend 185 186links: 187 egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \ 188 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 189 echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 190 sort -u | comm -23 - dontlink | \ 191 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 192 sh makelinks && rm -f dontlink 193 194tags: 195 @echo "see $S/kern/Makefile for tags" 196 197install: 198 @if [ ! -f kernel ] ; then \ 199 echo "You must first build your kernel before trying to install." ; \ 200 exit 1 ; \ 201 fi 202.if exists(${DESTDIR}/kernel) 203 chflags noschg ${DESTDIR}/kernel 204 mv ${DESTDIR}/kernel ${DESTDIR}/kernel.old 205.endif 206 PATH=$${PATH}:/sbin:/usr/sbin; \ 207 if [ `sysctl -n kern.bootfile` = ${DESTDIR}/kernel ] ; then \ 208 sysctl -w kern.bootfile=${DESTDIR}/kernel.old ; \ 209 if [ -f /var/db/kvm_kernel.db ] ; then \ 210 mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \ 211 fi \ 212 fi 213 install -c -m 555 -o root -g wheel -fschg kernel ${DESTDIR}/ 214 215config.o: 216 ${NORMAL_C} 217 218ioconf.o: 219 ${NORMAL_C} 220 221param.c: $S/conf/param.c 222 -rm -f param.c 223 cp $S/conf/param.c . 224 225param.o: 226 ${NORMAL_C} 227 228vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} 229 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 230 231# XXX strictly, everything depends on Makefile because changes to ${PROF} 232# only appear there, but we don't handle that. 233vers.o: 234 ${NORMAL_C} 235 236.ORDER: vnode_if.c vnode_if.h 237vnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 238 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 239 240vnode_if.o: 241 ${NORMAL_C} 242 243.if exists($S/../share/mk) 244.include "$S/../share/mk/bsd.kern.mk" 245.else 246.include <bsd.kern.mk> 247.endif 248 249%RULES 250 251# DO NOT DELETE THIS LINE -- make depend uses it 252