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