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