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