Makefile.i386 revision 1.95
11.95Saugustss#	$NetBSD: Makefile.i386,v 1.95 1999/01/08 19:26:13 augustss 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.88SthorpejAR?=	ar
251.88SthorpejAS?=	as
261.65SmycroftCC?=	cc
271.88SthorpejCPP?=	cpp
281.65SmycroftLD?=	ld
291.87SthorpejLORDER?=lorder
301.68SmycroftMKDEP?=	mkdep
311.87SthorpejNM?=	nm
321.88SthorpejRANLIB?=ranlib
331.85SlukemSIZE?=	size
341.74SmycroftSTRIP?=	strip
351.87SthorpejTSORT?=	tsort -q
361.88Sthorpej
371.85SlukemCOPTS?=	-O2
381.1Scgd
391.42Smycroft# source tree is located via $S relative to the compilation directory
401.73Smycroft.ifndef S
411.68SmycroftS!=	cd ../../../..; pwd
421.73Smycroft.endif
431.68SmycroftI386=	$S/arch/i386
441.1Scgd
451.92SenamiHAVE_GCC28!=	${CC} --version | egrep "^(2\.8|egcs)" ; echo
461.69SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
471.71SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
481.71Smycroft		-Di386
491.95SaugustssCWARNFLAGS?=	-Werror -Wall -Wmissing-prototypes -Wstrict-prototypes \
501.95Saugustss		-Wpointer-arith
511.90Stv.if (${HAVE_GCC28} != "")
521.90StvCWARNFLAGS+=	-Wno-main
531.90Stv.endif
541.77SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS}
551.64SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
561.86SfvdlLINKFLAGS=	-z -Ttext F0100000 -e start
571.74SmycroftSTRIPFLAGS=	-d
581.74Smycroft
591.33Scgd### find out what to use for libkern
601.94SdrochnerKERN_AS=	obj
611.33Scgd.include "$S/lib/libkern/Makefile.inc"
621.33Scgd.ifndef PROF
631.33ScgdLIBKERN=	${KERNLIB}
641.33Scgd.else
651.33ScgdLIBKERN=	${KERNLIB_PROF}
661.33Scgd.endif
671.33Scgd
681.56Schristos### find out what to use for libcompat
691.56Schristos.include "$S/compat/common/Makefile.inc"
701.56Schristos.ifndef PROF
711.56SchristosLIBCOMPAT=	${COMPATLIB}
721.56Schristos.else
731.56SchristosLIBCOMPAT=	${COMPATLIB_PROF}
741.56Schristos.endif
751.56Schristos
761.71Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
771.71Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
781.42Smycroft
791.62SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
801.91SthorpejNOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
811.64SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
821.42Smycroft
831.1Scgd%OBJS
841.1Scgd
851.1Scgd%CFILES
861.1Scgd
871.62Smycroft%SFILES
881.62Smycroft
891.42Smycroft# load lines for config "xxx" will be emitted as:
901.42Smycroft# xxx: ${SYSTEM_DEP} swapxxx.o
911.42Smycroft#	${SYSTEM_LD_HEAD}
921.42Smycroft#	${SYSTEM_LD} swapxxx.o
931.42Smycroft#	${SYSTEM_LD_TAIL}
941.62SmycroftSYSTEM_OBJ=	locore.o \
951.94Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
961.42SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
971.42SmycroftSYSTEM_LD_HEAD=	rm -f $@
981.62SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
991.62Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1001.85SlukemSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1011.62Smycroft
1021.62SmycroftDEBUG?=
1031.62Smycroft.if ${DEBUG} == "-g"
1041.62SmycroftLINKFLAGS+=	-X
1051.62SmycroftSYSTEM_LD_TAIL+=; \
1061.62Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1071.74Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1081.62Smycroft.else
1091.89SmrgLINKFLAGS+=	-X
1101.62Smycroft.endif
1111.42Smycroft
1121.1Scgd%LOAD
1131.50Smycroft
1141.82Smycroftassym.h: $S/kern/genassym.sh ${I386}/i386/genassym.cf
1151.82Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1161.82Smycroft	    < ${I386}/i386/genassym.cf > assym.h.tmp && \
1171.82Smycroft	mv -f assym.h.tmp assym.h
1181.1Scgd
1191.62Smycroftparam.c: $S/conf/param.c
1201.62Smycroft	rm -f param.c
1211.62Smycroft	cp $S/conf/param.c .
1221.1Scgd
1231.62Smycroftparam.o: param.c Makefile
1241.71Smycroft	${NORMAL_C}
1251.1Scgd
1261.62Smycroftioconf.o: ioconf.c
1271.62Smycroft	${NORMAL_C}
1281.42Smycroft
1291.62Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1301.62Smycroft	sh $S/conf/newvers.sh
1311.62Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1321.1Scgd
1331.1Scgd
1341.84Schristos__CLEANKERNEL: .USE
1351.84Schristos	@echo "${.TARGET}ing the kernel objects"
1361.66Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1371.82Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1381.84Schristos
1391.84Schristos__CLEANDEPEND: .USE
1401.84Schristos	rm -f .depend
1411.84Schristos
1421.84Schristosclean: __CLEANKERNEL
1431.84Schristos
1441.93Slukemcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1451.1Scgd
1461.62Smycroftlint:
1471.79Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1481.80Sperry	    ${I386}/i386/Locore.c ${CFILES} \
1491.62Smycroft	    ioconf.c param.c | \
1501.62Smycroft	    grep -v 'static function .* unused'
1511.1Scgd
1521.62Smycrofttags:
1531.62Smycroft	@echo "see $S/kern/Makefile for tags"
1541.1Scgd
1551.1Scgdlinks:
1561.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1571.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1581.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1591.1Scgd	  sort -u | comm -23 - dontlink | \
1601.62Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1611.1Scgd	sh makelinks && rm -f dontlink
1621.1Scgd
1631.62SmycroftSRCS=	${I386}/i386/locore.s \
1641.66Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1651.78Scgddepend: .depend
1661.75Sjtk.depend: ${SRCS} assym.h param.c
1671.68Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${I386}/i386/locore.s
1681.68Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1691.68Smycroft	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1701.83Sleo	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1711.83Sleo	  ${CPPFLAGS} < ${I386}/i386/genassym.cf
1721.83Sleo	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1731.83Sleo	@rm -f assym.dep
1741.62Smycroft
1751.62Smycroft
1761.62Smycroft# depend on root or device configuration
1771.62Smycroftautoconf.o conf.o: Makefile
1781.92Senami
1791.92Senami# depend on network or filesystem configuration
1801.92Senamiuipc_proto.o vfs_conf.o: Makefile
1811.1Scgd
1821.62Smycroft# depend on maxusers
1831.82Smycroftmachdep.o: Makefile
1841.1Scgd
1851.92Senami# depend on CPU configuration
1861.62Smycroftlocore.o machdep.o: Makefile
1871.1Scgd
1881.2Scgd
1891.62Smycroftlocore.o: ${I386}/i386/locore.s assym.h
1901.62Smycroft	${NORMAL_S}
1911.1Scgd
1921.1Scgd%RULES
193