Makefile.i386 revision 1.90
1# $NetBSD: Makefile.i386,v 1.90 1998/04/12 23:47:43 tv Exp $ 2 3# Makefile for NetBSD 4# 5# This makefile is constructed from a machine description: 6# config machineid 7# Most changes should be made in the machine description 8# /sys/arch/i386/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/i386/conf/Makefile.i386 13# after which config should be rerun for all machines of that type. 14# 15# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE 16# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING 17# 18# -DTRACE compile in kernel tracing hooks 19# -DQUOTA compile in file system quotas 20 21# DEBUG is set to -g if debugging. 22# PROF is set to -pg if profiling. 23 24AR?= ar 25AS?= as 26CC?= cc 27CPP?= cpp 28LD?= ld 29LORDER?=lorder 30MKDEP?= mkdep 31NM?= nm 32RANLIB?=ranlib 33SIZE?= size 34STRIP?= strip 35TSORT?= tsort -q 36 37COPTS?= -O2 38 39# source tree is located via $S relative to the compilation directory 40.ifndef S 41S!= cd ../../../..; pwd 42.endif 43I386= $S/arch/i386 44 45HAVE_GCC28!= ${CC} --version | egrep "^(2\.8|egcs)" ; echo 46INCLUDES= -I. -I$S/arch -I$S -nostdinc 47CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \ 48 -Di386 49CWARNFLAGS?= -Werror -Wall -Wmissing-prototypes -Wstrict-prototypes 50.if (${HAVE_GCC28} != "") 51CWARNFLAGS+= -Wno-main 52.endif 53CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} 54AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 55LINKFLAGS= -z -Ttext F0100000 -e start 56STRIPFLAGS= -d 57 58### find out what to use for libkern 59.include "$S/lib/libkern/Makefile.inc" 60.ifndef PROF 61LIBKERN= ${KERNLIB} 62.else 63LIBKERN= ${KERNLIB_PROF} 64.endif 65 66### find out what to use for libcompat 67.include "$S/compat/common/Makefile.inc" 68.ifndef PROF 69LIBCOMPAT= ${COMPATLIB} 70.else 71LIBCOMPAT= ${COMPATLIB_PROF} 72.endif 73 74# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 75# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 76 77NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 78NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 79 80%OBJS 81 82%CFILES 83 84%SFILES 85 86# load lines for config "xxx" will be emitted as: 87# xxx: ${SYSTEM_DEP} swapxxx.o 88# ${SYSTEM_LD_HEAD} 89# ${SYSTEM_LD} swapxxx.o 90# ${SYSTEM_LD_TAIL} 91SYSTEM_OBJ= locore.o \ 92 param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 93SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 94SYSTEM_LD_HEAD= rm -f $@ 95SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 96 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 97SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 98 99DEBUG?= 100.if ${DEBUG} == "-g" 101LINKFLAGS+= -X 102SYSTEM_LD_TAIL+=; \ 103 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 104 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 105.else 106LINKFLAGS+= -X 107.endif 108 109%LOAD 110 111assym.h: $S/kern/genassym.sh ${I386}/i386/genassym.cf 112 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 113 < ${I386}/i386/genassym.cf > assym.h.tmp && \ 114 mv -f assym.h.tmp assym.h 115 116param.c: $S/conf/param.c 117 rm -f param.c 118 cp $S/conf/param.c . 119 120param.o: param.c Makefile 121 ${NORMAL_C} 122 123ioconf.o: ioconf.c 124 ${NORMAL_C} 125 126newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 127 sh $S/conf/newvers.sh 128 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 129 130 131__CLEANKERNEL: .USE 132 @echo "${.TARGET}ing the kernel objects" 133 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 134 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 135 136__CLEANDEPEND: .USE 137 rm -f .depend 138 139clean: __CLEANKERNEL 140 141cleandir: __CLEANKERNEL __CLEANDEPEND 142 143lint: 144 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 145 ${I386}/i386/Locore.c ${CFILES} \ 146 ioconf.c param.c | \ 147 grep -v 'static function .* unused' 148 149tags: 150 @echo "see $S/kern/Makefile for tags" 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 160SRCS= ${I386}/i386/locore.s \ 161 param.c ioconf.c ${CFILES} ${SFILES} 162depend: .depend 163.depend: ${SRCS} assym.h param.c 164 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${I386}/i386/locore.s 165 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 166 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 167 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 168 ${CPPFLAGS} < ${I386}/i386/genassym.cf 169 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 170 @rm -f assym.dep 171 172 173# depend on root or device configuration 174autoconf.o conf.o: Makefile 175 176# depend on network or filesystem configuration 177uipc_proto.o vfs_conf.o: Makefile 178 179# depend on maxusers 180machdep.o: Makefile 181 182# depend on CPU configuration 183locore.o machdep.o: Makefile 184 185 186locore.o: ${I386}/i386/locore.s assym.h 187 ${NORMAL_S} 188 189%RULES 190