Makefile.sun3 revision 1.31
11.31Sgwr#	$NetBSD: Makefile.sun3,v 1.31 1995/06/09 21:53:32 gwr Exp $
21.23Scgd
31.24Sgwr#
41.24Sgwr# Makefile for NetBSD
51.1Sglass#
61.1Sglass# This makefile is constructed from a machine description:
71.1Sglass#	config machineid
81.1Sglass# Most changes should be made in the machine description
91.1Sglass#	/sys/conf/``machineid''
101.1Sglass# after which you should do
111.1Sglass#	 config machineid
121.1Sglass# Machine generic makefile changes should be made in
131.1Sglass#	/sys/conf/Makefile.``machinetype''
141.1Sglass# after which config should be rerun for all machines of that type.
151.1Sglass#
161.1Sglass# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
171.1Sglass#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
181.1Sglass#
191.1Sglass# -DTRACE	compile in kernel tracing hooks
201.1Sglass# -DQUOTA	compile in file system quotas
211.1Sglass
221.1Sglass# DEBUG is set to -g by config if debugging is requested (config -g).
231.27SgwrDEBUG?=-O
241.1Sglass# PROF is set to -pg by config if profiling is requested (config -p).
251.31SgwrAS=	as
261.31SgwrCC=	cc ${DEBUG}
271.31SgwrCPP=	cpp
281.1SglassLD=	ld
291.1SglassTOUCH=	touch -f -c
301.1Sglass
311.1Sglass# source tree is located via $S relative to the compilation directory
321.1SglassS=	../../../..
331.1SglassSUN3=	../..
341.1Sglass
351.31SgwrINCLUDES= -I. -I../.. -I$S/arch -I$S/sys -I$S
361.29SjtcCOPTS=	${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dsun3
371.31Sgwr# We do NOT want accidental FP instructions in the kernel.
381.31SgwrCFLAGS= -msoft-float ${COPTS}
391.31Sgwr
401.31Sgwr# What to use for libkern:
411.31Sgwr.include "$S/lib/libkern/Makefile.inc"
421.31Sgwr.ifndef PROF
431.31SgwrLIBKERN=	${KERNLIB}
441.31Sgwr.else
451.31SgwrLIBKERN=	${KERNLIB_PROF}
461.31Sgwr.endif
471.1Sglass
481.1Sglass# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
491.1Sglass# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
501.1Sglass# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
511.1Sglass# is marked as config-dependent.
521.1Sglass
531.31SgwrNORMAL_C=	${CC} ${CFLAGS} ${PROF} -c $<
541.31SgwrNORMAL_C_C=	${CC} ${CFLAGS} ${PROF} ${PARAM} -c $<
551.1Sglass
561.31SgwrDRIVER_C=	${CC} ${CFLAGS} ${PROF} -c $<
571.31SgwrDRIVER_C_C=	${CC} ${CFLAGS} ${PROF} ${PARAM} -c $<
581.1Sglass
591.31SgwrPROFILE_C=	${CC} ${COPTS} -S $<; \
601.1Sglass		ex - $*.s < ${GPROF.EX}; \
611.1Sglass		${AS} -o $@ $*.s; \
621.1Sglass		rm -f $*.s
631.1Sglass
641.1SglassNORMAL_S=	${CPP} ${COPTS} $< | ${AS} -o $@
651.1SglassNORMAL_S_C=	${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
661.1Sglass
671.1Sglass%OBJS
681.1Sglass
691.1Sglass%CFILES
701.1Sglass
711.1Sglass# load lines for config "xxx" will be emitted as:
721.1Sglass# xxx: ${SYSTEM_DEP} swapxxx.o
731.1Sglass#	${SYSTEM_LD_HEAD}
741.1Sglass#	${SYSTEM_LD} swapxxx.o
751.1Sglass#	${SYSTEM_LD_TAIL}
761.11Sderaadt.if ${DEBUG} == "-g"
771.11SderaadtLDX=-X
781.11Sderaadt.else
791.19SgwrLDX=-S
801.11Sderaadt.endif
811.20SgwrSYSTEM_OBJ=	locore.o vnode_if.o ${OBJS} param.o ioconf.o
821.1SglassSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
831.1SglassSYSTEM_LD_HEAD=	@echo loading $@; rm -f $@
841.12SglassSYSTEM_LD=	-@echo ${LD} ${LDX} -n -N -e start -T 0E004000 -o $@ \
851.11Sderaadt		    '$${SYSTEM_OBJ}' vers.o ${LIBKERN}; \
861.12Sglass		${LD} ${LDX} -n -N -e start -T 0E004000 -o $@ \
871.11Sderaadt		    ${SYSTEM_OBJ} vers.o ${LIBKERN}
881.1SglassSYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
891.1Sglass		[ X${DEBUG} = X-g ] && { \
901.1Sglass		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
911.31Sgwr		echo strip -d $@; strip -d $@; } || true
921.1Sglass
931.1Sglass%LOAD
941.1Sglass
951.1Sglassnewvers:
961.1Sglass	sh $S/conf/newvers.sh
971.1Sglass	${CC} $(CFLAGS) -c vers.c
981.1Sglass
991.1Sglassclean:
1001.8Sglass	rm -f eddep netbsd* tags *.o locore.i [a-z]*.s \
1011.24Sgwr		Errs errs linterrs makelinks vnode_if.[ch]
1021.1Sglass
1031.1Sglasslint: /tmp param.c
1041.1Sglass	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
1051.1Sglass	    ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
1061.1Sglass	    ioconf.c param.c| \
1071.1Sglass	    grep -v 'struct/union .* never defined' | \
1081.1Sglass	    grep -v 'possible pointer alignment problem'
1091.1Sglass
1101.12Sglasslocore.o: assym.s ${SUN3}/sun3/locore.s ${SUN3}/include/asm.h \
1111.30Sgwr	  ${SUN3}/include/trap.h $S/arch/m68k/include/trap.h
1121.31Sgwr	${CPP} -DLOCORE ${COPTS} ${SUN3}/sun3/locore.s | ${AS} -o locore.o
1131.1Sglass
1141.1Sglass# the following is necessary because autoconf.o depends on #if GENERIC
1151.1Sglassautoconf.o: Makefile
1161.17Sgwr
1171.17Sgwr# depends on device configuration
1181.17Sgwrconf.o : Makefile
1191.21Sgwr
1201.21Sgwr# depends on network or filesystem configuration
1211.21Sgwruipc_proto.o vfs_conf.o : Makefile
1221.18Sgwr
1231.18Sgwr# depends on value of SYMTAB_SPACE
1241.18Sgwrdb_aout.o : Makefile
1251.1Sglass
1261.15Sglasssun3_startup.o pmap.o kern_xxx.o: Makefile
1271.1Sglass
1281.1Sglass# depend on maxusers
1291.1Sglassassym.s: Makefile
1301.1Sglass
1311.1Sglassassym.s: genassym
1321.1Sglass	./genassym >assym.s
1331.1Sglass
1341.1Sglassgenassym:
1351.31Sgwr	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dsun3 \
1361.31Sgwr	    -o genassym ${SUN3}/sun3/genassym.c
1371.1Sglass
1381.26Sgwrdepend: assym.s ioconf.c param.c vnode_if.c
1391.26Sgwr	mkdep ${COPTS} ${CFILES} ioconf.c param.c vnode_if.c
1401.31Sgwr	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${SUN3}/sun3/genassym.c
1411.1Sglass
1421.1Sglasslinks:
1431.1Sglass	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1441.1Sglass	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1451.1Sglass	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1461.1Sglass	  sort -u | comm -23 - dontlink | \
1471.1Sglass	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1481.1Sglass	sh makelinks && rm -f dontlink
1491.1Sglass
1501.1Sglasstags:
1511.1Sglass	@echo "see $S/kern/Makefile for tags"
1521.1Sglass
1531.1Sglassioconf.o: ioconf.c
1541.31Sgwr	${CC} ${CFLAGS} -c ioconf.c
1551.1Sglass
1561.1Sglassparam.c: $S/conf/param.c
1571.1Sglass	rm -f param.c
1581.1Sglass	cp $S/conf/param.c .
1591.1Sglass
1601.1Sglassparam.o: param.c Makefile
1611.31Sgwr	${CC} ${CFLAGS} ${PARAM} -c param.c
1621.1Sglass
1631.1Sglassvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1641.1Sglass	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
1651.1Sglass	${CC} ${CFLAGS} -c vers.c
1661.19Sgwr
1671.19Sgwrvnode_if.c vnode_if.h : $S/kern/vnode_if.sh $S/kern/vnode_if.src
1681.20Sgwr	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1691.1Sglass
1701.1Sglass%RULES
171