Makefile.i386 revision 1.49
11.49Smycroft#	$NetBSD: Makefile.i386,v 1.49 1994/11/04 00:02: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.42SmycroftSYSTEM_LD=	-@if [ X${DEBUG} = X-g ]; \
821.42Smycroft		then strip=-X; \
831.42Smycroft		else strip=-x; \
841.42Smycroft		fi; \
851.42Smycroft		echo ${LD} $$strip -z -T ${LOAD_ADDRESS} -o $@ -e start '$${SYSTEM_OBJ}' vers.o; \
861.42Smycroft		${LD} $$strip -z -T ${LOAD_ADDRESS} -o $@ -e start ${SYSTEM_OBJ} vers.o
871.42SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
881.42Smycroft		[ X${DEBUG} = X-g ] && { \
891.42Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
901.42Smycroft		echo strip -d $@; strip -d $@; } || true
911.42Smycroft
921.1Scgd%LOAD
931.1Scgd
941.42Smycroftvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
951.42Smycroft	sh $S/conf/newvers.sh
961.42Smycroft	${CC} ${CFLAGS} -c vers.c
971.42Smycroft
981.1Scgdclean:
991.47Smycroft	rm -f eddep *netbsd netbsd.gdb tags vnode_if.[ch] *.o locore.i \
1001.47Smycroft		[a-z]*.s [Ee]rrs linterrs makelinks
1011.1Scgd
1021.1Scgdlint: /tmp param.c
1031.42Smycroft	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
1041.42Smycroft	    ${I386}/i386/Locore.c ${CFILES} ${I386}/i386/swapgeneric.c \
1051.42Smycroft	    ioconf.c param.c | \
1061.1Scgd	    grep -v 'struct/union .* never defined' | \
1071.1Scgd	    grep -v 'possible pointer alignment problem'
1081.1Scgd
1091.42Smycroftlocore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h
1101.42Smycroftlocore.o: machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s
1111.42Smycroftlocore.o: $S/sys/errno.h machine/specialreg.h ${I386}/isa/debug.h
1121.49Smycroftlocore.o: ${I386}/isa/icu.h ${I386}/isa/isareg.h $S/net/netisr.h
1131.42Smycroft	${CPP} -DLOCORE ${COPTS} ${I386}/i386/locore.s | ${AS} -o locore.o
1141.1Scgd
1151.1Scgd# the following is necessary because autoconf.o depends on #if GENERIC
1161.1Scgdautoconf.o: Makefile
1171.1Scgd
1181.42Smycroft# the following are necessary because the files depend on the types of
1191.42Smycroft# cpu's included in the system configuration
1201.42Smycroftlocore.o machdep.o: Makefile
1211.42Smycroft
1221.42Smycroft# depend on network or filesystem configuration
1231.42Smycroftuipc_proto.o vfs_conf.o locore.o: Makefile
1241.1Scgd
1251.1Scgd# depend on maxusers
1261.31Scgdassym.s: Makefile
1271.1Scgd
1281.1Scgd# depends on KDB (cons.o also depends on GENERIC)
1291.1Scgdtrap.o cons.o: Makefile
1301.1Scgd
1311.1Scgdassym.s: genassym
1321.1Scgd	./genassym >assym.s
1331.1Scgd
1341.32Scgdgenassym: ${I386}/i386/genassym.c
1351.42Smycroft	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Di386 -o genassym \
1361.42Smycroft	    ${I386}/i386/genassym.c
1371.1Scgd
1381.43Smycroftdepend: assym.s param.c vnode_if.h
1391.42Smycroft	mkdep ${COPTS} ${CFILES} ioconf.c param.c
1401.42Smycroft	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
1411.1Scgd
1421.1Scgdlinks:
1431.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1441.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1451.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1461.1Scgd	  sort -u | comm -23 - dontlink | \
1471.1Scgd	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1481.1Scgd	sh makelinks && rm -f dontlink
1491.1Scgd
1501.1Scgdtags:
1511.1Scgd	@echo "see $S/kern/Makefile for tags"
1521.1Scgd
1531.42Smycroftioconf.o: ioconf.c
1541.1Scgd	${CC} -c ${CFLAGS} ioconf.c
1551.1Scgd
1561.1Scgdparam.c: $S/conf/param.c
1571.42Smycroft	rm -f param.c
1581.1Scgd	cp $S/conf/param.c .
1591.1Scgd
1601.1Scgdparam.o: param.c Makefile
1611.1Scgd	${CC} -c ${CFLAGS} ${PARAM} param.c
1621.2Scgd
1631.45Smycroftvnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1641.45Smycroft	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1651.1Scgd
1661.1Scgd%RULES
167