Makefile.sparc64 revision 1.3
11.3Seeh# 	$NetBSD: Makefile.sparc64,v 1.3 1998/08/13 02:10:40 eeh Exp $
21.1Seeh
31.1Seeh# Makefile for NetBSD
41.1Seeh#
51.1Seeh# This makefile is constructed from a machine description:
61.1Seeh#	config machineid
71.1Seeh# Most changes should be made in the machine description
81.1Seeh#	/sys/arch/sparc64/conf/``machineid''
91.1Seeh# after which you should do
101.1Seeh#	config machineid
111.1Seeh# Machine generic makefile changes should be made in
121.1Seeh#	/sys/arch/sparc64/conf/Makefile.sparc64
131.1Seeh# after which config should be rerun for all machines of that type.
141.1Seeh#
151.1Seeh# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
161.1Seeh#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
171.1Seeh#
181.1Seeh# -DTRACE	compile in kernel tracing hooks
191.1Seeh# -DQUOTA	compile in file system quotas
201.1Seeh
211.1Seeh# DEBUG is set to -g if debugging.
221.1Seeh# PROF is set to -pg if profiling.
231.1Seeh
241.1SeehCC?=	cc
251.1SeehLD?=	/usr/ccs/bin/ld #Need to use Solaris ld to use the solaris loader
261.1SeehMKDEP?=	mkdep
271.1SeehSTRIP?=	strip
281.2SmrgSIZE?=	size
291.1SeehCOPTS?= 	-O2
301.1Seeh
311.1Seeh# source tree is located via $S relative to the compilation directory
321.1Seeh.ifndef S
331.1SeehS!=	cd ../../../..; pwd
341.1Seeh.endif
351.1SeehSPARC64=	$S/arch/sparc64
361.1Seeh
371.1SeehINCLUDES=	-I. -I$S/arch -I$S -nostdinc
381.1SeehCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -U__SVR4 -U__svr4__
391.1SeehCWARNFLAGS=	-Wimplicit -Wreturn-type -Wunused -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wuninitialized -Wparentheses -Wstrict-prototypes -Wmissing-prototypes -D__NetBSD__
401.1Seeh#CWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
411.3SeehCFLAGS=		${DEBUG} ${CWARNFLAGS} -O2 -Wa,-Av9a -mno-fpu
421.1SeehAFLAGS=		-x assembler-with-cpp -Wa,-Av9a -traditional-cpp -D_LOCORE
431.1SeehLINKFLAGS=	-N -p -Ttext f8000000 -e start >lderr
441.1Seeh#STRIPFLAGS=	-d
451.1Seeh
461.1Seeh#### Stuff for cross compiling
471.1SeehSTRIPFLAGS=	-S
481.1SeehNM=nm
491.1SeehLORDER=lorder
501.1SeehTSORT=tsort
511.1Seeh
521.1Seeh### find out what to use for libkern
531.1Seeh.include "$S/lib/libkern/Makefile.inc"
541.1Seeh.ifndef PROF
551.1SeehLIBKERN=	${KERNLIB}
561.1Seeh.else
571.1SeehLIBKERN=	${KERNLIB_PROF}
581.1Seeh.endif
591.1Seeh
601.1Seeh### find out what to use for libcompat
611.1Seeh.include "$S/compat/common/Makefile.inc"
621.1Seeh.ifndef PROF
631.1SeehLIBCOMPAT=	${COMPATLIB}
641.1Seeh.else
651.1SeehLIBCOMPAT=	${COMPATLIB_PROF}
661.1Seeh.endif
671.1Seeh
681.1Seeh# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
691.1Seeh# HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
701.1Seeh
711.1SeehNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
721.1SeehNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
731.1Seeh
741.1Seeh%OBJS
751.1Seeh
761.1Seeh%CFILES
771.1Seeh
781.1Seeh%SFILES
791.1Seeh
801.1Seeh# load lines for config "xxx" will be emitted as:
811.1Seeh# xxx: ${SYSTEM_DEP} swapxxx.o
821.1Seeh#	${SYSTEM_LD_HEAD}
831.1Seeh#	${SYSTEM_LD} swapxxx.o
841.1Seeh#	${SYSTEM_LD_TAIL}
851.1SeehSYSTEM_OBJ=	locore.o \
861.1Seeh		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
871.1SeehSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
881.1SeehSYSTEM_LD_HEAD=	@rm -f $@
891.1SeehSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
901.1Seeh		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
911.2SmrgSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
921.1Seeh
931.1SeehDEBUG?=
941.1Seeh.if ${DEBUG} == "-g"
951.1SeehLINKFLAGS+=	-X
961.1SeehSYSTEM_LD_TAIL+=; \
971.1Seeh		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
981.1Seeh		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
991.1Seeh.else
1001.1SeehLINKFLAGS+=	-S
1011.1Seeh.endif
1021.1Seeh
1031.1Seeh%LOAD
1041.1Seeh
1051.2Smrg# XXX fix me!
1061.2SmrgUSE_GENASSYM?=	yes
1071.2Smrg
1081.2Smrg.if ${USE_GENASSYM} == "no"
1091.1Seehassym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
1101.1Seeh	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1111.1Seeh	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
1121.1Seeh	mv -f assym.h.tmp assym.h
1131.1Seeh.else
1141.1SeehHOSTED_CC=	${CC}
1151.1SeehHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
1161.1SeehHOSTED_CFLAGS=	${CFLAGS}
1171.1Seeh
1181.1SeehHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
1191.1Seeh
1201.1Seehassym.h: genassym
1211.1Seeh	./genassym >assym.h
1221.1Seeh
1231.1Seehgenassym: genassym.o
1241.1Seeh	${CC} -o $@ genassym.o
1251.1Seeh
1261.1Seehgenassym.o: ${SPARC64}/sparc64/genassym.c
1271.1Seeh	${HOSTED_C}
1281.1Seeh.endif
1291.1Seeh
1301.1Seehparam.c: $S/conf/param.c
1311.1Seeh	rm -f param.c
1321.1Seeh	cp $S/conf/param.c .
1331.1Seeh
1341.1Seehparam.o: param.c Makefile
1351.1Seeh	${NORMAL_C}
1361.1Seeh
1371.1Seehioconf.o: ioconf.c
1381.1Seeh	${NORMAL_C}
1391.1Seeh
1401.1Seehnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1411.1Seeh	sh $S/conf/newvers.sh
1421.1Seeh	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1431.1Seeh
1441.1Seeh
1451.1Seehclean: cleankernel
1461.1Seehcleankernel:
1471.1Seeh	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1481.1Seeh	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1491.1Seeh
1501.1Seehlint:
1511.1Seeh	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1521.1Seeh	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
1531.1Seeh	    ioconf.c param.c | \
1541.1Seeh	    grep -v 'static function .* unused'
1551.1Seeh
1561.1Seehtags:
1571.1Seeh	@echo "see $S/kern/Makefile for tags"
1581.1Seeh
1591.1Seehlinks:
1601.1Seeh	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1611.1Seeh	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1621.1Seeh	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1631.1Seeh	  sort -u | comm -23 - dontlink | \
1641.1Seeh	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1651.1Seeh	sh makelinks && rm -f dontlink
1661.1Seeh
1671.1SeehSRCS=	${SPARC64}/sparc64/locore.s \
1681.1Seeh	param.c ioconf.c ${CFILES} ${SFILES}
1691.1Seehdepend: .depend
1701.1Seeh.depend: ${SRCS} assym.h param.c
1711.1Seeh	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
1721.1Seeh	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1731.1Seeh	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1741.1Seeh	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1751.1Seeh	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
1761.1Seeh	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1771.1Seeh	@rm -f assym.dep
1781.1Seeh
1791.1Seeh# depend on root or device configuration
1801.1Seehautoconf.o conf.o: Makefile
1811.2Smrg
1821.1Seeh# depend on network or filesystem configuration 
1831.1Seehuipc_proto.o vfs_conf.o: Makefile 
1841.1Seeh
1851.1Seeh# depend on maxusers
1861.1Seehmachdep.o: Makefile
1871.1Seeh
1881.1Seeh# depend on CPU configuration 
1891.1Seehbwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
1901.1Seehms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
1911.1Seehmachdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
1921.1Seeh
1931.1Seeh
1941.1Seehlocore.o: ${SPARC64}/sparc64/locore.s assym.h
1951.1Seeh	${NORMAL_S}
1961.1Seeh
1971.1Seeh%RULES
198