Makefile.pc98 revision 56444
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 56444 2000-01-23 12:24:48Z 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 59LOAD_ADDRESS?= C0100000 60DEFINED_PROF= ${PROF} 61.if defined(PROF) 62CFLAGS+= -malign-functions=4 63.if ${PROFLEVEL} >= 2 64IDENT+= -DGPROF4 -DGUPROF 65PROF+= -mprofiler-epilogue 66.endif 67.endif 68 69# Put configuration-specific C flags last (except for ${PROF}) so that they 70# can override the others. 71CFLAGS+= ${CONF_CFLAGS} 72 73NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} 74NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} 75NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC} 76PROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC} 77 78GEN_CFILES= $S/$M/$M/genassym.c 79# setdef0.c and setdef1.c are intentionally 80# omitted from SYSTEM_CFILES. They include 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= $S/$M/$M/locore.s 85SYSTEM_DEP= Makefile ${SYSTEM_OBJS} 86SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o param.o config.o \ 87 setdef1.o hack.So 88SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \ 89 -export-dynamic -dynamic-linker /red/herring \ 90 -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 91SYSTEM_LD_TAIL= @${SIZE} ${FMT} ${.TARGET} ; chmod 755 ${.TARGET} 92SYSTEM_DEP+= $S/conf/ldscript.$M 93 94%BEFORE_DEPEND 95 96%OBJS 97 98%CFILES 99 100%SFILES 101 102%MFILES 103 104%CLEAN 105 106all: ${KERNEL} 107 108.if !defined(DEBUG) 109FULLKERNEL= ${KERNEL} 110.else 111FULLKERNEL= ${KERNEL}.debug 112${KERNEL}: ${FULLKERNEL} 113 objcopy --strip-debug ${FULLKERNEL} ${KERNEL} 114.endif 115 116${FULLKERNEL}: ${SYSTEM_DEP} vers.o 117 @rm -f ${.TARGET} 118 @echo linking ${.TARGET} 119 ${SYSTEM_LD} 120 ${SYSTEM_LD_TAIL} 121 122.if !exists(.depend) 123${SYSTEM_OBJS}: vnode_if.h ${BEFORE_DEPEND:M*.h} 124.endif 125 126clean: 127 rm -f *.o *.so *.So *.ko *.s eddep errs genassym \ 128 ${FULLKERNEL} ${KERNEL} linterrs makelinks param.c \ 129 setdef[01].c setdefs.h tags \ 130 vers.c vnode_if.c vnode_if.h ${CLEAN} 131 132#lint: /tmp param.c 133# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \ 134# $S/$M/$M/Locore.c ${CFILES} ioconf.c param.c | \ 135# grep -v 'struct/union .* never defined' | \ 136# grep -v 'possible pointer alignment problem' 137 138locore.o: $S/$M/$M/locore.s assym.s 139 ${NORMAL_S} 140 141# This is a hack. BFD "optimizes" away dynamic mode if there are no 142# dynamic references. We could probably do a '-Bforcedynamic' mode like 143# in the a.out ld. For now, this works. 144hack.So: Makefile 145 touch hack.c 146 ${CC} ${FMT} -shared -nostdlib hack.c -o hack.So 147 rm -f hack.c 148 149.ORDER: setdefs.h setdef0.c setdef1.c 150 151setdef0.o: setdef0.c setdefs.h 152 ${NORMAL_C} 153 154setdef1.o: setdef1.c setdefs.h 155 ${NORMAL_C} 156 157setdef0.c setdef1.c setdefs.h: ${OBJS} 158 @gensetdefs ${OBJS} 159 160# this rule stops ./assym.s in .depend from causing problems 161./assym.s: assym.s 162 163assym.s: genassym.o 164 genassym genassym.o >assym.s 165 166genassym.o: $S/$M/$M/genassym.c 167 rm -f ./machine ; ln -s $S/$M/include ./machine 168 ${CC} -c ${CFLAGS} $S/$M/$M/genassym.c 169 170${SYSTEM_OBJS} genassym.o vers.o: opt_global.h 171 172depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} \ 173 ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} ${SYSTEM_SFILES} 174 rm -f .newdep 175 mkdep -a -f .newdep ${CFLAGS} ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} 176 env MKDEP_CPP="${CC} -E" \ 177 mkdep -a -f .newdep ${ASM_CFLAGS} ${SFILES} ${SYSTEM_SFILES} 178 rm -f .depend 179 mv -f .newdep .depend 180 181cleandepend: 182 rm -f .depend 183 184links: 185 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 186 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 187 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 188 sort -u | comm -23 - dontlink | \ 189 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 190 sh makelinks && rm -f dontlink 191 192tags: 193 @[ -f .depend ] || { echo "you must make depend first"; exit 1; } 194 sh $S/conf/systags.sh 195 rm -f tags1 196 sed -e 's, ../, ,' tags > tags1 197 198install install.debug: 199 @if [ ! -f ${KERNEL}${.TARGET:S/install//} ] ; then \ 200 echo "You must build a kernel first." ; \ 201 exit 1 ; \ 202 fi 203.if exists(${DESTDIR}/${KERNEL}) 204 -chflags noschg ${DESTDIR}/${KERNEL} 205 mv ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old 206.endif 207 install -c -m 555 -o root -g wheel -fschg \ 208 ${KERNEL}${.TARGET:S/install//} ${DESTDIR}/${KERNEL} 209 210reinstall reinstall.debug: 211 install -c -m 555 -o root -g wheel -fschg \ 212 ${KERNEL}${.TARGET:S/reinstall//} ${DESTDIR}/${KERNEL} 213 214config.o: 215 ${NORMAL_C} 216 217ioconf.o: 218 ${NORMAL_C} 219 220param.c: $S/conf/param.c 221 -rm -f param.c 222 cp $S/conf/param.c . 223 224param.o: 225 ${NORMAL_C} 226 227vers.c: $S/conf/newvers.sh $S/sys/param.h ${SYSTEM_DEP} 228 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 229 230# XXX strictly, everything depends on Makefile because changes to ${PROF} 231# only appear there, but we don't handle that. 232vers.o: 233 ${NORMAL_C} 234 235vnode_if.c: $S/kern/vnode_if.pl $S/kern/vnode_if.src 236 perl5 $S/kern/vnode_if.pl -c $S/kern/vnode_if.src 237 238vnode_if.h: $S/kern/vnode_if.pl $S/kern/vnode_if.src 239 perl5 $S/kern/vnode_if.pl -h $S/kern/vnode_if.src 240 241vnode_if.o: 242 ${NORMAL_C} 243 244# Commented out for now pending a better solution. 245# How do we pick up compiler version specific flags?? 246#.if exists($S/../share/mk) 247#.include "$S/../share/mk/bsd.kern.mk" 248#.else 249.include <bsd.kern.mk> 250#.endif 251 252%RULES 253 254# DO NOT DELETE THIS LINE -- make depend uses it 255