Makefile.i386 revision 1.82
11.82Smycroft#	$NetBSD: Makefile.i386,v 1.82 1997/03/14 23:16:08 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.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.33Scgd### find out what to use for libkern
461.33Scgd.include "$S/lib/libkern/Makefile.inc"
471.33Scgd.ifndef PROF
481.33ScgdLIBKERN=	${KERNLIB}
491.33Scgd.else
501.33ScgdLIBKERN=	${KERNLIB_PROF}
511.33Scgd.endif
521.33Scgd
531.56Schristos### find out what to use for libcompat
541.56Schristos.include "$S/compat/common/Makefile.inc"
551.56Schristos.ifndef PROF
561.56SchristosLIBCOMPAT=	${COMPATLIB}
571.56Schristos.else
581.56SchristosLIBCOMPAT=	${COMPATLIB_PROF}
591.56Schristos.endif
601.56Schristos
611.71Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
621.71Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
631.42Smycroft
641.62SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
651.64SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
661.42Smycroft
671.1Scgd%OBJS
681.1Scgd
691.1Scgd%CFILES
701.1Scgd
711.62Smycroft%SFILES
721.62Smycroft
731.42Smycroft# load lines for config "xxx" will be emitted as:
741.42Smycroft# xxx: ${SYSTEM_DEP} swapxxx.o
751.42Smycroft#	${SYSTEM_LD_HEAD}
761.42Smycroft#	${SYSTEM_LD} swapxxx.o
771.42Smycroft#	${SYSTEM_LD_TAIL}
781.62SmycroftSYSTEM_OBJ=	locore.o \
791.66Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
801.42SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
811.42SmycroftSYSTEM_LD_HEAD=	rm -f $@
821.62SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
831.62Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
841.62SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
851.62Smycroft
861.62SmycroftDEBUG?=
871.62Smycroft.if ${DEBUG} == "-g"
881.62SmycroftLINKFLAGS+=	-X
891.62SmycroftSYSTEM_LD_TAIL+=; \
901.62Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
911.74Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
921.62Smycroft.else
931.68SmycroftLINKFLAGS+=	-S
941.62Smycroft.endif
951.42Smycroft
961.1Scgd%LOAD
971.50Smycroft
981.82Smycroftassym.h: $S/kern/genassym.sh ${I386}/i386/genassym.cf
991.82Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1001.82Smycroft	    < ${I386}/i386/genassym.cf > assym.h.tmp && \
1011.82Smycroft	mv -f assym.h.tmp assym.h
1021.1Scgd
1031.62Smycroftparam.c: $S/conf/param.c
1041.62Smycroft	rm -f param.c
1051.62Smycroft	cp $S/conf/param.c .
1061.1Scgd
1071.62Smycroftparam.o: param.c Makefile
1081.71Smycroft	${NORMAL_C}
1091.1Scgd
1101.62Smycroftioconf.o: ioconf.c
1111.62Smycroft	${NORMAL_C}
1121.42Smycroft
1131.62Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1141.62Smycroft	sh $S/conf/newvers.sh
1151.62Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1161.1Scgd
1171.1Scgd
1181.78Scgdclean: cleankernel
1191.78Scgdcleankernel:
1201.66Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1211.82Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1221.1Scgd
1231.62Smycroftlint:
1241.79Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1251.80Sperry	    ${I386}/i386/Locore.c ${CFILES} \
1261.62Smycroft	    ioconf.c param.c | \
1271.62Smycroft	    grep -v 'static function .* unused'
1281.1Scgd
1291.62Smycrofttags:
1301.62Smycroft	@echo "see $S/kern/Makefile for tags"
1311.1Scgd
1321.1Scgdlinks:
1331.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1341.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1351.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1361.1Scgd	  sort -u | comm -23 - dontlink | \
1371.62Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1381.1Scgd	sh makelinks && rm -f dontlink
1391.1Scgd
1401.62SmycroftSRCS=	${I386}/i386/locore.s \
1411.66Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1421.78Scgddepend: .depend
1431.75Sjtk.depend: ${SRCS} assym.h param.c
1441.68Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${I386}/i386/locore.s
1451.68Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1461.68Smycroft	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1471.62Smycroft
1481.62Smycroft
1491.62Smycroft# depend on root or device configuration
1501.62Smycroftautoconf.o conf.o: Makefile
1511.62Smycroft 
1521.62Smycroft# depend on network or filesystem configuration 
1531.62Smycroftuipc_proto.o vfs_conf.o: Makefile 
1541.1Scgd
1551.62Smycroft# depend on maxusers
1561.82Smycroftmachdep.o: Makefile
1571.1Scgd
1581.62Smycroft# depend on CPU configuration 
1591.62Smycroftlocore.o machdep.o: Makefile
1601.1Scgd
1611.2Scgd
1621.62Smycroftlocore.o: ${I386}/i386/locore.s assym.h
1631.62Smycroft	${NORMAL_S}
1641.1Scgd
1651.1Scgd%RULES
166