1# Copyright 1990 W. Jolitz 2# from: @(#)Makefile.i386 7.1 5/10/91 3# $Id: Makefile.i386,v 1.65 1995/07/22 23:55:41 bde 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} $< 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 *.o *.s eddep errs genassym kernel libkern.a linterrs \ 109 makelinks param.c symbols.exclude symbols.sort tags \ 110 vers.c vnode_if.c vnode_if.h ${CLEAN} 111 112#lint: /tmp param.c 113# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \ 114# ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \ 115# grep -v 'struct/union .* never defined' | \ 116# grep -v 'possible pointer alignment problem' 117 118symbols.exclude: Makefile 119 echo "gcc2_compiled." >symbols.exclude 120 echo "___gnu_compiled_c" >>symbols.exclude 121 122symbols.sort: ${I386}/i386/symbols.raw 123 grep -v '^#' ${I386}/i386/symbols.raw \ 124 | sed 's/^ //' | sort -u > symbols.sort 125 126locore.o: ${I386}/i386/locore.s assym.s 127 ${NORMAL_S} 128 129# everything potentially depends on the Makefile since everything potentially 130# depends on the options. Some things are more dependent on the Makefile for 131# historical reasons. 132machdep.o: Makefile 133 134# the following is necessary because autoconf.o depends on #if GENERIC 135autoconf.o: Makefile 136 137# depend on network configuration 138af.o uipc_proto.o locore.o: Makefile 139 140# depends on KDB (cons.o also depends on GENERIC) 141trap.o cons.o: Makefile 142 143# this rule stops ./assym.s in .depend from causing problems 144./assym.s: assym.s 145 146assym.s: genassym 147 ./genassym >assym.s 148 149# Some of the defines that genassym outputs may well depend on the 150# value of kernel options. 151genassym.o: ${I386}/i386/genassym.c Makefile 152 ${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c 153 154genassym: genassym.o 155 ${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@ 156 157# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical. 158depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} 159 mkdep ${COPTS} ${CFILES} ${SYSTEM_CFILES} 160 mkdep -a ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c 161 MKDEP_CPP=${CPP} ; export MKDEP_CPP ; \ 162 mkdep -a -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES} 163 164links: 165 egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \ 166 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 167 echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 168 sort -u | comm -23 - dontlink | \ 169 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 170 sh makelinks && rm -f dontlink 171 172tags: 173 @echo "see $S/kern/Makefile for tags" 174 175install: 176 chflags noschg /kernel 177 mv /kernel /kernel.old 178 install -c -m 555 -o root -g wheel -fschg kernel / 179 180ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \ 181 ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h 182 ${CC} -c ${CFLAGS} ioconf.c 183 184param.c: $S/conf/param.c 185 -rm -f param.c 186 cp $S/conf/param.c . 187 188param.o: param.c Makefile 189 ${CC} -c ${CFLAGS} ${PARAM} param.c 190 191vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 192 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 193 ${CC} ${CFLAGS} -c vers.c 194 195vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src 196 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 197vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 198 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 199 200%RULES 201 202# DO NOT DELETE THIS LINE -- make depend uses it 203