Makefile.i386 revision 1.66
11.66Scgd#	$NetBSD: Makefile.i386,v 1.66 1996/02/29 20:56:16 cgd 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.65SmycroftAS?=	as
251.65SmycroftCC?=	cc
261.65SmycroftCPP?=	cpp
271.65SmycroftLD?=	ld
281.65SmycroftSTRIP?=	strip -d
291.65SmycroftTOUCH?=	touch -f -c
301.1Scgd
311.42Smycroft# source tree is located via $S relative to the compilation directory
321.11ScgdS=	../../../..
331.11ScgdI386=	../..
341.1Scgd
351.62SmycroftINCLUDES=	-I. -I$S/arch -I$S
361.62SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} -D_KERNEL -Di386
371.62SmycroftCFLAGS=		${DEBUG} -O2 -Werror
381.64SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
391.62SmycroftLINKFLAGS=	-z -Ttext F8100000 -e start
401.1Scgd
411.33Scgd### find out what to use for libkern
421.33Scgd.include "$S/lib/libkern/Makefile.inc"
431.33Scgd.ifndef PROF
441.33ScgdLIBKERN=	${KERNLIB}
451.33Scgd.else
461.33ScgdLIBKERN=	${KERNLIB_PROF}
471.33Scgd.endif
481.33Scgd
491.56Schristos### find out what to use for libcompat
501.56Schristos.include "$S/compat/common/Makefile.inc"
511.56Schristos.ifndef PROF
521.56SchristosLIBCOMPAT=	${COMPATLIB}
531.56Schristos.else
541.56SchristosLIBCOMPAT=	${COMPATLIB_PROF}
551.56Schristos.endif
561.56Schristos
571.42Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
581.53Scgd# where TYPE is NORMAL, DRIVER, or PROFILE; SUFFIX is the file suffix,
591.42Smycroft# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
601.42Smycroft# is marked as config-dependent.
611.42Smycroft
621.62SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
631.62SmycroftNORMAL_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
641.1Scgd
651.62SmycroftDRIVER_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
661.62SmycroftDRIVER_C_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $<
671.2Scgd
681.64SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
691.64SmycroftNORMAL_S_C=	${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $<
701.42Smycroft
711.1Scgd%OBJS
721.1Scgd
731.1Scgd%CFILES
741.1Scgd
751.62Smycroft%SFILES
761.62Smycroft
771.42Smycroft# load lines for config "xxx" will be emitted as:
781.42Smycroft# xxx: ${SYSTEM_DEP} swapxxx.o
791.42Smycroft#	${SYSTEM_LD_HEAD}
801.42Smycroft#	${SYSTEM_LD} swapxxx.o
811.42Smycroft#	${SYSTEM_LD_TAIL}
821.62SmycroftSYSTEM_OBJ=	locore.o \
831.66Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
841.42SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
851.42SmycroftSYSTEM_LD_HEAD=	rm -f $@
861.62SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
871.62Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
881.62SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
891.62Smycroft
901.62SmycroftDEBUG?=
911.62Smycroft.if ${DEBUG} == "-g"
921.62SmycroftLINKFLAGS+=	-X
931.62SmycroftSYSTEM_LD_TAIL+=; \
941.62Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
951.62Smycroft		echo ${STRIP} $@; ${STRIP} $@
961.62Smycroft.else
971.62SmycroftLINKFLAGS+=	-x
981.62Smycroft.endif
991.42Smycroft
1001.1Scgd%LOAD
1011.50Smycroft
1021.62Smycroftassym.h: genassym
1031.62Smycroft	./genassym >assym.h
1041.1Scgd
1051.62Smycroftgenassym: genassym.o
1061.62Smycroft	${CC} -o $@ genassym.o
1071.42Smycroft
1081.62Smycroftgenassym.o: ${I386}/i386/genassym.c
1091.62Smycroft	${NORMAL_C_C}
1101.1Scgd
1111.62Smycroftparam.c: $S/conf/param.c
1121.62Smycroft	rm -f param.c
1131.62Smycroft	cp $S/conf/param.c .
1141.1Scgd
1151.62Smycroftparam.o: param.c Makefile
1161.62Smycroft	${NORMAL_C_C}
1171.1Scgd
1181.62Smycroftioconf.o: ioconf.c
1191.62Smycroft	${NORMAL_C}
1201.42Smycroft
1211.62Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1221.62Smycroft	sh $S/conf/newvers.sh
1231.62Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1241.1Scgd
1251.1Scgd
1261.62Smycroftclean::
1271.66Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1281.62Smycroft	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
1291.1Scgd
1301.62Smycroftlint:
1311.62Smycroft	@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \
1321.62Smycroft	    ${I386}/i386/Locore.c ${CFILES} ${I386}/i386/swapgeneric.c \
1331.62Smycroft	    ioconf.c param.c | \
1341.62Smycroft	    grep -v 'static function .* unused'
1351.1Scgd
1361.62Smycrofttags:
1371.62Smycroft	@echo "see $S/kern/Makefile for tags"
1381.1Scgd
1391.1Scgdlinks:
1401.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1411.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1421.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1431.1Scgd	  sort -u | comm -23 - dontlink | \
1441.62Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1451.1Scgd	sh makelinks && rm -f dontlink
1461.1Scgd
1471.62SmycroftSRCS=	${I386}/i386/locore.s \
1481.66Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1491.62Smycroftdepend: .depend
1501.66Scgd.depend: ${SRCS} assym.h param.c
1511.64Smycroft	mkdep ${AFLAGS} ${CPPFLAGS} ${I386}/i386/locore.s
1521.66Scgd	mkdep -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1531.64Smycroft	mkdep -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1541.62Smycroft	mkdep -a ${CFLAGS} ${CPPFLAGS} ${PARAM} ${I386}/i386/genassym.c
1551.62Smycroft
1561.62Smycroft
1571.62Smycroft# depend on root or device configuration
1581.62Smycroftautoconf.o conf.o: Makefile
1591.62Smycroft 
1601.62Smycroft# depend on network or filesystem configuration 
1611.62Smycroftuipc_proto.o vfs_conf.o: Makefile 
1621.1Scgd
1631.62Smycroft# depend on maxusers
1641.62Smycroftgenassym.o machdep.o: Makefile
1651.1Scgd
1661.62Smycroft# depend on CPU configuration 
1671.62Smycroftlocore.o machdep.o: Makefile
1681.1Scgd
1691.2Scgd
1701.62Smycroftlocore.o: ${I386}/i386/locore.s assym.h
1711.62Smycroft	${NORMAL_S}
1721.1Scgd
1731.1Scgd%RULES
1741.59Smycroft
1751.59Smycroft### add microcode dependencies
1761.59Smycroft.include "$S/dev/microcode/Makefile.inc"
177