1# Makefile.i386 -- with config changes. 2# Copyright 1990 W. Jolitz 3# from: @(#)Makefile.i386 7.1 5/10/91 4# $Id: Makefile.i386,v 1.100 1997/06/29 16:39:09 bde Exp $ 5# 6# Makefile for FreeBSD 7# 8# This makefile is constructed from a machine description: 9# config machineid 10# Most changes should be made in the machine description 11# /sys/i386/conf/``machineid'' 12# after which you should do 13# config machineid 14# Generic makefile changes should be made in 15# /sys/i386/conf/Makefile.i386 16# after which config should be rerun for all machines. 17# 18 19BINFORMAT?= aout 20#BINFORMAT?= aoutkld 21#BINFORMAT?= elf 22 23STD8X16FONT?= iso 24 25.if exists(./@/.) 26S= ./@ 27.else 28S= ../.. 29.endif 30I386= ${S}/i386 31 32COPTFLAGS?=-O 33INCLUDES= -nostdinc -I- -I. -I$S 34# This hack is to allow kernel compiles to succeed on machines w/out srcdist 35.if exists($S/../include) 36INCLUDES+= -I$S/../include 37.else 38INCLUDES+= -I/usr/include 39.endif 40COPTS= ${INCLUDES} ${IDENT} -DKERNEL -include opt_global.h 41CFLAGS= ${COPTFLAGS} ${CWARNFLAGS} ${DEBUG} ${COPTS} 42LOAD_ADDRESS?= F0100000 43DEFINED_PROF= ${PROF} 44.if defined(PROF) 45CFLAGS+= -malign-functions=4 46.if ${PROFLEVEL} >= 2 47IDENT+= -DGPROF4 -DGUPROF 48PROF+= -mprofiler-epilogue 49.endif 50.endif 51 52NORMAL_C= ${CC} -c ${CFLAGS} ${PROF} $< 53NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 54# XXX LOCORE means "don't declare C stuff" not "for locore.s". 55NORMAL_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $< 56DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $< 57DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 58DRIVER_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $< 59PROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $< 60 61# ${I386}/i386/setdef0.c and ${I386}/i386/setdef1.c are intentionally 62# omitted from SYSTEM_CFILES. They depend on setdefs.h, a header which 63# is generated from all of ${OBJS}. We don't want to have to compile 64# everything just to do a make depend. 65SYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c 66SYSTEM_SFILES= ${I386}/i386/locore.s 67SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} 68.if ${CFLAGS:M-g} == "" 69SYMORDER_EXCLUDE=-x symbols.exclude 70.endif 71SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ 72.if ${BINFORMAT} == aout 73SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o 74SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o 75SYSTEM_LD_TAIL= @echo rearranging symbols; \ 76 symorder -m ${SYMORDER_EXCLUDE} symbols.sort $@; \ 77 size $@; chmod 755 $@ 78.endif 79.if ${BINFORMAT} == aoutkld 80SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o 81SYSTEM_LD= @${LD} -Bforcedynamic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o 82SYSTEM_LD_TAIL= @echo rearranging symbols; \ 83 symorder -m ${SYMORDER_EXCLUDE} symbols.sort $@; \ 84 size $@; chmod 755 $@ 85.endif 86.if ${BINFORMAT} == elf 87SYSTEM_OBJS= locore.o setdef0.o vnode_if.o ${OBJS} ioconf.o param.o config.o \ 88 setdef1.o 89SYSTEM_LD= @${LD} -Bstatic -Ttext ${LOAD_ADDRESS} -e btext -defsym _DYNAMIC=0 \ 90 -o $@ -X ${SYSTEM_OBJS} vers.o 91SYSTEM_LD_TAIL= @size $@; chmod 755 $@ 92.endif 93 94%BEFORE_DEPEND 95 96%OBJS 97 98%CFILES 99 100%SFILES 101 102%LOAD 103 104%CLEAN 105 106clean: 107 rm -f *.o *.s eddep errs genassym gensetdefs kernel linterrs \ 108 makelinks param.c setdefs.h symbols.exclude symbols.sort tags \ 109 vers.c vnode_if.c vnode_if.h ${CLEAN} 110 111#lint: /tmp param.c 112# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \ 113# ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \ 114# grep -v 'struct/union .* never defined' | \ 115# grep -v 'possible pointer alignment problem' 116 117symbols.exclude: Makefile 118 echo "gcc2_compiled." >symbols.exclude 119 echo "___gnu_compiled_c" >>symbols.exclude 120 121symbols.sort: ${I386}/i386/symbols.raw 122 grep -v '^#' ${I386}/i386/symbols.raw \ 123 | sed 's/^ //' | sort -u > symbols.sort 124 125locore.o: ${I386}/i386/locore.s assym.s 126 ${NORMAL_S} 127 128setdef0.o: ${I386}/i386/setdef0.c setdefs.h 129 ${NORMAL_C} 130 131setdef1.o: ${I386}/i386/setdef1.c setdefs.h 132 ${NORMAL_C} 133 134setdefs.h: gensetdefs ${OBJS} 135 ./gensetdefs ${OBJS} >setdefs.h 136 137gensetdefs: gensetdefs.o 138 ${CC} ${CFLAGS} gensetdefs.o -o $@ 139 140gensetdefs.o: ${I386}/i386/gensetdefs.c 141 ${CC} -c ${CFLAGS} ${I386}/i386/gensetdefs.c 142 143# everything potentially depends on the Makefile since everything potentially 144# depends on the options. Some things are more dependent on the Makefile for 145# historical reasons. 146machdep.o: Makefile 147 148# the following is necessary because autoconf.o depends on #if GENERIC 149autoconf.o: Makefile 150 151# XXX - may no longer be needed 152locore.o: Makefile 153 154# depends on KDB (cons.o also depends on GENERIC) 155trap.o cons.o: Makefile 156 157# this rule stops ./assym.s in .depend from causing problems 158./assym.s: assym.s 159 160assym.s: genassym 161 ./genassym >assym.s 162 163# Some of the defines that genassym outputs may well depend on the 164# value of kernel options. 165genassym.o: ${I386}/i386/genassym.c Makefile opt_global.h 166 ${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c 167 168genassym: genassym.o 169 ${CC} ${CFLAGS} ${PARAM} genassym.o -o $@ 170 171${OBJS}: opt_global.h 172 173# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical. 174depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} 175 rm -f .newdep 176 mkdep -a -f .newdep ${COPTS} ${CFILES} ${SYSTEM_CFILES} 177 mkdep -a -f .newdep ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c 178 MKDEP_CPP="${CC} -E -x assembler-with-cpp" ; export MKDEP_CPP ; \ 179 mkdep -a -f .newdep -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES} 180 rm -f .depend 181 mv -f .newdep .depend 182 183links: 184 egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \ 185 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 186 echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 187 sort -u | comm -23 - dontlink | \ 188 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 189 sh makelinks && rm -f dontlink 190 191tags: 192 @echo "see $S/kern/Makefile for tags" 193 194install: 195 @if [ ! -f kernel ] ; then \ 196 echo "You must first build your kernel before trying to install." ; \ 197 exit 1 ; \ 198 fi 199 chflags noschg /kernel 200 mv /kernel /kernel.old 201 if [ `/usr/sbin/sysctl -n kern.bootfile` = /kernel ] ; then \ 202 /usr/sbin/sysctl -w kern.bootfile=/kernel.old ; \ 203 mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \ 204 fi 205 install -c -m 555 -o root -g wheel -fschg kernel / 206 207ioconf.o: ioconf.c $S/sys/param.h $S/sys/buf.h \ 208 ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h 209 ${CC} -c ${CFLAGS} ioconf.c 210 211param.c: $S/conf/param.c 212 -rm -f param.c 213 cp $S/conf/param.c . 214 215param.o: param.c Makefile 216 ${CC} -c ${CFLAGS} ${PARAM} param.c 217 218vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 219 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 220 ${CC} ${CFLAGS} -c vers.c 221 222vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src 223 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 224vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 225 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 226 227.include <bsd.kern.mk> 228 229%RULES 230 231# DO NOT DELETE THIS LINE -- make depend uses it 232