Makefile.i386 revision 1.71
11.71Smycroft#	$NetBSD: Makefile.i386,v 1.71 1996/08/12 00:51:40 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.65SmycroftSTRIP?=	strip -d
281.65SmycroftTOUCH?=	touch -f -c
291.1Scgd
301.42Smycroft# source tree is located via $S relative to the compilation directory
311.68SmycroftS!=	cd ../../../..; pwd
321.68SmycroftI386=	$S/arch/i386
331.1Scgd
341.69SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
351.71SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
361.71Smycroft		-Di386
371.68SmycroftCWARNFLAGS=	-Werror -Wreturn-type
381.68SmycroftCFLAGS=		${DEBUG} ${CWARNFLAGS} -O2 
391.64SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -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.71Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
591.71Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
601.42Smycroft
611.62SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
621.64SmycroftNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
631.42Smycroft
641.71SmycroftHOSTED_C=	${NORMAL_C:S/^-pg$//:S/^-p$//:S/^-nostdinc$//}
651.69Smycroft
661.1Scgd%OBJS
671.1Scgd
681.1Scgd%CFILES
691.1Scgd
701.62Smycroft%SFILES
711.62Smycroft
721.42Smycroft# load lines for config "xxx" will be emitted as:
731.42Smycroft# xxx: ${SYSTEM_DEP} swapxxx.o
741.42Smycroft#	${SYSTEM_LD_HEAD}
751.42Smycroft#	${SYSTEM_LD} swapxxx.o
761.42Smycroft#	${SYSTEM_LD_TAIL}
771.62SmycroftSYSTEM_OBJ=	locore.o \
781.66Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
791.42SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
801.42SmycroftSYSTEM_LD_HEAD=	rm -f $@
811.62SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
821.62Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
831.62SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@
841.62Smycroft
851.62SmycroftDEBUG?=
861.62Smycroft.if ${DEBUG} == "-g"
871.62SmycroftLINKFLAGS+=	-X
881.62SmycroftSYSTEM_LD_TAIL+=; \
891.62Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
901.62Smycroft		echo ${STRIP} $@; ${STRIP} $@
911.62Smycroft.else
921.68SmycroftLINKFLAGS+=	-S
931.62Smycroft.endif
941.42Smycroft
951.1Scgd%LOAD
961.50Smycroft
971.62Smycroftassym.h: genassym
981.62Smycroft	./genassym >assym.h
991.1Scgd
1001.62Smycroftgenassym: genassym.o
1011.62Smycroft	${CC} -o $@ genassym.o
1021.42Smycroft
1031.62Smycroftgenassym.o: ${I386}/i386/genassym.c
1041.71Smycroft	${HOSTED_C}
1051.1Scgd
1061.62Smycroftparam.c: $S/conf/param.c
1071.62Smycroft	rm -f param.c
1081.62Smycroft	cp $S/conf/param.c .
1091.1Scgd
1101.62Smycroftparam.o: param.c Makefile
1111.71Smycroft	${NORMAL_C}
1121.1Scgd
1131.62Smycroftioconf.o: ioconf.c
1141.62Smycroft	${NORMAL_C}
1151.42Smycroft
1161.62Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1171.62Smycroft	sh $S/conf/newvers.sh
1181.62Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1191.1Scgd
1201.1Scgd
1211.62Smycroftclean::
1221.66Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1231.62Smycroft	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
1241.1Scgd
1251.62Smycroftlint:
1261.71Smycroft	@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \
1271.62Smycroft	    ${I386}/i386/Locore.c ${CFILES} ${I386}/i386/swapgeneric.c \
1281.62Smycroft	    ioconf.c param.c | \
1291.62Smycroft	    grep -v 'static function .* unused'
1301.1Scgd
1311.62Smycrofttags:
1321.62Smycroft	@echo "see $S/kern/Makefile for tags"
1331.1Scgd
1341.1Scgdlinks:
1351.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1361.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1371.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1381.1Scgd	  sort -u | comm -23 - dontlink | \
1391.62Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1401.1Scgd	sh makelinks && rm -f dontlink
1411.1Scgd
1421.62SmycroftSRCS=	${I386}/i386/locore.s \
1431.66Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1441.67Smycroftdepend:: .depend
1451.66Scgd.depend: ${SRCS} assym.h param.c
1461.68Smycroft	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${I386}/i386/locore.s
1471.68Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1481.68Smycroft	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1491.71Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} ${I386}/i386/genassym.c
1501.62Smycroft
1511.62Smycroft
1521.62Smycroft# depend on root or device configuration
1531.62Smycroftautoconf.o conf.o: Makefile
1541.62Smycroft 
1551.62Smycroft# depend on network or filesystem configuration 
1561.62Smycroftuipc_proto.o vfs_conf.o: Makefile 
1571.1Scgd
1581.62Smycroft# depend on maxusers
1591.62Smycroftgenassym.o machdep.o: Makefile
1601.1Scgd
1611.62Smycroft# depend on CPU configuration 
1621.62Smycroftlocore.o machdep.o: Makefile
1631.1Scgd
1641.2Scgd
1651.62Smycroftlocore.o: ${I386}/i386/locore.s assym.h
1661.62Smycroft	${NORMAL_S}
1671.1Scgd
1681.1Scgd%RULES
169