Makefile.i386 revision 1.80
11.80Sperry#	$NetBSD: Makefile.i386,v 1.80 1997/02/04 05:08:34 perry 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.74SmycroftSTRIP?=	strip
281.77SjonathanCOPTS?=		-O2
291.1Scgd
301.42Smycroft# source tree is located via $S relative to the compilation directory
311.73Smycroft.ifndef S
321.68SmycroftS!=	cd ../../../..; pwd
331.73Smycroft.endif
341.68SmycroftI386=	$S/arch/i386
351.1Scgd
361.69SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
371.71SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
381.71Smycroft		-Di386
391.76SchristosCWARNFLAGS=	-Werror -Wall -Wmissing-prototypes -Wstrict-prototypes
401.77SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS}
411.64SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
421.62SmycroftLINKFLAGS=	-z -Ttext F8100000 -e start
431.74SmycroftSTRIPFLAGS=	-d
441.74Smycroft
451.74SmycroftHOSTED_CC=	${CC}
461.74SmycroftHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
471.74SmycroftHOSTED_CFLAGS=	${CFLAGS}
481.1Scgd
491.33Scgd### find out what to use for libkern
501.33Scgd.include "$S/lib/libkern/Makefile.inc"
511.33Scgd.ifndef PROF
521.33ScgdLIBKERN=	${KERNLIB}
531.33Scgd.else
541.33ScgdLIBKERN=	${KERNLIB_PROF}
551.33Scgd.endif
561.33Scgd
571.56Schristos### find out what to use for libcompat
581.56Schristos.include "$S/compat/common/Makefile.inc"
591.56Schristos.ifndef PROF
601.56SchristosLIBCOMPAT=	${COMPATLIB}
611.56Schristos.else
621.56SchristosLIBCOMPAT=	${COMPATLIB_PROF}
631.56Schristos.endif
641.56Schristos
651.71Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
661.71Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
671.42Smycroft
681.62SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
691.64SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
701.42Smycroft
711.74SmycroftHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
721.69Smycroft
731.1Scgd%OBJS
741.1Scgd
751.1Scgd%CFILES
761.1Scgd
771.62Smycroft%SFILES
781.62Smycroft
791.42Smycroft# load lines for config "xxx" will be emitted as:
801.42Smycroft# xxx: ${SYSTEM_DEP} swapxxx.o
811.42Smycroft#	${SYSTEM_LD_HEAD}
821.42Smycroft#	${SYSTEM_LD} swapxxx.o
831.42Smycroft#	${SYSTEM_LD_TAIL}
841.62SmycroftSYSTEM_OBJ=	locore.o \
851.66Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
861.42SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
871.42SmycroftSYSTEM_LD_HEAD=	rm -f $@
881.62SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
891.62Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
901.62SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
911.62Smycroft
921.62SmycroftDEBUG?=
931.62Smycroft.if ${DEBUG} == "-g"
941.62SmycroftLINKFLAGS+=	-X
951.62SmycroftSYSTEM_LD_TAIL+=; \
961.62Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
971.74Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
981.62Smycroft.else
991.68SmycroftLINKFLAGS+=	-S
1001.62Smycroft.endif
1011.42Smycroft
1021.1Scgd%LOAD
1031.50Smycroft
1041.62Smycroftassym.h: genassym
1051.62Smycroft	./genassym >assym.h
1061.1Scgd
1071.62Smycroftgenassym: genassym.o
1081.62Smycroft	${CC} -o $@ genassym.o
1091.42Smycroft
1101.62Smycroftgenassym.o: ${I386}/i386/genassym.c
1111.71Smycroft	${HOSTED_C}
1121.1Scgd
1131.62Smycroftparam.c: $S/conf/param.c
1141.62Smycroft	rm -f param.c
1151.62Smycroft	cp $S/conf/param.c .
1161.1Scgd
1171.62Smycroftparam.o: param.c Makefile
1181.71Smycroft	${NORMAL_C}
1191.1Scgd
1201.62Smycroftioconf.o: ioconf.c
1211.62Smycroft	${NORMAL_C}
1221.42Smycroft
1231.62Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1241.62Smycroft	sh $S/conf/newvers.sh
1251.62Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1261.1Scgd
1271.1Scgd
1281.78Scgdclean: cleankernel
1291.78Scgdcleankernel:
1301.66Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1311.62Smycroft	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
1321.1Scgd
1331.62Smycroftlint:
1341.79Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1351.80Sperry	    ${I386}/i386/Locore.c ${CFILES} \
1361.62Smycroft	    ioconf.c param.c | \
1371.62Smycroft	    grep -v 'static function .* unused'
1381.1Scgd
1391.62Smycrofttags:
1401.62Smycroft	@echo "see $S/kern/Makefile for tags"
1411.1Scgd
1421.1Scgdlinks:
1431.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1441.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1451.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1461.1Scgd	  sort -u | comm -23 - dontlink | \
1471.62Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1481.1Scgd	sh makelinks && rm -f dontlink
1491.1Scgd
1501.62SmycroftSRCS=	${I386}/i386/locore.s \
1511.66Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1521.78Scgddepend: .depend
1531.75Sjtk.depend: ${SRCS} assym.h param.c
1541.68Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${I386}/i386/locore.s
1551.68Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1561.68Smycroft	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1571.74Smycroft	${MKDEP} -a ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} \
1581.74Smycroft	    ${I386}/i386/genassym.c
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.62Smycroftgenassym.o machdep.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