Makefile.i386 revision 1.94
1# $NetBSD: Makefile.i386,v 1.94 1998/10/15 18:37:14 drochner 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 59KERN_AS= obj 60.include "$S/lib/libkern/Makefile.inc" 61.ifndef PROF 62LIBKERN= ${KERNLIB} 63.else 64LIBKERN= ${KERNLIB_PROF} 65.endif 66 67### find out what to use for libcompat 68.include "$S/compat/common/Makefile.inc" 69.ifndef PROF 70LIBCOMPAT= ${COMPATLIB} 71.else 72LIBCOMPAT= ${COMPATLIB_PROF} 73.endif 74 75# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 76# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 77 78NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 79NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 80NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 81 82%OBJS 83 84%CFILES 85 86%SFILES 87 88# load lines for config "xxx" will be emitted as: 89# xxx: ${SYSTEM_DEP} swapxxx.o 90# ${SYSTEM_LD_HEAD} 91# ${SYSTEM_LD} swapxxx.o 92# ${SYSTEM_LD_TAIL} 93SYSTEM_OBJ= locore.o \ 94 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 95SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 96SYSTEM_LD_HEAD= rm -f $@ 97SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 98 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 99SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 100 101DEBUG?= 102.if ${DEBUG} == "-g" 103LINKFLAGS+= -X 104SYSTEM_LD_TAIL+=; \ 105 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 106 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 107.else 108LINKFLAGS+= -X 109.endif 110 111%LOAD 112 113assym.h: $S/kern/genassym.sh ${I386}/i386/genassym.cf 114 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 115 < ${I386}/i386/genassym.cf > assym.h.tmp && \ 116 mv -f assym.h.tmp assym.h 117 118param.c: $S/conf/param.c 119 rm -f param.c 120 cp $S/conf/param.c . 121 122param.o: param.c Makefile 123 ${NORMAL_C} 124 125ioconf.o: ioconf.c 126 ${NORMAL_C} 127 128newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 129 sh $S/conf/newvers.sh 130 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 131 132 133__CLEANKERNEL: .USE 134 @echo "${.TARGET}ing the kernel objects" 135 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 136 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 137 138__CLEANDEPEND: .USE 139 rm -f .depend 140 141clean: __CLEANKERNEL 142 143cleandir distclean: __CLEANKERNEL __CLEANDEPEND 144 145lint: 146 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 147 ${I386}/i386/Locore.c ${CFILES} \ 148 ioconf.c param.c | \ 149 grep -v 'static function .* unused' 150 151tags: 152 @echo "see $S/kern/Makefile for tags" 153 154links: 155 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 156 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 157 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 158 sort -u | comm -23 - dontlink | \ 159 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 160 sh makelinks && rm -f dontlink 161 162SRCS= ${I386}/i386/locore.s \ 163 param.c ioconf.c ${CFILES} ${SFILES} 164depend: .depend 165.depend: ${SRCS} assym.h param.c 166 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${I386}/i386/locore.s 167 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 168 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 169 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 170 ${CPPFLAGS} < ${I386}/i386/genassym.cf 171 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 172 @rm -f assym.dep 173 174 175# depend on root or device configuration 176autoconf.o conf.o: Makefile 177 178# depend on network or filesystem configuration 179uipc_proto.o vfs_conf.o: Makefile 180 181# depend on maxusers 182machdep.o: Makefile 183 184# depend on CPU configuration 185locore.o machdep.o: Makefile 186 187 188locore.o: ${I386}/i386/locore.s assym.h 189 ${NORMAL_S} 190 191%RULES 192