Makefile.i386 revision 1.44
11.42Smycroft# 	from: @(#)Makefile.hp300	8.2 (Berkeley) 1/23/94
21.44Sderaadt#	$Id: Makefile.i386,v 1.44 1994/06/15 02:13:47 deraadt Exp $
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.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.16SbrezakCOPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386
381.42SmycroftCFLAGS=	-O6 ${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.42Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
501.42Smycroft# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
511.42Smycroft# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
521.42Smycroft# is marked as config-dependent.
531.42Smycroft
541.42SmycroftNORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
551.42SmycroftNORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
561.42Smycroft
571.42SmycroftDRIVER_C=	${CC} -c ${CFLAGS} ${PROF} $<
581.42SmycroftDRIVER_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
591.1Scgd
601.2ScgdPROFILE_C=	${CC} -S -c ${CFLAGS} $< ; \
611.42Smycroft		sed -e s/_mcount/mcount/ -e s/subrmcount/subr_mcount/ <$*.s | \
621.42Smycroft		${AS} -o $@; \
631.2Scgd		rm -f $*.s
641.2Scgd
651.42SmycroftNORMAL_S=	${CPP} -DLOCORE ${COPTS} $< | ${AS} -o $@
661.42SmycroftNORMAL_S_C=	${CPP} -DLOCORE ${COPTS} ${PARAM} $< | ${AS} -o $@
671.42Smycroft
681.1Scgd%OBJS
691.1Scgd
701.1Scgd%CFILES
711.1Scgd
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.44SderaadtSYSTEM_OBJ=	locore.o vnode_if.o ${OBJS} param.o ioconf.o ${LIBKERN}
781.42SmycroftSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
791.42SmycroftSYSTEM_LD_HEAD=	rm -f $@
801.42SmycroftSYSTEM_LD=	-@if [ X${DEBUG} = X-g ]; \
811.42Smycroft		then strip=-X; \
821.42Smycroft		else strip=-x; \
831.42Smycroft		fi; \
841.42Smycroft		echo ${LD} $$strip -z -T ${LOAD_ADDRESS} -o $@ -e start '$${SYSTEM_OBJ}' vers.o; \
851.42Smycroft		${LD} $$strip -z -T ${LOAD_ADDRESS} -o $@ -e start ${SYSTEM_OBJ} vers.o
861.42SmycroftSYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
871.42Smycroft		[ X${DEBUG} = X-g ] && { \
881.42Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
891.42Smycroft		echo strip -d $@; strip -d $@; } || true
901.42Smycroft
911.1Scgd%LOAD
921.1Scgd
931.42Smycroftvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
941.42Smycroft	sh $S/conf/newvers.sh
951.42Smycroft	${CC} ${CFLAGS} -c vers.c
961.42Smycroft
971.1Scgdclean:
981.42Smycroft	rm -f eddep *netbsd netbsd.gdb tags *.o locore.i [a-z]*.s \
991.42Smycroft		[Ee]rrs linterrs makelinks
1001.1Scgd
1011.1Scgdlint: /tmp param.c
1021.42Smycroft	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
1031.42Smycroft	    ${I386}/i386/Locore.c ${CFILES} ${I386}/i386/swapgeneric.c \
1041.42Smycroft	    ioconf.c param.c | \
1051.1Scgd	    grep -v 'struct/union .* never defined' | \
1061.1Scgd	    grep -v 'possible pointer alignment problem'
1071.1Scgd
1081.42Smycroftlocore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h
1091.42Smycroftlocore.o: machine/pte.h ${I386}/isa/vector.s ${I386}/isa/icu.s
1101.42Smycroftlocore.o: $S/sys/errno.h machine/specialreg.h ${I386}/isa/debug.h
1111.42Smycroftlocore.o: ${I386}/isa/icu.h ${I386}/isa/isa.h vector.h $S/net/netisr.h
1121.42Smycroft	${CPP} -DLOCORE ${COPTS} ${I386}/i386/locore.s | ${AS} -o locore.o
1131.1Scgd
1141.1Scgd# the following is necessary because autoconf.o depends on #if GENERIC
1151.1Scgdautoconf.o: Makefile
1161.1Scgd
1171.42Smycroft# the following are necessary because the files depend on the types of
1181.42Smycroft# cpu's included in the system configuration
1191.42Smycroftlocore.o machdep.o: Makefile
1201.42Smycroft
1211.42Smycroft# depend on network or filesystem configuration
1221.42Smycroftuipc_proto.o vfs_conf.o locore.o: Makefile
1231.1Scgd
1241.1Scgd# depend on maxusers
1251.31Scgdassym.s: Makefile
1261.1Scgd
1271.1Scgd# depends on KDB (cons.o also depends on GENERIC)
1281.1Scgdtrap.o cons.o: Makefile
1291.1Scgd
1301.1Scgdassym.s: genassym
1311.1Scgd	./genassym >assym.s
1321.1Scgd
1331.32Scgdgenassym: ${I386}/i386/genassym.c
1341.42Smycroft	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Di386 -o genassym \
1351.42Smycroft	    ${I386}/i386/genassym.c
1361.1Scgd
1371.43Smycroftdepend: assym.s param.c vnode_if.h
1381.42Smycroft	mkdep ${COPTS} ${CFILES} ioconf.c param.c
1391.42Smycroft	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${I386}/i386/genassym.c
1401.1Scgd
1411.1Scgdlinks:
1421.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1431.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1441.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1451.1Scgd	  sort -u | comm -23 - dontlink | \
1461.1Scgd	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1471.1Scgd	sh makelinks && rm -f dontlink
1481.1Scgd
1491.1Scgdtags:
1501.1Scgd	@echo "see $S/kern/Makefile for tags"
1511.1Scgd
1521.42Smycroftioconf.o: ioconf.c
1531.1Scgd	${CC} -c ${CFLAGS} ioconf.c
1541.1Scgd
1551.1Scgdparam.c: $S/conf/param.c
1561.42Smycroft	rm -f param.c
1571.1Scgd	cp $S/conf/param.c .
1581.1Scgd
1591.1Scgdparam.o: param.c Makefile
1601.1Scgd	${CC} -c ${CFLAGS} ${PARAM} param.c
1611.2Scgd
1621.42Smycroftvnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1631.42Smycroft	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1641.42Smycroftvnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
1651.42Smycroft	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1661.1Scgd
1671.1Scgd%RULES
168