1# Copyright 1990 W. Jolitz 2# from: @(#)Makefile.i386 7.1 5/10/91 3# $Id: Makefile.i386,v 1.30 1994/08/23 04:21:21 jkh 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# -Wredundant-decls -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 -DNPX 47ASFLAGS= 48CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} 49LOAD_ADDRESS?= F0100000 50 51NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $< 52NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 53NORMAL_S= ${CPP} -I. -DLOCORE ${COPTS} $< | ${AS} ${ASFLAGS} -o $*.o 54DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $< 55DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 56SYSTEM_OBJS=locore.o exception.o swtch.o support.o ${OBJS} param.o \ 57 ioconf.o conf.o machdep.o vnode_if.o 58SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS} libkern.a 59SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ 60SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o libkern.a 61SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; \ 62 ${DBSYM} -fT ${LOAD_ADDRESS} $@; size $@; chmod 755 $@ 63 64# (XXX) ok, this is weird. but we've got a working ed, and a broken ex, and 65# the script is identical for either... -- cgd 66# 67GPROF.EX= /usr/src/lib/csu.i386/gprof.ex 68PROFILE_C= ${CC} -S -c ${CFLAGS} $< ; \ 69 ed - $*.s < ${GPROF.EX} ; \ 70 ${AS} -o $@ $*.s ; \ 71 rm -f $*.s 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 ln -s ${LIBKERN} libkern.a 96 echo ln -s ${LIBKERN} libkern.a 97 98${LIBKERN}: 99 @(cd $S/libkern; make) 100 101clean: 102 rm -f eddep *kernel tags *.o locore.i [a-uw-z]*.s \ 103 errs linterrs makelinks genassym ,assym.s stamp-assym 104 105#lint: /tmp param.c 106# @lint -hbxn -I. -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \ 107# ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \ 108# grep -v 'struct/union .* never defined' | \ 109# grep -v 'possible pointer alignment problem' 110 111symbols.sort: ${I386}/i386/symbols.raw 112 grep -v '^#' ${I386}/i386/symbols.raw \ 113 | sed 's/^ //' | sort -u > symbols.sort 114 115locore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \ 116 machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s \ 117 $S/sys/errno.h machine/specialreg.h \ 118 ${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h \ 119 machine/asmacros.h 120 ${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \ 121 ${AS} ${ASFLAGS} -o locore.o 122 123exception.o: assym.s ${I386}/i386/exception.s machine/trap.h \ 124 ${I386}/isa/vector.s ${I386}/isa/icu.s \ 125 $S/sys/errno.h ${I386}/isa/icu.h ${I386}/isa/isa.h vector.h \ 126 $S/net/netisr.h machine/asmacros.h 127 ${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/exception.s | \ 128 ${AS} ${ASFLAGS} -o exception.o 129 130swtch.o: assym.s ${I386}/i386/swtch.s \ 131 $S/sys/errno.h machine/asmacros.h 132 ${CPP} -I. ${COPTS} ${I386}/i386/swtch.s | \ 133 ${AS} ${ASFLAGS} -o swtch.o 134 135support.o: assym.s ${I386}/i386/support.s \ 136 $S/sys/errno.h machine/asmacros.h 137 ${CPP} -I. ${COPTS} ${I386}/i386/support.s | \ 138 ${AS} ${ASFLAGS} -o support.o 139 140machdep.o: ${I386}/i386/machdep.c Makefile 141 ${CC} -c ${CFLAGS} -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${PROF} $< 142 143# the following is necessary because autoconf.o depends on #if GENERIC 144autoconf.o: Makefile 145 146# depend on network configuration 147af.o uipc_proto.o locore.o: Makefile 148 149# depends on KDB (cons.o also depends on GENERIC) 150trap.o cons.o: Makefile 151 152assym.s: genassym 153 ./genassym >,assym.s 154 if cmp -s assym.s ,assym.s; then \ 155 rm -f ,assym.s; \ 156 else \ 157 rm -f assym.s; \ 158 mv ,assym.s assym.s; \ 159 fi 160 161# Some of the defines that genassym outputs may well depend on the 162# value of kernel options. 163genassym: Makefile 164 ${CC} ${INCLUDES} -DKERNEL ${IDENT} ${PARAM} \ 165 ${I386}/i386/genassym.c -static -o genassym 166 167depend: assym.s param.c vnode_if.h 168 sh /usr/bin/mkdep -DLOAD_ADDRESS=0x${LOAD_ADDRESS} ${COPTS} ${CFILES} ioconf.c param.c ${I386}/i386/conf.c 169 sh /usr/bin/mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c 170 171links: 172 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 173 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 174 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 175 sort -u | comm -23 - dontlink | \ 176 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 177 sh makelinks && rm -f dontlink 178 179tags: 180 @echo "see $S/kern/Makefile for tags" 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 186conf.o: ${I386}/i386/conf.c $S/sys/conf.h 187 ${CC} -c ${CFLAGS} ${I386}/i386/conf.c 188 189param.c: $S/conf/param.c 190 -rm -f param.c 191 cp $S/conf/param.c . 192 193param.o: param.c Makefile 194 ${CC} -c ${CFLAGS} ${PARAM} param.c 195 196vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 197 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 198 ${CC} ${CFLAGS} -c vers.c 199 200vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src 201 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 202vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 203 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 204 205%RULES 206 207# DO NOT DELETE THIS LINE -- make depend uses it 208 209