Makefile.sun3 revision 1.35
11.35Sgwr#	$NetBSD: Makefile.sun3,v 1.35 1995/11/17 23:31:14 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.35Sgwr#	/sys/arch/sun3/conf/``machineid''
101.1Sglass# after which you should do
111.1Sglass#	 config machineid
121.1Sglass# Machine generic makefile changes should be made in
131.35Sgwr#	/sys/arch/sun3/conf/Makefile.sun3
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.33SgwrCC=	cc
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.35SgwrCFLAGS= -Werror -msoft-float ${DEBUG} ${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.32Schristos### find out what to use for libcompat
491.32Schristos.include "$S/compat/common/Makefile.inc"
501.32Schristos.ifndef PROF
511.32SchristosLIBCOMPAT=	${COMPATLIB}
521.32Schristos.else
531.32SchristosLIBCOMPAT=	${COMPATLIB_PROF}
541.32Schristos.endif
551.32Schristos
561.1Sglass# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
571.1Sglass# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
581.1Sglass# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
591.1Sglass# is marked as config-dependent.
601.1Sglass
611.31SgwrNORMAL_C=	${CC} ${CFLAGS} ${PROF} -c $<
621.31SgwrNORMAL_C_C=	${CC} ${CFLAGS} ${PROF} ${PARAM} -c $<
631.1Sglass
641.31SgwrDRIVER_C=	${CC} ${CFLAGS} ${PROF} -c $<
651.31SgwrDRIVER_C_C=	${CC} ${CFLAGS} ${PROF} ${PARAM} -c $<
661.1Sglass
671.31SgwrPROFILE_C=	${CC} ${COPTS} -S $<; \
681.1Sglass		ex - $*.s < ${GPROF.EX}; \
691.1Sglass		${AS} -o $@ $*.s; \
701.1Sglass		rm -f $*.s
711.1Sglass
721.1SglassNORMAL_S=	${CPP} ${COPTS} $< | ${AS} -o $@
731.1SglassNORMAL_S_C=	${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
741.1Sglass
751.1Sglass%OBJS
761.1Sglass
771.1Sglass%CFILES
781.1Sglass
791.1Sglass# load lines for config "xxx" will be emitted as:
801.1Sglass# xxx: ${SYSTEM_DEP} swapxxx.o
811.1Sglass#	${SYSTEM_LD_HEAD}
821.1Sglass#	${SYSTEM_LD} swapxxx.o
831.1Sglass#	${SYSTEM_LD_TAIL}
841.11Sderaadt.if ${DEBUG} == "-g"
851.11SderaadtLDX=-X
861.11Sderaadt.else
871.19SgwrLDX=-S
881.11Sderaadt.endif
891.20SgwrSYSTEM_OBJ=	locore.o vnode_if.o ${OBJS} param.o ioconf.o
901.33SgwrSYSTEM_DEP=	Makefile ${SYSTEM_OBJ} ${LIBKERN} ${LIBCOMPAT}
911.1SglassSYSTEM_LD_HEAD=	@echo loading $@; rm -f $@
921.12SglassSYSTEM_LD=	-@echo ${LD} ${LDX} -n -N -e start -T 0E004000 -o $@ \
931.32Schristos		    '$${SYSTEM_OBJ}' vers.o ${LIBKERN} ${LIBCOMPAT}; \
941.12Sglass		${LD} ${LDX} -n -N -e start -T 0E004000 -o $@ \
951.32Schristos		    ${SYSTEM_OBJ} vers.o ${LIBKERN} ${LIBCOMPAT}
961.1SglassSYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
971.1Sglass		[ X${DEBUG} = X-g ] && { \
981.1Sglass		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
991.31Sgwr		echo strip -d $@; strip -d $@; } || true
1001.1Sglass
1011.1Sglass%LOAD
1021.1Sglass
1031.1Sglassnewvers:
1041.1Sglass	sh $S/conf/newvers.sh
1051.1Sglass	${CC} $(CFLAGS) -c vers.c
1061.1Sglass
1071.32Schristosclean::
1081.8Sglass	rm -f eddep netbsd* tags *.o locore.i [a-z]*.s \
1091.32Schristos		Errs errs linterrs makelinks vnode_if.[ch] genassym
1101.1Sglass
1111.1Sglasslint: /tmp param.c
1121.1Sglass	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
1131.1Sglass	    ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
1141.35Sgwr	    ioconf.c param.c | \
1151.1Sglass	    grep -v 'struct/union .* never defined' | \
1161.1Sglass	    grep -v 'possible pointer alignment problem'
1171.1Sglass
1181.12Sglasslocore.o: assym.s ${SUN3}/sun3/locore.s ${SUN3}/include/asm.h \
1191.30Sgwr	  ${SUN3}/include/trap.h $S/arch/m68k/include/trap.h
1201.31Sgwr	${CPP} -DLOCORE ${COPTS} ${SUN3}/sun3/locore.s | ${AS} -o locore.o
1211.1Sglass
1221.35Sgwr# depends on root or device configuration
1231.35Sgwrautoconf.o conf.o : Makefile
1241.17Sgwr
1251.35Sgwr# depends on the supported CPU types
1261.35Sgwrlocore.o sun3_startup.o pmap.o trap.o : Makefile
1271.21Sgwr
1281.21Sgwr# depends on network or filesystem configuration
1291.35Sgwruipc_proto.o vfs_conf.o kern_xxx.o : Makefile
1301.1Sglass
1311.1Sglass# depend on maxusers
1321.1Sglassassym.s: Makefile
1331.1Sglass
1341.1Sglassassym.s: genassym
1351.1Sglass	./genassym >assym.s
1361.1Sglass
1371.1Sglassgenassym:
1381.31Sgwr	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dsun3 \
1391.31Sgwr	    -o genassym ${SUN3}/sun3/genassym.c
1401.1Sglass
1411.26Sgwrdepend: assym.s ioconf.c param.c vnode_if.c
1421.26Sgwr	mkdep ${COPTS} ${CFILES} ioconf.c param.c vnode_if.c
1431.31Sgwr	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${SUN3}/sun3/genassym.c
1441.1Sglass
1451.1Sglasslinks:
1461.1Sglass	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1471.1Sglass	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1481.1Sglass	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1491.1Sglass	  sort -u | comm -23 - dontlink | \
1501.1Sglass	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
1511.1Sglass	sh makelinks && rm -f dontlink
1521.1Sglass
1531.1Sglasstags:
1541.1Sglass	@echo "see $S/kern/Makefile for tags"
1551.1Sglass
1561.1Sglassioconf.o: ioconf.c
1571.31Sgwr	${CC} ${CFLAGS} -c ioconf.c
1581.1Sglass
1591.1Sglassparam.c: $S/conf/param.c
1601.1Sglass	rm -f param.c
1611.1Sglass	cp $S/conf/param.c .
1621.1Sglass
1631.1Sglassparam.o: param.c Makefile
1641.31Sgwr	${CC} ${CFLAGS} ${PARAM} -c param.c
1651.1Sglass
1661.1Sglassvers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1671.1Sglass	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
1681.1Sglass	${CC} ${CFLAGS} -c vers.c
1691.19Sgwr
1701.19Sgwrvnode_if.c vnode_if.h : $S/kern/vnode_if.sh $S/kern/vnode_if.src
1711.20Sgwr	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
1721.1Sglass
1731.1Sglass%RULES
174