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.87 1996/08/31 14:47:08 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# 18CC?= cc 19CPP?= cpp 20LD?= /usr/bin/ld 21 22.if exists(./@/.) 23S= ./@ 24.else 25S= ../.. 26.endif 27I386= ${S}/i386 28 29CWARNFLAGS?= -W -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit \ 30 -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes \ 31 -Winline -Wunused -Wpointer-arith 32# 33# The following flags are next up for working on: 34# -Wall 35# 36# When working on removing warnings from code, the `-Werror' flag should be 37# of material assistance. 38# 39COPTFLAGS?=-O 40INCLUDES= -nostdinc -I- -I. -I$S 41# This hack is to allow kernel compiles to succeed on machines w/out srcdist 42.if exists($S/../include) 43INCLUDES+= -I$S/../include 44.else 45INCLUDES+= -I/usr/include 46.endif 47COPTS= ${INCLUDES} ${IDENT} -DKERNEL 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 LOCORE means "don't declare C stuff" not "for locore.s". 54NORMAL_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $< 55DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $< 56DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $< 57DRIVER_S= ${CC} -c -x assembler-with-cpp -DLOCORE ${COPTS} $< 58PROFILE_C= ${CC} -c ${CFLAGS} ${PARAM} $< 59 60SYSTEM_CFILES= ioconf.c param.c vnode_if.c config.c 61SYSTEM_SFILES= ${I386}/i386/locore.s 62SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} ioconf.o param.o config.o 63SYSTEM_DEP= Makefile symbols.exclude symbols.sort ${SYSTEM_OBJS} 64SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ 65SYSTEM_LD= @${LD} -Bstatic -Z -T ${LOAD_ADDRESS} -o $@ -X ${SYSTEM_OBJS} vers.o 66.if ${CFLAGS:M-g} == "" 67SYMORDER_EXCLUDE=-x symbols.exclude 68.endif 69SYSTEM_LD_TAIL= @echo rearranging symbols; \ 70 symorder -m ${SYMORDER_EXCLUDE} symbols.sort $@; \ 71 size $@; chmod 755 $@ 72 73%BEFORE_DEPEND 74 75%OBJS 76 77%CFILES 78 79%SFILES 80 81%LOAD 82 83%CLEAN 84 85clean: 86 rm -f *.o *.s eddep errs genassym kernel linterrs \ 87 makelinks param.c symbols.exclude symbols.sort tags \ 88 vers.c vnode_if.c vnode_if.h ${CLEAN} 89 90#lint: /tmp param.c 91# @lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} \ 92# ${I386}/i386/Locore.c ${CFILES} ioconf.c param.c | \ 93# grep -v 'struct/union .* never defined' | \ 94# grep -v 'possible pointer alignment problem' 95 96symbols.exclude: Makefile 97 echo "gcc2_compiled." >symbols.exclude 98 echo "___gnu_compiled_c" >>symbols.exclude 99 100symbols.sort: ${I386}/i386/symbols.raw 101 grep -v '^#' ${I386}/i386/symbols.raw \ 102 | sed 's/^ //' | sort -u > symbols.sort 103 104locore.o: ${I386}/i386/locore.s assym.s 105 ${NORMAL_S} 106 107# everything potentially depends on the Makefile since everything potentially 108# depends on the options. Some things are more dependent on the Makefile for 109# historical reasons. 110machdep.o: Makefile 111 112# the following is necessary because autoconf.o depends on #if GENERIC 113autoconf.o: Makefile 114 115# XXX - may no longer be needed 116locore.o: Makefile 117 118# depends on KDB (cons.o also depends on GENERIC) 119trap.o cons.o: Makefile 120 121# this rule stops ./assym.s in .depend from causing problems 122./assym.s: assym.s 123 124assym.s: genassym 125 ./genassym >assym.s 126 127# Some of the defines that genassym outputs may well depend on the 128# value of kernel options. 129genassym.o: ${I386}/i386/genassym.c Makefile 130 ${CC} -c ${CFLAGS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c 131 132genassym: genassym.o 133 ${CC} -static ${CFLAGS} ${PARAM} genassym.o -o $@ 134 135# XXX this assumes that the options for NORMAL_C* and DRIVER_C* are identical. 136depend: assym.s param.c vnode_if.h ${BEFORE_DEPEND} 137 rm -f .newdep 138 mkdep -a -f .newdep ${COPTS} ${CFILES} ${SYSTEM_CFILES} 139 mkdep -a -f .newdep ${COPTS} ${PARAM} -UKERNEL ${I386}/i386/genassym.c 140 MKDEP_CPP="${CPP}" ; export MKDEP_CPP ; \ 141 mkdep -a -f .newdep -DLOCORE ${COPTS} ${SFILES} ${SYSTEM_SFILES} 142 rm -f .depend 143 mv -f .newdep .depend 144 145links: 146 egrep '#if' ${CFILES:Nswapkernel.c} | sed -f $S/conf/defines | \ 147 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 148 echo ${CFILES:Nswapkernel.c} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 149 sort -u | comm -23 - dontlink | \ 150 sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks 151 sh makelinks && rm -f dontlink 152 153tags: 154 @echo "see $S/kern/Makefile for tags" 155 156install: 157 @if [ ! -f kernel ] ; then \ 158 echo "You must first build your kernel before trying to install." ; \ 159 exit 1 ; \ 160 fi 161 chflags noschg /kernel 162 mv /kernel /kernel.old 163 if [ `/usr/sbin/sysctl -n kern.bootfile` = /kernel ] ; then \ 164 /usr/sbin/sysctl -w kern.bootfile=/kernel.old ; \ 165 mv -f /var/db/kvm_kernel.db /var/db/kvm_kernel.old.db ; \ 166 fi 167 install -c -m 555 -o root -g wheel -fschg kernel / 168 169ioconf.o: ioconf.c $S/sys/param.h $S/sys/buf.h \ 170 ${I386}/isa/isa_device.h ${I386}/isa/isa.h ${I386}/isa/icu.h 171 ${CC} -c ${CFLAGS} ioconf.c 172 173param.c: $S/conf/param.c 174 -rm -f param.c 175 cp $S/conf/param.c . 176 177param.o: param.c Makefile 178 ${CC} -c ${CFLAGS} ${PARAM} param.c 179 180vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 181 sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT} 182 ${CC} ${CFLAGS} -c vers.c 183 184vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src 185 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 186vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src 187 sh $S/kern/vnode_if.sh $S/kern/vnode_if.src 188 189%RULES 190 191# DO NOT DELETE THIS LINE -- make depend uses it 192