1# Copyright 1990 W. Jolitz 2# from: @(#)Makefile.i386 7.1 5/10/91 3# $Id: Makefile.i386,v 1.68 1995/10/30 20:20:49 guido 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 30# 31# The following flags are next up for working on: 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} $< 58DRIVER_S= ${CPP} -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o 59PROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $< 60 61SYSTEM_CFILES= ioconf.c param.c vnode_if.c 62SYSTEM_SFILES= ${I386}/i386/locore.s 63SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o 64SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} libkern.a 65SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ 66SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a 67.if ${CFLAGS:M-g} == "" 68SYMORDER_EXCLUDE=-x symbols.exclude 69.endif 70SYSTEM_LD_TAIL= @echo rearranging symbols; \ 71 symorder -m ${SYMORDER_EXCLUDE} symbols.sort $@; \ 72 size $@; chmod 755 $@ 73 74%BEFORE_DEPEND 75 76%OBJS 77 78%CFILES 79 80%SFILES 81 82%LOAD 83 84%CLEAN 85 86# This is slightly different from before in that if you define PROF 87# to anything, it will assume profiling. Don't do "PROF=" to turn 88# profiling off! 89.if exists($S/libkern/obj) 90LIBKERNP=$S/libkern/obj 91.else 92LIBKERNP=$S/libkern 93.endif 94 95.if defined(PROF) 96LIBKERN=${LIBKERNP}/libkern_p.a 97.else 98LIBKERN=${LIBKERNP}/libkern.a 99.endif 100 101libkern.a: ${LIBKERN} 102 @rm -f libkern.a 103 ln -s ${LIBKERN} libkern.a 104 105${LIBKERN}: 106 @(cd $S/libkern; make) 107 108clean: 109 rm -f *.o *.s eddep errs genassym kernel libkern.a linterrs \ 110 makelinks param.c symbols.exclude symbols.sort tags \ 111 vers.c vnode_if.c vnode_if.h ${CLEAN} 112 113#lint: /tmp param.c 114# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \ 115# ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \ 116# grep -v 'struct/union .* never defined' | \ 117# grep -v 'possible pointer alignment problem' 118 119symbols.exclude: Makefile 120 echo "gcc2_compiled." >symbols.exclude 121 echo "___gnu_compiled_c" >>symbols.exclude 122 123symbols.sort: ${I386}/i386/symbols.raw 124 grep -v '^#' ${I386}/i386/symbols.raw \ 125 | sed 's/^ //' | sort -u > symbols.sort 126 127locore.o: ${I386}/i386/locore.s assym.s 128 ${NORMAL_S} 129 130# everything potentially depends on the Makefile since everything potentially 131# depends on the options. Some things are more dependent on the Makefile for 132# historical reasons. 133machdep.o: Makefile 134 135# the following is necessary because autoconf.o depends on #if GENERIC 136autoconf.o: Makefile 137 138# depend on network configuration 139af.o uipc_proto.o locore.o: Makefile 140 141# depends on KDB (cons.o also depends on GENERIC) 142trap.o cons.o: Makefile 143 144# this rule stops ./assym.s in .depend from causing problems 145./assym.s: assym.s 146 147assym.s: genassym 148 ./genassym >assym.s 149 150# Some of the defines that genassym outputs may well depend on the 151# value of kernel options. 152genassym.o: ${I386}/i386/genassym.c Makefile 153 ${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c 154 155genassym: genassym.o 156 ${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@ 157 158# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical. 159depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} 160 mkdep ${COPTS} ${CFILES} ${SYSTEM_CFILES} 161 mkdep -a ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c 162 MKDEP_CPP=${CPP} ; export MKDEP_CPP ; \ 163 mkdep -a -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES} 164 165links: 166 egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \ 167 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 168 echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 169 sort -u | comm -23 - dontlink | \ 170 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 171 sh makelinks && rm -f dontlink 172 173tags: 174 @echo "see $S/kern/Makefile for tags" 175 176install: 177 chflags noschg /kernel 178 mv /kernel /kernel.old 179 sysctl -w kern.bootfile=/kernel.old 180 install -c -m 555 -o root -g wheel -fschg kernel / 181 182ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \ 183 ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h 184 ${CC} -c ${CFLAGS} ioconf.c 185 186param.c: $S/conf/param.c 187 -rm -f param.c 188 cp $S/conf/param.c . 189 190param.o: param.c Makefile 191 ${CC} -c ${CFLAGS} ${PARAM} param.c 192 193vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 194 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 195 ${CC} ${CFLAGS} -c vers.c 196 197vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src 198 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 199vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 200 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 201 202%RULES 203 204# DO NOT DELETE THIS LINE -- make depend uses it 205