Makefile.i386 revision 1.57
11.57Smycroft#	$NetBSD: Makefile.i386,v 1.57 1995/07/24 03:30:07 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# 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.57SmycroftAS=	as ${DEBUG}
261.57SmycroftAWK=	awk
271.57SmycroftCC=	cc ${DEBUG}
281.57SmycroftCPP=	cpp
291.57SmycroftLD=	ld
301.57SmycroftTOUCH=	touch -f -c
311.1Scgd
321.42Smycroft# source tree is located via $S relative to the compilation directory
331.11ScgdS=	../../../..
341.11ScgdI386=	../..
351.1Scgd
361.11ScgdINCLUDES= -I. -I$S/arch -I$S -I$S/sys
371.55SjtcCOPTS=	${INCLUDES} ${IDENT} -D_KERNEL -Di386
381.57SmycroftCFLAGS=	-O6 -Werror ${COPTS}
391.39SmycroftLOAD_ADDRESS= F8100000
401.1Scgd
411.33Scgd### find out what to use for libkern
421.33Scgd.include "$S/lib/libkern/Makefile.inc"
431.33Scgd.ifndef PROF
441.33ScgdLIBKERN=	${KERNLIB}
451.33Scgd.else
461.33ScgdLIBKERN=	${KERNLIB_PROF}
471.33Scgd.endif
481.33Scgd
491.56Schristos### find out what to use for libcompat
501.56Schristos.include "$S/compat/common/Makefile.inc"
511.56Schristos.ifndef PROF
521.56SchristosLIBCOMPAT=	${COMPATLIB}
531.56Schristos.else
541.56SchristosLIBCOMPAT=	${COMPATLIB_PROF}
551.56Schristos.endif
561.56Schristos
571.42Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
581.53Scgd# where TYPE is NORMAL, DRIVER, or PROFILE; SUFFIX is the file suffix,
591.42Smycroft# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
601.42Smycroft# is marked as config-dependent.
611.42Smycroft
621.42SmycroftNORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
631.42SmycroftNORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
641.42Smycroft
651.42SmycroftDRIVER_C=	${CC} -c ${CFLAGS} ${PROF} $<
661.42SmycroftDRIVER_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
671.1Scgd
681.2ScgdPROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
691.42Smycroft		sed -e s/_mcount/mcount/ -e s/subrmcount/subr_mcount/ <$*.s | \
701.42Smycroft		${AS} -o $@; \
711.2Scgd		rm -f $*.s
721.2Scgd
731.42SmycroftNORMAL_S=	${CPP} -DLOCORE ${COPTS} $< | ${AS} -o $@
741.42SmycroftNORMAL_S_C=	${CPP} -DLOCORE ${COPTS} ${PARAM} $< | ${AS} -o $@
751.42Smycroft
761.1Scgd%OBJS
771.1Scgd
781.1Scgd%CFILES
791.1Scgd
801.42Smycroft# load lines for config "xxx" will be emitted as:
811.42Smycroft# xxx: ${SYSTEM_DEP} swapxxx.o
821.42Smycroft#	${SYSTEM_LD_HEAD}
831.42Smycroft#	${SYSTEM_LD} swapxxx.o
841.42Smycroft#	${SYSTEM_LD_TAIL}
851.56SchristosSYSTEM_OBJ=	locore.o vnode_if.o ${OBJS} param.o ioconf.o ${LIBKERN} \
861.56Schristos		${LIBCOMPAT}
871.42SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
881.42SmycroftSYSTEM_LD_HEAD=	rm -f $@
891.51SmycroftSYSTEM_LD=	@if [ X${DEBUG} = X-g ]; then \
901.51Smycroft			strip=-X; \
911.51Smycroft		else \
921.51Smycroft			strip=-x; \
931.42Smycroft		fi; \
941.42Smycroft		echo ${LD} $$strip -z -T ${LOAD_ADDRESS} -o $@ -e start '$${SYSTEM_OBJ}' vers.o; \
951.42Smycroft		${LD} $$strip -z -T ${LOAD_ADDRESS} -o $@ -e start ${SYSTEM_OBJ} vers.o
961.42SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
971.51Smycroft		if [ X${DEBUG} = X-g ]; then \
981.51Smycroft			echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
991.51Smycroft			echo strip -d $@; strip -d $@; \
1001.51Smycroft		fi
1011.42Smycroft
1021.1Scgd%LOAD
1031.50Smycroft
1041.50Smycroftnewvers: vers.o
1051.1Scgd
1061.42Smycroftvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1071.42Smycroft	sh $S/conf/newvers.sh
1081.42Smycroft	${CC} ${CFLAGS} -c vers.c
1091.42Smycroft
1101.56Schristosclean::
1111.47Smycroft	rm -f eddep *netbsd netbsd.gdb tags vnode_if.[ch] *.o locore.i \
1121.56Schristos		[a-z]*.s [Ee]rrs linterrs makelinks genassym
1131.1Scgd
1141.1Scgdlint: /tmp param.c
1151.42Smycroft	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
1161.42Smycroft	    ${I386}/i386/Locore.c ${CFILES} ${I386}/i386/swapgeneric.c \
1171.42Smycroft	    ioconf.c param.c | \
1181.1Scgd	    grep -v 'struct/union .* never defined' | \
1191.1Scgd	    grep -v 'possible pointer alignment problem'
1201.1Scgd
1211.42Smycroftlocore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h
1221.42Smycroftlocore.o: machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s
1231.42Smycroftlocore.o: $S/sys/errno.h machine/specialreg.h ${I386}/isa/debug.h
1241.54Scgdlocore.o: ${I386}/isa/icu.h $S/dev/isa/isareg.h $S/net/netisr.h
1251.42Smycroft	${CPP} -DLOCORE ${COPTS} ${I386}/i386/locore.s | ${AS} -o locore.o
1261.1Scgd
1271.1Scgd# the following is necessary because autoconf.o depends on #if GENERIC
1281.1Scgdautoconf.o: Makefile
1291.1Scgd
1301.42Smycroft# the following are necessary because the files depend on the types of
1311.42Smycroft# cpu's included in the system configuration
1321.42Smycroftlocore.o machdep.o: Makefile
1331.42Smycroft
1341.42Smycroft# depend on network or filesystem configuration
1351.42Smycroftuipc_proto.o vfs_conf.o locore.o: Makefile
1361.1Scgd
1371.1Scgd# depend on maxusers
1381.31Scgdassym.s: Makefile
1391.1Scgd
1401.1Scgd# depends on KDB (cons.o also depends on GENERIC)
1411.1Scgdtrap.o cons.o: Makefile
1421.1Scgd
1431.1Scgdassym.s: genassym
1441.1Scgd	./genassym >assym.s
1451.1Scgd
1461.32Scgdgenassym: ${I386}/i386/genassym.c
1471.42Smycroft	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Di386 -o genassym \
1481.42Smycroft	    ${I386}/i386/genassym.c
1491.1Scgd
1501.43Smycroftdepend: assym.s param.c vnode_if.h
1511.42Smycroft	mkdep ${COPTS} ${CFILES} ioconf.c param.c
1521.42Smycroft	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
1531.1Scgd
1541.1Scgdlinks:
1551.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1561.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1571.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1581.1Scgd	  sort -u | comm -23 - dontlink | \
1591.1Scgd	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1601.1Scgd	sh makelinks && rm -f dontlink
1611.1Scgd
1621.1Scgdtags:
1631.1Scgd	@echo "see $S/kern/Makefile for tags"
1641.1Scgd
1651.42Smycroftioconf.o: ioconf.c
1661.1Scgd	${CC} -c ${CFLAGS} ioconf.c
1671.1Scgd
1681.1Scgdparam.c: $S/conf/param.c
1691.42Smycroft	rm -f param.c
1701.1Scgd	cp $S/conf/param.c .
1711.1Scgd
1721.1Scgdparam.o: param.c Makefile
1731.1Scgd	${CC} -c ${CFLAGS} ${PARAM} param.c
1741.2Scgd
1751.45Smycroftvnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1761.45Smycroft	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1771.1Scgd
1781.1Scgd%RULES
179