Makefile.i386 revision 1.85
11.85Slukem#	$NetBSD: Makefile.i386,v 1.85 1997/10/03 07:17:39 lukem Exp $
21.62Smycroft
31.8Scgd# Makefile for NetBSD
41.1Scgd#
51.1Scgd# This makefile is constructed from a machine description:
61.1Scgd#	config machineid
71.1Scgd# Most changes should be made in the machine description
81.36Sderaadt#	/sys/arch/i386/conf/``machineid''
91.1Scgd# after which you should do
101.62Smycroft#	config machineid
111.62Smycroft# Machine generic makefile changes should be made in
121.36Sderaadt#	/sys/arch/i386/conf/Makefile.i386
131.42Smycroft# after which config should be rerun for all machines of that type.
141.1Scgd#
151.42Smycroft# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
161.1Scgd#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
171.1Scgd#
181.1Scgd# -DTRACE	compile in kernel tracing hooks
191.1Scgd# -DQUOTA	compile in file system quotas
201.42Smycroft
211.62Smycroft# DEBUG is set to -g if debugging.
221.62Smycroft# PROF is set to -pg if profiling.
231.62Smycroft
241.65SmycroftCC?=	cc
251.65SmycroftLD?=	ld
261.68SmycroftMKDEP?=	mkdep
271.85SlukemSIZE?=	size
281.74SmycroftSTRIP?=	strip
291.85SlukemCOPTS?=	-O2
301.1Scgd
311.42Smycroft# source tree is located via $S relative to the compilation directory
321.73Smycroft.ifndef S
331.68SmycroftS!=	cd ../../../..; pwd
341.73Smycroft.endif
351.68SmycroftI386=	$S/arch/i386
361.1Scgd
371.69SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
381.71SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
391.71Smycroft		-Di386
401.76SchristosCWARNFLAGS=	-Werror -Wall -Wmissing-prototypes -Wstrict-prototypes
411.77SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS}
421.64SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
431.62SmycroftLINKFLAGS=	-z -Ttext F8100000 -e start
441.74SmycroftSTRIPFLAGS=	-d
451.74Smycroft
461.33Scgd### find out what to use for libkern
471.33Scgd.include "$S/lib/libkern/Makefile.inc"
481.33Scgd.ifndef PROF
491.33ScgdLIBKERN=	${KERNLIB}
501.33Scgd.else
511.33ScgdLIBKERN=	${KERNLIB_PROF}
521.33Scgd.endif
531.33Scgd
541.56Schristos### find out what to use for libcompat
551.56Schristos.include "$S/compat/common/Makefile.inc"
561.56Schristos.ifndef PROF
571.56SchristosLIBCOMPAT=	${COMPATLIB}
581.56Schristos.else
591.56SchristosLIBCOMPAT=	${COMPATLIB_PROF}
601.56Schristos.endif
611.56Schristos
621.71Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
631.71Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
641.42Smycroft
651.62SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
661.64SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
671.42Smycroft
681.1Scgd%OBJS
691.1Scgd
701.1Scgd%CFILES
711.1Scgd
721.62Smycroft%SFILES
731.62Smycroft
741.42Smycroft# load lines for config "xxx" will be emitted as:
751.42Smycroft# xxx: ${SYSTEM_DEP} swapxxx.o
761.42Smycroft#	${SYSTEM_LD_HEAD}
771.42Smycroft#	${SYSTEM_LD} swapxxx.o
781.42Smycroft#	${SYSTEM_LD_TAIL}
791.62SmycroftSYSTEM_OBJ=	locore.o \
801.66Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
811.42SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
821.42SmycroftSYSTEM_LD_HEAD=	rm -f $@
831.62SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
841.62Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
851.85SlukemSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
861.62Smycroft
871.62SmycroftDEBUG?=
881.62Smycroft.if ${DEBUG} == "-g"
891.62SmycroftLINKFLAGS+=	-X
901.62SmycroftSYSTEM_LD_TAIL+=; \
911.62Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
921.74Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
931.62Smycroft.else
941.68SmycroftLINKFLAGS+=	-S
951.62Smycroft.endif
961.42Smycroft
971.1Scgd%LOAD
981.50Smycroft
991.82Smycroftassym.h: $S/kern/genassym.sh ${I386}/i386/genassym.cf
1001.82Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1011.82Smycroft	    < ${I386}/i386/genassym.cf > assym.h.tmp && \
1021.82Smycroft	mv -f assym.h.tmp assym.h
1031.1Scgd
1041.62Smycroftparam.c: $S/conf/param.c
1051.62Smycroft	rm -f param.c
1061.62Smycroft	cp $S/conf/param.c .
1071.1Scgd
1081.62Smycroftparam.o: param.c Makefile
1091.71Smycroft	${NORMAL_C}
1101.1Scgd
1111.62Smycroftioconf.o: ioconf.c
1121.62Smycroft	${NORMAL_C}
1131.42Smycroft
1141.62Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1151.62Smycroft	sh $S/conf/newvers.sh
1161.62Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1171.1Scgd
1181.1Scgd
1191.84Schristos__CLEANKERNEL: .USE
1201.84Schristos	@echo "${.TARGET}ing the kernel objects"
1211.66Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1221.82Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1231.84Schristos
1241.84Schristos__CLEANDEPEND: .USE
1251.84Schristos	rm -f .depend
1261.84Schristos
1271.84Schristosclean: __CLEANKERNEL
1281.84Schristos
1291.84Schristoscleandir: __CLEANKERNEL __CLEANDEPEND
1301.1Scgd
1311.62Smycroftlint:
1321.79Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1331.80Sperry	    ${I386}/i386/Locore.c ${CFILES} \
1341.62Smycroft	    ioconf.c param.c | \
1351.62Smycroft	    grep -v 'static function .* unused'
1361.1Scgd
1371.62Smycrofttags:
1381.62Smycroft	@echo "see $S/kern/Makefile for tags"
1391.1Scgd
1401.1Scgdlinks:
1411.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1421.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1431.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1441.1Scgd	  sort -u | comm -23 - dontlink | \
1451.62Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1461.1Scgd	sh makelinks && rm -f dontlink
1471.1Scgd
1481.62SmycroftSRCS=	${I386}/i386/locore.s \
1491.66Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1501.78Scgddepend: .depend
1511.75Sjtk.depend: ${SRCS} assym.h param.c
1521.68Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${I386}/i386/locore.s
1531.68Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1541.68Smycroft	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1551.83Sleo	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1561.83Sleo	  ${CPPFLAGS} < ${I386}/i386/genassym.cf
1571.83Sleo	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1581.83Sleo	@rm -f assym.dep
1591.62Smycroft
1601.62Smycroft
1611.62Smycroft# depend on root or device configuration
1621.62Smycroftautoconf.o conf.o: Makefile
1631.62Smycroft 
1641.62Smycroft# depend on network or filesystem configuration 
1651.62Smycroftuipc_proto.o vfs_conf.o: Makefile 
1661.1Scgd
1671.62Smycroft# depend on maxusers
1681.82Smycroftmachdep.o: Makefile
1691.1Scgd
1701.62Smycroft# depend on CPU configuration 
1711.62Smycroftlocore.o machdep.o: Makefile
1721.1Scgd
1731.2Scgd
1741.62Smycroftlocore.o: ${I386}/i386/locore.s assym.h
1751.62Smycroft	${NORMAL_S}
1761.1Scgd
1771.1Scgd%RULES
178