Makefile.i386 revision 1.51
11.51Smycroft#	$NetBSD: Makefile.i386,v 1.51 1994/12/06 06:07:39 mycroft Exp $
21.46Scgd# 	@(#)Makefile.hp300	8.2 (Berkeley) 1/23/94
31.9Scgd#
41.8Scgd# Makefile for NetBSD
51.1Scgd#
61.1Scgd# This makefile is constructed from a machine description:
71.1Scgd#	config machineid
81.1Scgd# Most changes should be made in the machine description
91.36Sderaadt#	/sys/arch/i386/conf/``machineid''
101.1Scgd# after which you should do
111.1Scgd#	 config machineid
121.1Scgd# Generic makefile changes should be made in
131.36Sderaadt#	/sys/arch/i386/conf/Makefile.i386
141.42Smycroft# after which config should be rerun for all machines of that type.
151.1Scgd#
161.42Smycroft# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
171.1Scgd#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
181.1Scgd#
191.1Scgd# -DTRACE	compile in kernel tracing hooks
201.1Scgd# -DQUOTA	compile in file system quotas
211.1Scgd#
221.42Smycroft
231.42Smycroft
241.42Smycroft# DEBUG is set to -g by config if debugging is requested (config -g).
251.42Smycroft# PROF is set to -pg by config if profiling is requested (config -p).
261.42SmycroftAS=	as ${DEBUG}
271.42SmycroftCC=	cc ${DEBUG}
281.42SmycroftCPP=	cpp
291.42SmycroftLD=	ld
301.1ScgdTOUCH=	touch -f -c
311.45SmycroftAWK=	awk
321.1Scgd
331.42Smycroft# source tree is located via $S relative to the compilation directory
341.11ScgdS=	../../../..
351.11ScgdI386=	../..
361.1Scgd
371.11ScgdINCLUDES= -I. -I$S/arch -I$S -I$S/sys
381.16SbrezakCOPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386
391.42SmycroftCFLAGS=	-O6 ${COPTS}
401.39SmycroftLOAD_ADDRESS= F8100000
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.42Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
511.42Smycroft# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
521.42Smycroft# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
531.42Smycroft# is marked as config-dependent.
541.42Smycroft
551.42SmycroftNORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
561.42SmycroftNORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
571.42Smycroft
581.42SmycroftDRIVER_C=	${CC} -c ${CFLAGS} ${PROF} $<
591.42SmycroftDRIVER_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
601.1Scgd
611.2ScgdPROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
621.42Smycroft		sed -e s/_mcount/mcount/ -e s/subrmcount/subr_mcount/ <$*.s | \
631.42Smycroft		${AS} -o $@; \
641.2Scgd		rm -f $*.s
651.2Scgd
661.42SmycroftNORMAL_S=	${CPP} -DLOCORE ${COPTS} $< | ${AS} -o $@
671.42SmycroftNORMAL_S_C=	${CPP} -DLOCORE ${COPTS} ${PARAM} $< | ${AS} -o $@
681.42Smycroft
691.1Scgd%OBJS
701.1Scgd
711.1Scgd%CFILES
721.1Scgd
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.44SderaadtSYSTEM_OBJ=	locore.o vnode_if.o ${OBJS} param.o ioconf.o ${LIBKERN}
791.42SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
801.42SmycroftSYSTEM_LD_HEAD=	rm -f $@
811.51SmycroftSYSTEM_LD=	@if [ X${DEBUG} = X-g ]; then \
821.51Smycroft			strip=-X; \
831.51Smycroft		else \
841.51Smycroft			strip=-x; \
851.42Smycroft		fi; \
861.42Smycroft		echo ${LD} $$strip -z -T ${LOAD_ADDRESS} -o $@ -e start '$${SYSTEM_OBJ}' vers.o; \
871.42Smycroft		${LD} $$strip -z -T ${LOAD_ADDRESS} -o $@ -e start ${SYSTEM_OBJ} vers.o
881.42SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
891.51Smycroft		if [ X${DEBUG} = X-g ]; then \
901.51Smycroft			echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
911.51Smycroft			echo strip -d $@; strip -d $@; \
921.51Smycroft		fi
931.42Smycroft
941.1Scgd%LOAD
951.50Smycroft
961.50Smycroftnewvers: vers.o
971.1Scgd
981.42Smycroftvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
991.42Smycroft	sh $S/conf/newvers.sh
1001.42Smycroft	${CC} ${CFLAGS} -c vers.c
1011.42Smycroft
1021.1Scgdclean:
1031.47Smycroft	rm -f eddep *netbsd netbsd.gdb tags vnode_if.[ch] *.o locore.i \
1041.47Smycroft		[a-z]*.s [Ee]rrs linterrs makelinks
1051.1Scgd
1061.1Scgdlint: /tmp param.c
1071.42Smycroft	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
1081.42Smycroft	    ${I386}/i386/Locore.c ${CFILES} ${I386}/i386/swapgeneric.c \
1091.42Smycroft	    ioconf.c param.c | \
1101.1Scgd	    grep -v 'struct/union .* never defined' | \
1111.1Scgd	    grep -v 'possible pointer alignment problem'
1121.1Scgd
1131.42Smycroftlocore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h
1141.42Smycroftlocore.o: machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s
1151.42Smycroftlocore.o: $S/sys/errno.h machine/specialreg.h ${I386}/isa/debug.h
1161.49Smycroftlocore.o: ${I386}/isa/icu.h ${I386}/isa/isareg.h $S/net/netisr.h
1171.42Smycroft	${CPP} -DLOCORE ${COPTS} ${I386}/i386/locore.s | ${AS} -o locore.o
1181.1Scgd
1191.1Scgd# the following is necessary because autoconf.o depends on #if GENERIC
1201.1Scgdautoconf.o: Makefile
1211.1Scgd
1221.42Smycroft# the following are necessary because the files depend on the types of
1231.42Smycroft# cpu's included in the system configuration
1241.42Smycroftlocore.o machdep.o: Makefile
1251.42Smycroft
1261.42Smycroft# depend on network or filesystem configuration
1271.42Smycroftuipc_proto.o vfs_conf.o locore.o: Makefile
1281.1Scgd
1291.1Scgd# depend on maxusers
1301.31Scgdassym.s: Makefile
1311.1Scgd
1321.1Scgd# depends on KDB (cons.o also depends on GENERIC)
1331.1Scgdtrap.o cons.o: Makefile
1341.1Scgd
1351.1Scgdassym.s: genassym
1361.1Scgd	./genassym >assym.s
1371.1Scgd
1381.32Scgdgenassym: ${I386}/i386/genassym.c
1391.42Smycroft	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Di386 -o genassym \
1401.42Smycroft	    ${I386}/i386/genassym.c
1411.1Scgd
1421.43Smycroftdepend: assym.s param.c vnode_if.h
1431.42Smycroft	mkdep ${COPTS} ${CFILES} ioconf.c param.c
1441.42Smycroft	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
1451.1Scgd
1461.1Scgdlinks:
1471.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1481.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1491.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1501.1Scgd	  sort -u | comm -23 - dontlink | \
1511.1Scgd	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1521.1Scgd	sh makelinks && rm -f dontlink
1531.1Scgd
1541.1Scgdtags:
1551.1Scgd	@echo "see $S/kern/Makefile for tags"
1561.1Scgd
1571.42Smycroftioconf.o: ioconf.c
1581.1Scgd	${CC} -c ${CFLAGS} ioconf.c
1591.1Scgd
1601.1Scgdparam.c: $S/conf/param.c
1611.42Smycroft	rm -f param.c
1621.1Scgd	cp $S/conf/param.c .
1631.1Scgd
1641.1Scgdparam.o: param.c Makefile
1651.1Scgd	${CC} -c ${CFLAGS} ${PARAM} param.c
1661.2Scgd
1671.45Smycroftvnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1681.45Smycroft	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1691.1Scgd
1701.1Scgd%RULES
171