Makefile.sparc64 revision 1.8
11.8Smrg# 	$NetBSD: Makefile.sparc64,v 1.8 1999/03/15 01:15:06 mrg 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.1SeehLD?=	/usr/ccs/bin/ld #Need to use Solaris ld to use the solaris loader
281.1SeehMKDEP?=	mkdep
291.1SeehSTRIP?=	strip
301.2SmrgSIZE?=	size
311.1SeehCOPTS?= 	-O2
321.5Seeh#### Stuff for cross compiling
331.5SeehSTRIPFLAGS=	-S
341.5SeehNM?=nm
351.5SeehLORDER?=lorder
361.5SeehTSORT?=tsort
371.5Seeh
381.1Seeh
391.4Smrg# deal with Solaris vs. NetBSD build environments for now ..
401.4SmrgOS!=uname -s
411.4Smrg.if (${OS} == "NetBSD")
421.4SmrgUSE_GENASSYM?=	no
431.4SmrgSVR4=
441.4Smrg.else
451.4SmrgUSE_GENASSYM?=	yes
461.4SmrgSVR4=-U__SVR4 -U__svr4__ -D__NetBSD__
471.4Smrg.endif
481.4Smrg
491.1Seeh# source tree is located via $S relative to the compilation directory
501.1Seeh.ifndef S
511.1SeehS!=	cd ../../../..; pwd
521.1Seeh.endif
531.1SeehSPARC64=	$S/arch/sparc64
541.1Seeh
551.1SeehINCLUDES=	-I. -I$S/arch -I$S -nostdinc
561.4SmrgCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL ${SVR4}
571.7SaugustssCWARNFLAGS=	-Wimplicit -Wunused -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wuninitialized -Wparentheses -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
581.1Seeh#CWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
591.3SeehCFLAGS=		${DEBUG} ${CWARNFLAGS} -O2 -Wa,-Av9a -mno-fpu
601.1SeehAFLAGS=		-x assembler-with-cpp -Wa,-Av9a -traditional-cpp -D_LOCORE
611.1SeehLINKFLAGS=	-N -p -Ttext f8000000 -e start >lderr
621.1Seeh#STRIPFLAGS=	-d
631.1Seeh
641.1Seeh### find out what to use for libkern
651.6SdrochnerKERN_AS=	obj
661.1Seeh.include "$S/lib/libkern/Makefile.inc"
671.1Seeh.ifndef PROF
681.1SeehLIBKERN=	${KERNLIB}
691.1Seeh.else
701.1SeehLIBKERN=	${KERNLIB_PROF}
711.1Seeh.endif
721.1Seeh
731.1Seeh### find out what to use for libcompat
741.1Seeh.include "$S/compat/common/Makefile.inc"
751.1Seeh.ifndef PROF
761.1SeehLIBCOMPAT=	${COMPATLIB}
771.1Seeh.else
781.1SeehLIBCOMPAT=	${COMPATLIB_PROF}
791.1Seeh.endif
801.1Seeh
811.1Seeh# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
821.1Seeh# HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
831.1Seeh
841.1SeehNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
851.1SeehNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
861.1Seeh
871.1Seeh%OBJS
881.1Seeh
891.1Seeh%CFILES
901.1Seeh
911.1Seeh%SFILES
921.1Seeh
931.1Seeh# load lines for config "xxx" will be emitted as:
941.1Seeh# xxx: ${SYSTEM_DEP} swapxxx.o
951.1Seeh#	${SYSTEM_LD_HEAD}
961.1Seeh#	${SYSTEM_LD} swapxxx.o
971.1Seeh#	${SYSTEM_LD_TAIL}
981.1SeehSYSTEM_OBJ=	locore.o \
991.6Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
1001.1SeehSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1011.1SeehSYSTEM_LD_HEAD=	@rm -f $@
1021.1SeehSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1031.1Seeh		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1041.2SmrgSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1051.1Seeh
1061.1SeehDEBUG?=
1071.1Seeh.if ${DEBUG} == "-g"
1081.1SeehLINKFLAGS+=	-X
1091.1SeehSYSTEM_LD_TAIL+=; \
1101.1Seeh		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1111.1Seeh		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1121.1Seeh.else
1131.1SeehLINKFLAGS+=	-S
1141.1Seeh.endif
1151.1Seeh
1161.1Seeh%LOAD
1171.2Smrg
1181.2Smrg.if ${USE_GENASSYM} == "no"
1191.1Seehassym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
1201.1Seeh	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1211.1Seeh	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
1221.1Seeh	mv -f assym.h.tmp assym.h
1231.1Seeh.else
1241.1SeehHOSTED_CC=	${CC}
1251.1SeehHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
1261.1SeehHOSTED_CFLAGS=	${CFLAGS}
1271.1Seeh
1281.1SeehHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
1291.1Seeh
1301.1Seehassym.h: genassym
1311.1Seeh	./genassym >assym.h
1321.1Seeh
1331.1Seehgenassym: genassym.o
1341.1Seeh	${CC} -o $@ genassym.o
1351.1Seeh
1361.1Seehgenassym.o: ${SPARC64}/sparc64/genassym.c
1371.1Seeh	${HOSTED_C}
1381.1Seeh.endif
1391.1Seeh
1401.1Seehparam.c: $S/conf/param.c
1411.1Seeh	rm -f param.c
1421.1Seeh	cp $S/conf/param.c .
1431.1Seeh
1441.1Seehparam.o: param.c Makefile
1451.1Seeh	${NORMAL_C}
1461.1Seeh
1471.1Seehioconf.o: ioconf.c
1481.1Seeh	${NORMAL_C}
1491.1Seeh
1501.1Seehnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1511.1Seeh	sh $S/conf/newvers.sh
1521.1Seeh	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1531.1Seeh
1541.1Seeh
1551.1Seehclean: cleankernel
1561.1Seehcleankernel:
1571.1Seeh	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1581.8Smrg	    [Ee]rrs lderr linterrs makelinks assym.h.tmp assym.h
1591.1Seeh
1601.1Seehlint:
1611.1Seeh	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1621.1Seeh	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
1631.1Seeh	    ioconf.c param.c | \
1641.1Seeh	    grep -v 'static function .* unused'
1651.1Seeh
1661.1Seehtags:
1671.1Seeh	@echo "see $S/kern/Makefile for tags"
1681.1Seeh
1691.1Seehlinks:
1701.1Seeh	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1711.1Seeh	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1721.1Seeh	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1731.1Seeh	  sort -u | comm -23 - dontlink | \
1741.1Seeh	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1751.1Seeh	sh makelinks && rm -f dontlink
1761.1Seeh
1771.1SeehSRCS=	${SPARC64}/sparc64/locore.s \
1781.1Seeh	param.c ioconf.c ${CFILES} ${SFILES}
1791.1Seehdepend: .depend
1801.1Seeh.depend: ${SRCS} assym.h param.c
1811.1Seeh	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
1821.1Seeh	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1831.1Seeh	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1841.1Seeh	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1851.1Seeh	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
1861.1Seeh	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1871.1Seeh	@rm -f assym.dep
1881.1Seeh
1891.1Seeh# depend on root or device configuration
1901.1Seehautoconf.o conf.o: Makefile
1911.2Smrg
1921.1Seeh# depend on network or filesystem configuration 
1931.1Seehuipc_proto.o vfs_conf.o: Makefile 
1941.1Seeh
1951.1Seeh# depend on maxusers
1961.1Seehmachdep.o: Makefile
1971.1Seeh
1981.1Seeh# depend on CPU configuration 
1991.1Seehbwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
2001.1Seehms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
2011.1Seehmachdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
2021.1Seeh
2031.1Seeh
2041.1Seehlocore.o: ${SPARC64}/sparc64/locore.s assym.h
2051.1Seeh	${NORMAL_S}
2061.1Seeh
2071.1Seeh%RULES
208