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