1# Copyright 1990 W. Jolitz 2# from: @(#)Makefile.i386 7.1 5/10/91 3# $Id: Makefile.i386,v 1.51 1994/11/27 14:26:16 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# 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 29.if exists(./@/.) 30S= ./@ 31.else 32S= ../.. 33.endif 34I386= ${S}/i386 35 36CWARNFLAGS?=-W -Wreturn-type -Wcomment -Wredundant-decls 37# 38# The following flags are next up for working on: 39# -Wimplicit -Wnested-externs 40# 41# When working on removing warnings from code, the `-Werror' flag should be 42# of material assistance. 43# 44COPTFLAGS?=-O 45INCLUDES= -I. -I$S -I$S/sys 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.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 68SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \ 69 ${DBSYM} -fT ${LOAD_ADDRESS} $@; size $@; chmod 755 $@ 70 71%BEFORE_DEPEND 72 73%OBJS 74 75%CFILES 76 77%LOAD 78 79# This is slightly different from before in that if you define PROF 80# to anything, it will assume profiling. Don't do "PROF=" to turn 81# profiling off! 82.if exists($S/libkern/obj) 83LIBKERNP=$S/libkern/obj 84.else 85LIBKERNP=$S/libkern 86.endif 87 88.if defined(PROF) 89LIBKERN=${LIBKERNP}/libkern_p.a 90.else 91LIBKERN=${LIBKERNP}/libkern.a 92.endif 93 94libkern.a: ${LIBKERN} 95 @rm -f libkern.a 96 ln -s ${LIBKERN} libkern.a 97 98${LIBKERN}: 99 @(cd $S/libkern; make) 100 101clean: 102 rm -f eddep kernel tags *.o *.s errs linterrs makelinks genassym 103 104#lint: /tmp param.c 105# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \ 106# ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \ 107# grep -v 'struct/union .* never defined' | \ 108# grep -v 'possible pointer alignment problem' 109 110symbols.sort: ${I386}/i386/symbols.raw 111 grep -v '^#' ${I386}/i386/symbols.raw \ 112 | sed 's/^ //' | sort -u > symbols.sort 113 114locore.o: ${I386}/i386/locore.s assym.s 115 ${NORMAL_S} 116 117# everything potentially depends on the Makefile since everything potentially 118# depends on the options. Some things are more dependent on the Makefile for 119# historical reasons. 120machdep.o: Makefile 121 122# the following is necessary because autoconf.o depends on #if GENERIC 123autoconf.o: Makefile 124 125# depend on network configuration 126af.o uipc_proto.o locore.o: Makefile 127 128# depends on KDB (cons.o also depends on GENERIC) 129trap.o cons.o: Makefile 130 131# this rule stops ./assym.s in .depend from causing problems 132./assym.s: assym.s 133 134assym.s: genassym 135 ./genassym >assym.s 136 137# Some of the defines that genassym outputs may well depend on the 138# value of kernel options. 139genassym.o: ${I386}/i386/genassym.c Makefile 140 ${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c 141 142genassym: genassym.o 143 ${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@ 144 145# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical. 146depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} 147 mkdep ${COPTS} ${CFILES} ${SYSTEM_CFILES} 148 mkdep -a ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c 149 MKDEP_CPP=${CPP} ; export MKDEP_CPP ; \ 150 mkdep -a -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES} 151 152links: 153 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 154 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 155 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 156 sort -u | comm -23 - dontlink | \ 157 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 158 sh makelinks && rm -f dontlink 159 160tags: 161 @echo "see $S/kern/Makefile for tags" 162 163install: 164 chflags noschg /kernel 165 mv /kernel /kernel.old 166 install -c -m 555 -o root -g wheel -fschg kernel / 167 168ioconf.o: ioconf.c $S/sys/param.h machine/pte.h $S/sys/buf.h \ 169 ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h 170 ${CC} -c ${CFLAGS} ioconf.c 171 172param.c: $S/conf/param.c 173 -rm -f param.c 174 cp $S/conf/param.c . 175 176param.o: param.c Makefile 177 ${CC} -c ${CFLAGS} ${PARAM} param.c 178 179vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 180 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 181 ${CC} ${CFLAGS} -c vers.c 182 183vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src 184 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 185vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 186 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 187 188%RULES 189 190# DO NOT DELETE THIS LINE -- make depend uses it 191