Makefile.i386 revision 3343
1# Copyright 1990 W. Jolitz 2# from: @(#)Makefile.i386 7.1 5/10/91 3# $Id: Makefile.i386,v 1.44 1994/10/03 18:51:35 phk Exp $ 4# 5# Makefile for FreeBSD 6# 7# This makefile is constructed from a machine description: 8# config machineid 9# Most changes should be made in the machine description 10# /sys/i386/conf/``machineid'' 11# after which you should do 12# config machineid 13# Generic makefile changes should be made in 14# /sys/i386/conf/Makefile.i386 15# after which config should be rerun for all machines. 16# 17# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE INVISIBLE TO MAKEFILE 18# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING 19# 20# -DTRACE compile in kernel tracing hooks 21# -DQUOTA compile in file system quotas 22# 23TOUCH= touch -f -c 24LD= /usr/bin/ld 25CC= cc 26CPP= cpp 27DBSYM= /usr/sbin/dbsym 28.if defined(DEBUG) 29.if defined(NOSTRIP) 30STRIP= echo '(skipping) strip' 31.else 32STRIP= cp $@ $@.sym; strip 33.endif 34.else 35STRIP= strip 36.endif 37 38.if exists(./@/.) 39S= ./@ 40.else 41S= ../.. 42.endif 43I386= ${S}/i386 44 45.if !defined(CWARNFLAGS) 46CWARNFLAGS=-W -Wreturn-type -Wcomment -Wredundant-decls 47.endif 48# 49# The following flag is next up for working on: 50# -Wnested-externs 51# 52# When working on removing warnings from code, the `-Werror' flag should be 53# of material assistance. 54# 55.if !defined(COPTFLAGS) 56COPTFLAGS=-O 57.endif 58INCLUDES= -I. -I$S -I$S/sys 59COPTS= ${INCLUDES} ${IDENT} -DKERNEL -Di386 -DLOAD_ADDRESS=0x${LOAD_ADDRESS} 60ASFLAGS= 61CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} 62LOAD_ADDRESS?= F0100000 63 64NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $< 65NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 66# XXX errors leak out of all the pipes. Should use cc *.S. 67# XXX LOCORE means "don't declare C stuff" not "for locore.s". 68NORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o 69DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $< 70DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 71 72SFILES= ${I386}/i386/exception.s ${I386}/i386/microtime.s \ 73 ${I386}/i386/support.s ${I386}/i386/swtch.s ${I386}/apm/apm_setup.s 74SYSTEM_CFILES= ioconf.c param.c vnode_if.c 75SYSTEM_SFILES= ${I386}/i386/locore.s 76SYSTEM_OBJS=locore.o vnode_if.o ${OBJS} ioconf.o param.o 77SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a 78SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ 79SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a 80SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \ 81 ${DBSYM} -fT ${LOAD_ADDRESS} $@; ${STRIP} -x $@; size $@; chmod 755 $@ 82 83# (XXX) ok, this is weird. but we've got a working ed, and a broken ex, and 84# the script is identical for either... -- cgd 85# 86GPROF.EX= /usr/src/lib/csu.i386/gprof.ex 87PROFILE_C= ${CC} -S -c ${CFLAGS} $< ; \ 88 ed - $*.s < ${GPROF.EX} ; \ 89 ${AS} -o $@ $*.s ; \ 90 rm -f $*.s 91 92%OBJS 93 94%CFILES 95 96%LOAD 97 98# This is slightly different from before in that if you define PROF 99# to anything, it will assume profiling. Don't do "PROF=" to turn 100# profiling off! 101.if exists($S/libkern/obj) 102LIBKERNP=$S/libkern/obj 103.else 104LIBKERNP=$S/libkern 105.endif 106 107.if defined(PROF) 108LIBKERN=${LIBKERNP}/libkern_p.a 109.else 110LIBKERN=${LIBKERNP}/libkern.a 111.endif 112 113libkern.a: ${LIBKERN} 114 @rm -f libkern.a 115 ln -s ${LIBKERN} libkern.a 116 117${LIBKERN}: 118 @(cd $S/libkern; make) 119 120clean: 121 rm -f eddep *kernel tags *.o locore.i [a-uw-z]*.s \ 122 errs linterrs makelinks genassym ,assym.s stamp-assym 123 124#lint: /tmp param.c 125# @lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \ 126# ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \ 127# grep -v 'struct/union .* never defined' | \ 128# grep -v 'possible pointer alignment problem' 129 130symbols.sort: ${I386}/i386/symbols.raw 131 grep -v '^#' ${I386}/i386/symbols.raw \ 132 | sed 's/^ //' | sort -u > symbols.sort 133 134locore.o: ${I386}/i386/locore.s assym.s 135 ${NORMAL_S} 136 137# everything potentially depends on the Makefile since everything potentially 138# depends on the options. Some things are more dependent on the Makefile for 139# historical reasons. 140machdep.o: Makefile 141 142# the following is necessary because autoconf.o depends on #if GENERIC 143autoconf.o: Makefile 144 145# depend on network configuration 146af.o uipc_proto.o locore.o: Makefile 147 148# depends on KDB (cons.o also depends on GENERIC) 149trap.o cons.o: Makefile 150 151# this rule stops ./assym.s in .depend from causing problems 152./assym.s: assym.s 153 154assym.s: genassym 155 ./genassym >,assym.s 156 if cmp -s assym.s ,assym.s; then \ 157 rm -f ,assym.s; \ 158 else \ 159 rm -f assym.s; \ 160 mv ,assym.s assym.s; \ 161 fi 162 163# Some of the defines that genassym outputs may well depend on the 164# value of kernel options. 165genassym: Makefile 166 ${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \ 167 ${I386}/i386/genassym.c -static -o genassym 168 169# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical. 170depend: assym.s param.c vnode_if.h 171 mkdep ${COPTS} ${CFILES} ${SYSTEM_CFILES} 172 mkdep -a -p ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \ 173 ${I386}/i386/genassym.c 174 MKDEP_CPP=${CPP} ; export MKDEP_CPP ; \ 175 mkdep -a -I. -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES} 176 177links: 178 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 179 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 180 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 181 sort -u | comm -23 - dontlink | \ 182 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 183 sh makelinks && rm -f dontlink 184 185tags: 186 @echo "see $S/kern/Makefile for tags" 187 188install: 189 chflags noschg /kernel 190 mv /kernel /kernel.old 191 install -c -m 555 -o root -g wheel -fschg kernel / 192 193ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \ 194 ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h 195 ${CC} -c ${CFLAGS} ioconf.c 196 197param.c: $S/conf/param.c 198 -rm -f param.c 199 cp $S/conf/param.c . 200 201param.o: param.c Makefile 202 ${CC} -c ${CFLAGS} ${PARAM} param.c 203 204vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 205 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 206 ${CC} ${CFLAGS} -c vers.c 207 208vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src 209 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 210vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 211 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 212 213%RULES 214 215# DO NOT DELETE THIS LINE -- make depend uses it 216