Makefile.i386 revision 1.62
11.62Smycroft#	$NetBSD: Makefile.i386,v 1.62 1996/02/02 20:09:06 mycroft 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.62SmycroftAS=	as
251.57SmycroftAWK=	awk
261.62SmycroftCC=	cc
271.57SmycroftCPP=	cpp
281.57SmycroftLD=	ld
291.62SmycroftSTRIP=	strip -d
301.57SmycroftTOUCH=	touch -f -c
311.1Scgd
321.42Smycroft# source tree is located via $S relative to the compilation directory
331.11ScgdS=	../../../..
341.11ScgdI386=	../..
351.1Scgd
361.62SmycroftINCLUDES=	-I. -I$S/arch -I$S
371.62SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} -D_KERNEL -Di386
381.62SmycroftCFLAGS=		${DEBUG} -O2 -Werror
391.62SmycroftAFLAGS=		-D_LOCORE
401.62SmycroftLINKFLAGS=	-z -Ttext F8100000 -e start
411.1Scgd
421.33Scgd### find out what to use for libkern
431.33Scgd.include "$S/lib/libkern/Makefile.inc"
441.33Scgd.ifndef PROF
451.33ScgdLIBKERN=	${KERNLIB}
461.33Scgd.else
471.33ScgdLIBKERN=	${KERNLIB_PROF}
481.33Scgd.endif
491.33Scgd
501.56Schristos### find out what to use for libcompat
511.56Schristos.include "$S/compat/common/Makefile.inc"
521.56Schristos.ifndef PROF
531.56SchristosLIBCOMPAT=	${COMPATLIB}
541.56Schristos.else
551.56SchristosLIBCOMPAT=	${COMPATLIB_PROF}
561.56Schristos.endif
571.56Schristos
581.42Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
591.53Scgd# where TYPE is NORMAL, DRIVER, or PROFILE; SUFFIX is the file suffix,
601.42Smycroft# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
611.42Smycroft# is marked as config-dependent.
621.42Smycroft
631.62SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
641.62SmycroftNORMAL_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
651.1Scgd
661.62SmycroftDRIVER_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
671.62SmycroftDRIVER_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
681.2Scgd
691.62SmycroftNORMAL_S=	${CC} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} -c $<
701.62SmycroftNORMAL_S_C=	${CC} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
711.42Smycroft
721.1Scgd%OBJS
731.1Scgd
741.1Scgd%CFILES
751.1Scgd
761.62Smycroft%SFILES
771.62Smycroft
781.42Smycroft# load lines for config "xxx" will be emitted as:
791.42Smycroft# xxx: ${SYSTEM_DEP} swapxxx.o
801.42Smycroft#	${SYSTEM_LD_HEAD}
811.42Smycroft#	${SYSTEM_LD} swapxxx.o
821.42Smycroft#	${SYSTEM_LD_TAIL}
831.62SmycroftSYSTEM_OBJ=	locore.o \
841.62Smycroft		vnode_if.o param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
851.42SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
861.42SmycroftSYSTEM_LD_HEAD=	rm -f $@
871.62SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
881.62Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
891.62SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
901.62Smycroft
911.62SmycroftDEBUG?=
921.62Smycroft.if ${DEBUG} == "-g"
931.62SmycroftLINKFLAGS+=	-X
941.62SmycroftSYSTEM_LD_TAIL+=; \
951.62Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
961.62Smycroft		echo ${STRIP} $@; ${STRIP} $@
971.62Smycroft.else
981.62SmycroftLINKFLAGS+=	-x
991.62Smycroft.endif
1001.42Smycroft
1011.1Scgd%LOAD
1021.50Smycroft
1031.62Smycroftassym.h: genassym
1041.62Smycroft	./genassym >assym.h
1051.1Scgd
1061.62Smycroftgenassym: genassym.o
1071.62Smycroft	${CC} -o $@ genassym.o
1081.42Smycroft
1091.62Smycroftgenassym.o: ${I386}/i386/genassym.c
1101.62Smycroft	${NORMAL_C_C}
1111.1Scgd
1121.62Smycroftvnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1131.62Smycroft	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1141.1Scgd
1151.62Smycroftparam.c: $S/conf/param.c
1161.62Smycroft	rm -f param.c
1171.62Smycroft	cp $S/conf/param.c .
1181.1Scgd
1191.62Smycroftparam.o: param.c Makefile
1201.62Smycroft	${NORMAL_C_C}
1211.1Scgd
1221.62Smycroftioconf.o: ioconf.c
1231.62Smycroft	${NORMAL_C}
1241.42Smycroft
1251.62Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1261.62Smycroft	sh $S/conf/newvers.sh
1271.62Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1281.1Scgd
1291.1Scgd
1301.62Smycroftclean::
1311.62Smycroft	rm -f eddep *netbsd netbsd.gdb tags vnode_if.[ch] *.[io] [a-z]*.s \
1321.62Smycroft	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
1331.1Scgd
1341.62Smycroftlint:
1351.62Smycroft	@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
1361.62Smycroft	    ${I386}/i386/Locore.c ${CFILES} ${I386}/i386/swapgeneric.c \
1371.62Smycroft	    ioconf.c param.c | \
1381.62Smycroft	    grep -v 'static function .* unused'
1391.1Scgd
1401.62Smycrofttags:
1411.62Smycroft	@echo "see $S/kern/Makefile for tags"
1421.1Scgd
1431.1Scgdlinks:
1441.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1451.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1461.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1471.1Scgd	  sort -u | comm -23 - dontlink | \
1481.62Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1491.1Scgd	sh makelinks && rm -f dontlink
1501.1Scgd
1511.62SmycroftSRCS=	${I386}/i386/locore.s \
1521.62Smycroft	vnode_if.c param.c ioconf.c ${CFILES} ${SFILES}
1531.62Smycroftdepend: .depend
1541.62Smycroft.depend: ${SRCS} assym.h vnode_if.h param.c
1551.62Smycroft	mkdep -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${I386}/i386/locore.s
1561.62Smycroft	mkdep -a ${CFLAGS} ${CPPFLAGS} vnode_if.c param.c ioconf.c ${CFILES}
1571.62Smycroft	mkdep -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${SFILES}
1581.62Smycroft	mkdep -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${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
1781.59Smycroft
1791.59Smycroft### add microcode dependencies
1801.59Smycroft.include "$S/dev/microcode/Makefile.inc"
181