Makefile.pc98 revision 55663
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 55663 2000-01-09 14:24:00Z kato $ 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= 400017 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 35PC98= ${S}/pc98 36M= ${MACHINE_ARCH} 37 38SIZE?= size 39 40COPTFLAGS?=-O 41INCLUDES= -nostdinc -I- -I. -I$S 42# This hack is to allow kernel compiles to succeed on machines w/out srcdist 43.if exists($S/../include) 44INCLUDES+= -I$S/../include 45.else 46INCLUDES+= -I/usr/include 47.endif 48COPTS= ${INCLUDES} ${IDENT} -D_KERNEL -include opt_global.h 49CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} 50 51# XXX LOCORE means "don't declare C stuff" not "for locore.s". 52ASM_CFLAGS= -x assembler-with-cpp -DLOCORE ${CFLAGS} 53 54# Select the correct set of tools. Can't set OBJFORMAT here because it 55# doesn't get exported into the environment, and if it were exported 56# then it might break building of utilities. 57FMT= -elf 58CFLAGS+= ${FMT} 59 60LOAD_ADDRESS?= C0100000 61DEFINED_PROF= ${PROF} 62.if defined(PROF) 63CFLAGS+= -malign-functions=4 64.if ${PROFLEVEL} >= 2 65IDENT+= -DGPROF4 -DGUPROF 66PROF+= -mprofiler-epilogue 67.endif 68.endif 69 70# Put configuration-specific C flags last (except for ${PROF}) so that they 71# can override the others. 72CFLAGS+= ${CONF_CFLAGS} 73 74NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} 75NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${.IMPSRC} 76NORMAL_S= ${CC} -c ${ASM_CFLAGS} ${.IMPSRC} 77PROFILE_C= ${CC} -c ${CFLAGS} ${.IMPSRC} 78 79GEN_CFILES= $S/$M/$M/genassym.c 80# setdef0.c and setdef1.c are intentionally 81# omitted from SYSTEM_CFILES. They include setdefs.h, a header which 82# is generated from all of ${OBJS}. We don't want to have to compile 83# everything just to do a make depend. 84SYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c 85SYSTEM_SFILES= $S/$M/$M/locore.s 86SYSTEM_DEP= Makefile ${SYSTEM_OBJS} 87SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o param.o config.o \ 88 setdef1.o hack.So 89SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/$M/conf/kernel.script \ 90 -export-dynamic -dynamic-linker /red/herring \ 91 -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o 92SYSTEM_LD_TAIL= @${SIZE} ${FMT} ${.TARGET} ; chmod 755 ${.TARGET} 93SYSTEM_DEP+= $S/$M/conf/kernel.script 94 95%BEFORE_DEPEND 96 97%OBJS 98 99%CFILES 100 101%SFILES 102 103%MFILES 104 105%CLEAN 106 107all: ${KERNEL} 108 109.if !defined(DEBUG) 110FULLKERNEL= ${KERNEL} 111.else 112FULLKERNEL= ${KERNEL}.debug 113${KERNEL}: ${FULLKERNEL} 114 objcopy --strip-debug ${FULLKERNEL} ${KERNEL} 115.endif 116 117${FULLKERNEL}: ${SYSTEM_DEP} vers.o 118 @rm -f ${.TARGET} 119 @echo linking ${.TARGET} 120 ${SYSTEM_LD} 121 ${SYSTEM_LD_TAIL} 122 123.if !exists(.depend) 124${SYSTEM_OBJS}: vnode_if.h ${BEFORE_DEPEND:M*.h} 125.endif 126 127clean: 128 rm -f *.o *.so *.So *.ko *.s eddep errs genassym \ 129 ${FULLKERNEL} ${KERNEL} linterrs makelinks param.c \ 130 setdef[01].c setdefs.h tags \ 131 vers.c vnode_if.c vnode_if.h ${CLEAN} 132 133#lint: /tmp param.c 134# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} \ 135# $S/$M/$M/Locore.c ${CFILES} ioconf.c param.c | \ 136# grep -v 'struct/union .* never defined' | \ 137# grep -v 'possible pointer alignment problem' 138 139locore.o: $S/$M/$M/locore.s assym.s 140 ${NORMAL_S} 141 142# This is a hack. BFD "optimizes" away dynamic mode if there are no 143# dynamic references. We could probably do a '-Bforcedynamic' mode like 144# in the a.out ld. For now, this works. 145hack.So: Makefile 146 touch hack.c 147 ${CC} ${FMT} -shared -nostdlib hack.c -o hack.So 148 rm -f hack.c 149 150.ORDER: setdefs.h setdef0.c setdef1.c 151 152setdef0.o: setdef0.c setdefs.h 153 ${NORMAL_C} 154 155setdef1.o: setdef1.c setdefs.h 156 ${NORMAL_C} 157 158setdef0.c setdef1.c setdefs.h: ${OBJS} 159 @gensetdefs ${OBJS} 160 161# this rule stops ./assym.s in .depend from causing problems 162./assym.s: assym.s 163 164assym.s: genassym.o 165 genassym genassym.o >assym.s 166 167genassym.o: $S/$M/$M/genassym.c 168 rm -f ./machine ; ln -s $S/$M/include ./machine 169 ${CC} -c ${CFLAGS} $S/$M/$M/genassym.c 170 171${SYSTEM_OBJS} genassym.o vers.o: opt_global.h 172 173depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} \ 174 ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} ${SFILES} ${SYSTEM_SFILES} 175 rm -f .newdep 176 mkdep -a -f .newdep ${CFLAGS} ${CFILES} ${SYSTEM_CFILES} ${GEN_CFILES} 177 env MKDEP_CPP="${CC} -E" \ 178 mkdep -a -f .newdep ${ASM_CFLAGS} ${SFILES} ${SYSTEM_SFILES} 179 rm -f .depend 180 mv -f .newdep .depend 181 182cleandepend: 183 rm -f .depend 184 185links: 186 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 187 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 188 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 189 sort -u | comm -23 - dontlink | \ 190 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 191 sh makelinks && rm -f dontlink 192 193tags: 194 @[ -f .depend ] || { echo "you must make depend first"; exit 1; } 195 sh $S/conf/systags.sh 196 rm -f tags1 197 sed -e 's, ../, ,' tags > tags1 198 199install install.debug: 200 @if [ ! -f ${KERNEL}${.TARGET:S/install//} ] ; then \ 201 echo "You must build a kernel first." ; \ 202 exit 1 ; \ 203 fi 204.if exists(${DESTDIR}/${KERNEL}) 205 -chflags noschg ${DESTDIR}/${KERNEL} 206 mv ${DESTDIR}/${KERNEL} ${DESTDIR}/${KERNEL}.old 207.endif 208 install -c -m 555 -o root -g wheel -fschg \ 209 ${KERNEL}${.TARGET:S/install//} ${DESTDIR}/${KERNEL} 210 211reinstall reinstall.debug: 212 install -c -m 555 -o root -g wheel -fschg \ 213 ${KERNEL}${.TARGET:S/reinstall//} ${DESTDIR}/${KERNEL} 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 236vnode_if.c: $S/kern/vnode_if.pl $S/kern/vnode_if.src 237 perl5 $S/kern/vnode_if.pl -c $S/kern/vnode_if.src 238 239vnode_if.h: $S/kern/vnode_if.pl $S/kern/vnode_if.src 240 perl5 $S/kern/vnode_if.pl -h $S/kern/vnode_if.src 241 242vnode_if.o: 243 ${NORMAL_C} 244 245# Commented out for now pending a better solution. 246# How do we pick up compiler version specific flags?? 247#.if exists($S/../share/mk) 248#.include "$S/../share/mk/bsd.kern.mk" 249#.else 250.include <bsd.kern.mk> 251#.endif 252 253%RULES 254 255# DO NOT DELETE THIS LINE -- make depend uses it 256