Makefile.sparc64 revision 1.16
11.16Stsutsui# 	$NetBSD: Makefile.sparc64,v 1.16 2000/01/19 16:30:01 tsutsui 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.5Seeh.include "/etc/mk.conf"
251.5Seeh
261.1SeehCC?=	cc
271.9Smrg.if exists(/usr/ccs/bin/ld)
281.1SeehLD?=	/usr/ccs/bin/ld #Need to use Solaris ld to use the solaris loader
291.9Smrg.endif
301.1SeehMKDEP?=	mkdep
311.16StsutsuiSTRIPPROG?=strip
321.2SmrgSIZE?=	size
331.1SeehCOPTS?= 	-O2
341.5Seeh#### Stuff for cross compiling
351.5SeehNM?=nm
361.5SeehLORDER?=lorder
371.5SeehTSORT?=tsort
381.5Seeh
391.1Seeh
401.4Smrg# deal with Solaris vs. NetBSD build environments for now ..
411.4SmrgOS!=uname -s
421.4Smrg.if (${OS} == "NetBSD")
431.4SmrgUSE_GENASSYM?=	no
441.4Smrg.else
451.11SeehUSE_GENASSYM?=	no
461.11SeehAWK=nawk
471.9Smrg.endif
481.9Smrg
491.9Smrg.if exists(/usr/ccs/bin/ld)
501.4SmrgSVR4=-U__SVR4 -U__svr4__ -D__NetBSD__
511.9Smrg.else
521.9SmrgSVR4=
531.4Smrg.endif
541.4Smrg
551.1Seeh# source tree is located via $S relative to the compilation directory
561.1Seeh.ifndef S
571.1SeehS!=	cd ../../../..; pwd
581.1Seeh.endif
591.1SeehSPARC64=	$S/arch/sparc64
601.1Seeh
611.1SeehINCLUDES=	-I. -I$S/arch -I$S -nostdinc
621.4SmrgCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL ${SVR4}
631.7SaugustssCWARNFLAGS=	-Wimplicit -Wunused -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wuninitialized -Wparentheses -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
641.1Seeh#CWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
651.3SeehCFLAGS=		${DEBUG} ${CWARNFLAGS} -O2 -Wa,-Av9a -mno-fpu
661.1SeehAFLAGS=		-x assembler-with-cpp -Wa,-Av9a -traditional-cpp -D_LOCORE
671.13SeehLINKFLAGS=	-N -p -Ttext f1000000 -e start >lderr
681.15StsutsuiSTRIPFLAGS=	-g
691.10Smrg
701.10Smrg%INCLUDES
711.1Seeh
721.1Seeh### find out what to use for libkern
731.14Seeh# KERN_AS=	obj	# bcopy, bzero, memcpy, memset, etc. are in locore.s
741.1Seeh.include "$S/lib/libkern/Makefile.inc"
751.1Seeh.ifndef PROF
761.1SeehLIBKERN=	${KERNLIB}
771.1Seeh.else
781.1SeehLIBKERN=	${KERNLIB_PROF}
791.1Seeh.endif
801.1Seeh
811.1Seeh### find out what to use for libcompat
821.1Seeh.include "$S/compat/common/Makefile.inc"
831.1Seeh.ifndef PROF
841.1SeehLIBCOMPAT=	${COMPATLIB}
851.1Seeh.else
861.1SeehLIBCOMPAT=	${COMPATLIB_PROF}
871.1Seeh.endif
881.1Seeh
891.1Seeh# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
901.1Seeh# HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
911.1Seeh
921.1SeehNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
931.1SeehNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
941.1Seeh
951.1Seeh%OBJS
961.1Seeh
971.1Seeh%CFILES
981.1Seeh
991.1Seeh%SFILES
1001.1Seeh
1011.1Seeh# load lines for config "xxx" will be emitted as:
1021.1Seeh# xxx: ${SYSTEM_DEP} swapxxx.o
1031.1Seeh#	${SYSTEM_LD_HEAD}
1041.1Seeh#	${SYSTEM_LD} swapxxx.o
1051.1Seeh#	${SYSTEM_LD_TAIL}
1061.1SeehSYSTEM_OBJ=	locore.o \
1071.6Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
1081.1SeehSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1091.1SeehSYSTEM_LD_HEAD=	@rm -f $@
1101.1SeehSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1111.1Seeh		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1121.2SmrgSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1131.1Seeh
1141.1SeehDEBUG?=
1151.1Seeh.if ${DEBUG} == "-g"
1161.1SeehLINKFLAGS+=	-X
1171.1SeehSYSTEM_LD_TAIL+=; \
1181.12Scgd		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
1191.16Stsutsui		echo ${STRIPPROG} ${STRIPFLAGS} -o $@ $@.gdb; \
1201.16Stsutsui		${STRIPPROG} ${STRIPFLAGS} -o $@ $@.gdb
1211.1Seeh.else
1221.1SeehLINKFLAGS+=	-S
1231.1Seeh.endif
1241.1Seeh
1251.1Seeh%LOAD
1261.2Smrg
1271.2Smrg.if ${USE_GENASSYM} == "no"
1281.1Seehassym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
1291.1Seeh	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1301.1Seeh	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
1311.1Seeh	mv -f assym.h.tmp assym.h
1321.1Seeh.else
1331.1SeehHOSTED_CC=	${CC}
1341.1SeehHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
1351.1SeehHOSTED_CFLAGS=	${CFLAGS}
1361.1Seeh
1371.1SeehHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
1381.1Seeh
1391.1Seehassym.h: genassym
1401.1Seeh	./genassym >assym.h
1411.1Seeh
1421.1Seehgenassym: genassym.o
1431.1Seeh	${CC} -o $@ genassym.o
1441.1Seeh
1451.1Seehgenassym.o: ${SPARC64}/sparc64/genassym.c
1461.1Seeh	${HOSTED_C}
1471.1Seeh.endif
1481.1Seeh
1491.1Seehparam.c: $S/conf/param.c
1501.1Seeh	rm -f param.c
1511.1Seeh	cp $S/conf/param.c .
1521.1Seeh
1531.1Seehparam.o: param.c Makefile
1541.1Seeh	${NORMAL_C}
1551.1Seeh
1561.1Seehioconf.o: ioconf.c
1571.1Seeh	${NORMAL_C}
1581.1Seeh
1591.1Seehnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1601.1Seeh	sh $S/conf/newvers.sh
1611.1Seeh	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1621.1Seeh
1631.1Seeh
1641.1Seehclean: cleankernel
1651.1Seehcleankernel:
1661.1Seeh	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1671.8Smrg	    [Ee]rrs lderr linterrs makelinks assym.h.tmp assym.h
1681.1Seeh
1691.1Seehlint:
1701.1Seeh	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1711.1Seeh	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
1721.1Seeh	    ioconf.c param.c | \
1731.1Seeh	    grep -v 'static function .* unused'
1741.1Seeh
1751.1Seehtags:
1761.1Seeh	@echo "see $S/kern/Makefile for tags"
1771.1Seeh
1781.1Seehlinks:
1791.1Seeh	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1801.1Seeh	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1811.1Seeh	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1821.1Seeh	  sort -u | comm -23 - dontlink | \
1831.1Seeh	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1841.1Seeh	sh makelinks && rm -f dontlink
1851.1Seeh
1861.1SeehSRCS=	${SPARC64}/sparc64/locore.s \
1871.1Seeh	param.c ioconf.c ${CFILES} ${SFILES}
1881.1Seehdepend: .depend
1891.1Seeh.depend: ${SRCS} assym.h param.c
1901.1Seeh	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
1911.1Seeh	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1921.9Smrg.if (${SFILES} != "")
1931.1Seeh	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1941.9Smrg.endif
1951.1Seeh	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1961.1Seeh	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
1971.1Seeh	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1981.1Seeh	@rm -f assym.dep
1991.1Seeh
2001.1Seeh# depend on root or device configuration
2011.1Seehautoconf.o conf.o: Makefile
2021.2Smrg
2031.1Seeh# depend on network or filesystem configuration 
2041.1Seehuipc_proto.o vfs_conf.o: Makefile 
2051.1Seeh
2061.1Seeh# depend on maxusers
2071.1Seehmachdep.o: Makefile
2081.1Seeh
2091.1Seeh# depend on CPU configuration 
2101.1Seehbwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
2111.1Seehms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
2121.1Seehmachdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
2131.1Seeh
2141.1Seeh
2151.1Seehlocore.o: ${SPARC64}/sparc64/locore.s assym.h
2161.1Seeh	${NORMAL_S}
2171.1Seeh
2181.1Seeh%RULES
219