Makefile.i386 revision 1.54
11.54Scgd#	$NetBSD: Makefile.i386,v 1.54 1995/04/17 12:06:30 cgd 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# DEBUG is set to -g by config if debugging is requested (config -g).
241.42Smycroft# PROF is set to -pg by config if profiling is requested (config -p).
251.53ScgdAS?=	as
261.53ScgdAS+=	${DEBUG}
271.53ScgdCC?=	cc
281.53ScgdCC+=	${DEBUG}
291.53ScgdCPP?=	cpp
301.53ScgdLD?=	ld
311.53ScgdTOUCH?=	touch -f -c
321.53ScgdAWK?=	awk
331.1Scgd
341.42Smycroft# source tree is located via $S relative to the compilation directory
351.11ScgdS=	../../../..
361.11ScgdI386=	../..
371.1Scgd
381.11ScgdINCLUDES= -I. -I$S/arch -I$S -I$S/sys
391.52SjtcCOPTS=	${INCLUDES} ${IDENT} -DKERNEL -D_KERNEL -Di386
401.42SmycroftCFLAGS=	-O6 ${COPTS}
411.39SmycroftLOAD_ADDRESS= F8100000
421.1Scgd
431.33Scgd### find out what to use for libkern
441.33Scgd.include "$S/lib/libkern/Makefile.inc"
451.33Scgd.ifndef PROF
461.33ScgdLIBKERN=	${KERNLIB}
471.33Scgd.else
481.33ScgdLIBKERN=	${KERNLIB_PROF}
491.33Scgd.endif
501.33Scgd
511.42Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
521.53Scgd# where TYPE is NORMAL, DRIVER, or PROFILE; SUFFIX is the file suffix,
531.42Smycroft# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
541.42Smycroft# is marked as config-dependent.
551.42Smycroft
561.42SmycroftNORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
571.42SmycroftNORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
581.42Smycroft
591.42SmycroftDRIVER_C=	${CC} -c ${CFLAGS} ${PROF} $<
601.42SmycroftDRIVER_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
611.1Scgd
621.2ScgdPROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
631.42Smycroft		sed -e s/_mcount/mcount/ -e s/subrmcount/subr_mcount/ <$*.s | \
641.42Smycroft		${AS} -o $@; \
651.2Scgd		rm -f $*.s
661.2Scgd
671.42SmycroftNORMAL_S=	${CPP} -DLOCORE ${COPTS} $< | ${AS} -o $@
681.42SmycroftNORMAL_S_C=	${CPP} -DLOCORE ${COPTS} ${PARAM} $< | ${AS} -o $@
691.42Smycroft
701.1Scgd%OBJS
711.1Scgd
721.1Scgd%CFILES
731.1Scgd
741.42Smycroft# load lines for config "xxx" will be emitted as:
751.42Smycroft# xxx: ${SYSTEM_DEP} swapxxx.o
761.42Smycroft#	${SYSTEM_LD_HEAD}
771.42Smycroft#	${SYSTEM_LD} swapxxx.o
781.42Smycroft#	${SYSTEM_LD_TAIL}
791.44SderaadtSYSTEM_OBJ=	locore.o vnode_if.o ${OBJS} param.o ioconf.o ${LIBKERN}
801.42SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
811.42SmycroftSYSTEM_LD_HEAD=	rm -f $@
821.51SmycroftSYSTEM_LD=	@if [ X${DEBUG} = X-g ]; then \
831.51Smycroft			strip=-X; \
841.51Smycroft		else \
851.51Smycroft			strip=-x; \
861.42Smycroft		fi; \
871.42Smycroft		echo ${LD} $$strip -z -T ${LOAD_ADDRESS} -o $@ -e start '$${SYSTEM_OBJ}' vers.o; \
881.42Smycroft		${LD} $$strip -z -T ${LOAD_ADDRESS} -o $@ -e start ${SYSTEM_OBJ} vers.o
891.42SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
901.51Smycroft		if [ X${DEBUG} = X-g ]; then \
911.51Smycroft			echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
921.51Smycroft			echo strip -d $@; strip -d $@; \
931.51Smycroft		fi
941.42Smycroft
951.1Scgd%LOAD
961.50Smycroft
971.50Smycroftnewvers: vers.o
981.1Scgd
991.42Smycroftvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1001.42Smycroft	sh $S/conf/newvers.sh
1011.42Smycroft	${CC} ${CFLAGS} -c vers.c
1021.42Smycroft
1031.1Scgdclean:
1041.47Smycroft	rm -f eddep *netbsd netbsd.gdb tags vnode_if.[ch] *.o locore.i \
1051.47Smycroft		[a-z]*.s [Ee]rrs linterrs makelinks
1061.1Scgd
1071.1Scgdlint: /tmp param.c
1081.42Smycroft	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
1091.42Smycroft	    ${I386}/i386/Locore.c ${CFILES} ${I386}/i386/swapgeneric.c \
1101.42Smycroft	    ioconf.c param.c | \
1111.1Scgd	    grep -v 'struct/union .* never defined' | \
1121.1Scgd	    grep -v 'possible pointer alignment problem'
1131.1Scgd
1141.42Smycroftlocore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h
1151.42Smycroftlocore.o: machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s
1161.42Smycroftlocore.o: $S/sys/errno.h machine/specialreg.h ${I386}/isa/debug.h
1171.54Scgdlocore.o: ${I386}/isa/icu.h $S/dev/isa/isareg.h $S/net/netisr.h
1181.42Smycroft	${CPP} -DLOCORE ${COPTS} ${I386}/i386/locore.s | ${AS} -o locore.o
1191.1Scgd
1201.1Scgd# the following is necessary because autoconf.o depends on #if GENERIC
1211.1Scgdautoconf.o: Makefile
1221.1Scgd
1231.42Smycroft# the following are necessary because the files depend on the types of
1241.42Smycroft# cpu's included in the system configuration
1251.42Smycroftlocore.o machdep.o: Makefile
1261.42Smycroft
1271.42Smycroft# depend on network or filesystem configuration
1281.42Smycroftuipc_proto.o vfs_conf.o locore.o: Makefile
1291.1Scgd
1301.1Scgd# depend on maxusers
1311.31Scgdassym.s: Makefile
1321.1Scgd
1331.1Scgd# depends on KDB (cons.o also depends on GENERIC)
1341.1Scgdtrap.o cons.o: Makefile
1351.1Scgd
1361.1Scgdassym.s: genassym
1371.1Scgd	./genassym >assym.s
1381.1Scgd
1391.32Scgdgenassym: ${I386}/i386/genassym.c
1401.42Smycroft	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Di386 -o genassym \
1411.42Smycroft	    ${I386}/i386/genassym.c
1421.1Scgd
1431.43Smycroftdepend: assym.s param.c vnode_if.h
1441.42Smycroft	mkdep ${COPTS} ${CFILES} ioconf.c param.c
1451.42Smycroft	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
1461.1Scgd
1471.1Scgdlinks:
1481.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1491.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1501.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1511.1Scgd	  sort -u | comm -23 - dontlink | \
1521.1Scgd	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1531.1Scgd	sh makelinks && rm -f dontlink
1541.1Scgd
1551.1Scgdtags:
1561.1Scgd	@echo "see $S/kern/Makefile for tags"
1571.1Scgd
1581.42Smycroftioconf.o: ioconf.c
1591.1Scgd	${CC} -c ${CFLAGS} ioconf.c
1601.1Scgd
1611.1Scgdparam.c: $S/conf/param.c
1621.42Smycroft	rm -f param.c
1631.1Scgd	cp $S/conf/param.c .
1641.1Scgd
1651.1Scgdparam.o: param.c Makefile
1661.1Scgd	${CC} -c ${CFLAGS} ${PARAM} param.c
1671.2Scgd
1681.45Smycroftvnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1691.45Smycroft	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1701.1Scgd
1711.1Scgd%RULES
172