Makefile.sparc64 revision 1.29
11.29Smycroft# 	$NetBSD: Makefile.sparc64,v 1.29 2000/07/24 04:54:16 mycroft 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.22Seeh
251.22Seeh.if defined(MAKECONF) && exists(${MAKECONF})
261.22Seeh.include "${MAKECONF}"
271.22Seeh.elif exists(/etc/mk.conf)
281.5Seeh.include "/etc/mk.conf"
291.22Seeh.endif
301.5Seeh
311.1SeehCC?=	cc
321.9Smrg.if exists(/usr/ccs/bin/ld)
331.1SeehLD?=	/usr/ccs/bin/ld #Need to use Solaris ld to use the solaris loader
341.9Smrg.endif
351.1SeehMKDEP?=	mkdep
361.18SeehSTRIP?=strip
371.2SmrgSIZE?=	size
381.1SeehCOPTS?= 	-O2
391.5Seeh#### Stuff for cross compiling
401.5SeehNM?=nm
411.5SeehLORDER?=lorder
421.5SeehTSORT?=tsort
431.5Seeh
441.1Seeh
451.4Smrg# deal with Solaris vs. NetBSD build environments for now ..
461.4SmrgOS!=uname -s
471.4Smrg.if (${OS} == "NetBSD")
481.4SmrgUSE_GENASSYM?=	no
491.4Smrg.else
501.11SeehUSE_GENASSYM?=	no
511.11SeehAWK=nawk
521.9Smrg.endif
531.9Smrg
541.9Smrg.if exists(/usr/ccs/bin/ld)
551.4SmrgSVR4=-U__SVR4 -U__svr4__ -D__NetBSD__
561.9Smrg.else
571.9SmrgSVR4=
581.4Smrg.endif
591.4Smrg
601.1Seeh# source tree is located via $S relative to the compilation directory
611.1Seeh.ifndef S
621.1SeehS!=	cd ../../../..; pwd
631.1Seeh.endif
641.1SeehSPARC64=	$S/arch/sparc64
651.1Seeh
661.1SeehINCLUDES=	-I. -I$S/arch -I$S -nostdinc
671.4SmrgCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL ${SVR4}
681.20SmrgCWARNFLAGS=	-Wimplicit -Wunused -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wparentheses -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
691.1Seeh#CWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
701.27SmycroftCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu
711.27SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a
721.29SmycroftLINKFLAGS=	-Ttext f1000000 -Tdata f1400000 -e start
731.29Smycroft#LINKFLAGS=	-N -Ttext f1000000 -e start
741.15StsutsuiSTRIPFLAGS=	-g
751.10Smrg
761.10Smrg%INCLUDES
771.1Seeh
781.1Seeh### find out what to use for libkern
791.14Seeh# KERN_AS=	obj	# bcopy, bzero, memcpy, memset, etc. are in locore.s
801.1Seeh.include "$S/lib/libkern/Makefile.inc"
811.1Seeh.ifndef PROF
821.1SeehLIBKERN=	${KERNLIB}
831.1Seeh.else
841.1SeehLIBKERN=	${KERNLIB_PROF}
851.1Seeh.endif
861.1Seeh
871.1Seeh### find out what to use for libcompat
881.1Seeh.include "$S/compat/common/Makefile.inc"
891.1Seeh.ifndef PROF
901.1SeehLIBCOMPAT=	${COMPATLIB}
911.1Seeh.else
921.1SeehLIBCOMPAT=	${COMPATLIB_PROF}
931.1Seeh.endif
941.1Seeh
951.1Seeh# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
961.1Seeh# HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
971.1Seeh
981.27SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
991.27SmycroftNOOPT_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -O0 -c $<
1001.1SeehNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
1011.1Seeh
1021.1Seeh%OBJS
1031.1Seeh
1041.1Seeh%CFILES
1051.1Seeh
1061.1Seeh%SFILES
1071.1Seeh
1081.1Seeh# load lines for config "xxx" will be emitted as:
1091.1Seeh# xxx: ${SYSTEM_DEP} swapxxx.o
1101.1Seeh#	${SYSTEM_LD_HEAD}
1111.1Seeh#	${SYSTEM_LD} swapxxx.o
1121.1Seeh#	${SYSTEM_LD_TAIL}
1131.1SeehSYSTEM_OBJ=	locore.o \
1141.6Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
1151.1SeehSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1161.27SmycroftSYSTEM_LD_HEAD=	rm -f $@
1171.1SeehSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1181.1Seeh		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1191.2SmrgSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1201.1Seeh
1211.1SeehDEBUG?=
1221.1Seeh.if ${DEBUG} == "-g"
1231.1SeehLINKFLAGS+=	-X
1241.1SeehSYSTEM_LD_TAIL+=; \
1251.12Scgd		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
1261.19Seeh		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
1271.19Seeh		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
1281.1Seeh.else
1291.1SeehLINKFLAGS+=	-S
1301.1Seeh.endif
1311.1Seeh
1321.1Seeh%LOAD
1331.2Smrg
1341.2Smrg.if ${USE_GENASSYM} == "no"
1351.1Seehassym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
1361.27Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1371.1Seeh	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
1381.1Seeh	mv -f assym.h.tmp assym.h
1391.1Seeh.else
1401.1SeehHOSTED_CC=	${CC}
1411.1SeehHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
1421.27SmycroftHOSTED_CFLAGS=	${CFLAGS}
1431.1Seeh
1441.1SeehHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
1451.1Seeh
1461.1Seehassym.h: genassym
1471.1Seeh	./genassym >assym.h
1481.1Seeh
1491.1Seehgenassym: genassym.o
1501.1Seeh	${CC} -o $@ genassym.o
1511.1Seeh
1521.1Seehgenassym.o: ${SPARC64}/sparc64/genassym.c
1531.1Seeh	${HOSTED_C}
1541.1Seeh.endif
1551.1Seeh
1561.1Seehparam.c: $S/conf/param.c
1571.1Seeh	rm -f param.c
1581.1Seeh	cp $S/conf/param.c .
1591.1Seeh
1601.1Seehparam.o: param.c Makefile
1611.1Seeh	${NORMAL_C}
1621.1Seeh
1631.1Seehioconf.o: ioconf.c
1641.1Seeh	${NORMAL_C}
1651.1Seeh
1661.1Seehnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1671.1Seeh	sh $S/conf/newvers.sh
1681.25Seeh	${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1691.22Seeh
1701.1Seeh
1711.21Smrg__CLEANKERNEL: .USE
1721.21Smrg	@echo "${.TARGET}ing the kernel objects"
1731.1Seeh	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1741.28Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1751.21Smrg
1761.21Smrg__CLEANDEPEND: .USE
1771.21Smrg	rm -f .depend
1781.21Smrg
1791.21Smrgclean: __CLEANKERNEL
1801.21Smrg
1811.21Smrgcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1821.1Seeh
1831.1Seehlint:
1841.1Seeh	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1851.1Seeh	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
1861.1Seeh	    ioconf.c param.c | \
1871.1Seeh	    grep -v 'static function .* unused'
1881.1Seeh
1891.1Seehtags:
1901.1Seeh	@echo "see $S/kern/Makefile for tags"
1911.1Seeh
1921.1Seehlinks:
1931.1Seeh	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1941.1Seeh	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1951.1Seeh	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1961.1Seeh	  sort -u | comm -23 - dontlink | \
1971.1Seeh	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1981.1Seeh	sh makelinks && rm -f dontlink
1991.1Seeh
2001.1SeehSRCS=	${SPARC64}/sparc64/locore.s \
2011.1Seeh	param.c ioconf.c ${CFILES} ${SFILES}
2021.1Seehdepend: .depend
2031.1Seeh.depend: ${SRCS} assym.h param.c
2041.1Seeh	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
2051.1Seeh	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
2061.9Smrg.if (${SFILES} != "")
2071.1Seeh	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
2081.9Smrg.endif
2091.25Seeh	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \
2101.1Seeh	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
2111.1Seeh	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
2121.1Seeh	@rm -f assym.dep
2131.17Stron
2141.17Strondependall: depend all
2151.17Stron
2161.1Seeh
2171.1Seeh# depend on root or device configuration
2181.1Seehautoconf.o conf.o: Makefile
2191.2Smrg
2201.1Seeh# depend on network or filesystem configuration 
2211.1Seehuipc_proto.o vfs_conf.o: Makefile 
2221.1Seeh
2231.1Seeh# depend on maxusers
2241.1Seehmachdep.o: Makefile
2251.1Seeh
2261.1Seeh# depend on CPU configuration 
2271.1Seehbwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
2281.1Seehms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
2291.1Seehmachdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
2301.1Seeh
2311.1Seeh
2321.1Seehlocore.o: ${SPARC64}/sparc64/locore.s assym.h
2331.1Seeh	${NORMAL_S}
2341.23Shubertf
2351.23Shubertf# The install target can be redefined by putting a
2361.23Shubertf# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
2371.23ShubertfMACHINE_NAME!=  uname -n
2381.23Shubertfinstall: install-kernel-${MACHINE_NAME}
2391.23Shubertf.if !target(install-kernel-${MACHINE_NAME}})
2401.23Shubertfinstall-kernel-${MACHINE_NAME}:
2411.23Shubertf	rm -f /onetbsd
2421.23Shubertf	ln /netbsd /onetbsd
2431.23Shubertf	cp netbsd /nnetbsd
2441.23Shubertf	mv /nnetbsd /netbsd
2451.23Shubertf.endif
2461.1Seeh
2471.1Seeh%RULES
248