1# Copyright 1990 W. Jolitz 2# from: @(#)Makefile.i386 7.1 5/10/91 3# $Id: Makefile.i386,v 1.62 1995/04/05 04:10:58 nate 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# 17CC?= cc 18CPP?= cpp 19LD?= /usr/bin/ld 20 21.if exists(./@/.) 22S= ./@ 23.else 24S= ../.. 25.endif 26I386= ${S}/i386 27 28CWARNFLAGS?=-W -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit 29# 30# The following flags are next up for working on: 31# -Wnested-externs (almost works) 32# -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations 33# 34# When working on removing warnings from code, the `-Werror' flag should be 35# of material assistance. 36# 37COPTFLAGS?=-O 38# Not ready for -I- yet. #include "foo.h" where foo.h is in the srcdir fails. 39INCLUDES= -nostdinc -I. -I$S -I$S/sys 40# This hack is to allow kernel compiles to succeed on machines w/out srcdist 41.if exists($S/../include) 42INCLUDES+= -I$S/../include 43.else 44INCLUDES+= -I/usr/include 45.endif 46COPTS= ${INCLUDES} ${IDENT} -DKERNEL -Di386 -DLOAD_ADDRESS=0x${LOAD_ADDRESS} 47ASFLAGS= 48CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} 49LOAD_ADDRESS?= F0100000 50 51NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $< 52NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 53# XXX errors leak out of all the pipes. Should use cc *.S. 54# XXX LOCORE means "don't declare C stuff" not "for locore.s". 55NORMAL_S= ${CPP} -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o 56DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $< 57DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 58PROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $< 59 60SFILES= ${I386}/i386/exception.s ${I386}/i386/microtime.s \ 61 ${I386}/i386/support.s ${I386}/i386/swtch.s ${I386}/apm/apm_setup.s 62SYSTEM_CFILES= ioconf.c param.c vnode_if.c 63SYSTEM_SFILES= ${I386}/i386/locore.s 64SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o 65SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} libkern.a 66SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ 67SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a 68.if ${CFLAGS:M-g} == "" 69SYMORDER_EXCLUDE=-x symbols.exclude 70.endif 71SYSTEM_LD_TAIL= @echo rearranging symbols; \ 72 symorder -m ${SYMORDER_EXCLUDE} symbols.sort $@; \ 73 size $@; chmod 755 $@ 74 75%BEFORE_DEPEND 76 77%OBJS 78 79%CFILES 80 81%LOAD 82 83%CLEAN 84 85# This is slightly different from before in that if you define PROF 86# to anything, it will assume profiling. Don't do "PROF=" to turn 87# profiling off! 88.if exists($S/libkern/obj) 89LIBKERNP=$S/libkern/obj 90.else 91LIBKERNP=$S/libkern 92.endif 93 94.if defined(PROF) 95LIBKERN=${LIBKERNP}/libkern_p.a 96.else 97LIBKERN=${LIBKERNP}/libkern.a 98.endif 99 100libkern.a: ${LIBKERN} 101 @rm -f libkern.a 102 ln -s ${LIBKERN} libkern.a 103 104${LIBKERN}: 105 @(cd $S/libkern; make) 106 107clean: 108 rm -f eddep kernel tags *.o *.s errs linterrs makelinks genassym \ 109 symbols.exclude symbols.sort ${CLEAN} 110 111#lint: /tmp param.c 112# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \ 113# ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \ 114# grep -v 'struct/union .* never defined' | \ 115# grep -v 'possible pointer alignment problem' 116 117symbols.exclude: Makefile 118 echo "gcc2_compiled." >symbols.exclude 119 echo "___gnu_compiled_c" >>symbols.exclude 120 121symbols.sort: ${I386}/i386/symbols.raw 122 grep -v '^#' ${I386}/i386/symbols.raw \ 123 | sed 's/^ //' | sort -u > symbols.sort 124 125locore.o: ${I386}/i386/locore.s assym.s 126 ${NORMAL_S} 127 128# everything potentially depends on the Makefile since everything potentially 129# depends on the options. Some things are more dependent on the Makefile for 130# historical reasons. 131machdep.o: Makefile 132 133# the following is necessary because autoconf.o depends on #if GENERIC 134autoconf.o: Makefile 135 136# depend on network configuration 137af.o uipc_proto.o locore.o: Makefile 138 139# depends on KDB (cons.o also depends on GENERIC) 140trap.o cons.o: Makefile 141 142# this rule stops ./assym.s in .depend from causing problems 143./assym.s: assym.s 144 145assym.s: genassym 146 ./genassym >assym.s 147 148# Some of the defines that genassym outputs may well depend on the 149# value of kernel options. 150genassym.o: ${I386}/i386/genassym.c Makefile 151 ${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c 152 153genassym: genassym.o 154 ${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@ 155 156# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical. 157depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} 158 mkdep ${COPTS} ${CFILES} ${SYSTEM_CFILES} 159 mkdep -a ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c 160 MKDEP_CPP=${CPP} ; export MKDEP_CPP ; \ 161 mkdep -a -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES} 162 163links: 164 egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \ 165 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 166 echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 167 sort -u | comm -23 - dontlink | \ 168 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 169 sh makelinks && rm -f dontlink 170 171tags: 172 @echo "see $S/kern/Makefile for tags" 173 174install: 175 chflags noschg /kernel 176 mv /kernel /kernel.old 177 install -c -m 555 -o root -g wheel -fschg kernel / 178 179ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \ 180 ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h 181 ${CC} -c ${CFLAGS} ioconf.c 182 183param.c: $S/conf/param.c 184 -rm -f param.c 185 cp $S/conf/param.c . 186 187param.o: param.c Makefile 188 ${CC} -c ${CFLAGS} ${PARAM} param.c 189 190vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 191 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 192 ${CC} ${CFLAGS} -c vers.c 193 194vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src 195 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 196vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 197 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 198 199%RULES 200 201# DO NOT DELETE THIS LINE -- make depend uses it 202