Makefile.sparc64 revision 1.30
11.30Seeh# 	$NetBSD: Makefile.sparc64,v 1.30 2000/08/02 22:24:38 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.22Seeh.if defined(MAKECONF) && exists(${MAKECONF})
251.22Seeh.include "${MAKECONF}"
261.22Seeh.elif exists(/etc/mk.conf)
271.5Seeh.include "/etc/mk.conf"
281.22Seeh.endif
291.5Seeh
301.1SeehCC?=	cc
311.9Smrg.if exists(/usr/ccs/bin/ld)
321.1SeehLD?=	/usr/ccs/bin/ld #Need to use Solaris ld to use the solaris loader
331.9Smrg.endif
341.1SeehMKDEP?=	mkdep
351.18SeehSTRIP?=strip
361.2SmrgSIZE?=	size
371.1SeehCOPTS?= 	-O2
381.5Seeh#### Stuff for cross compiling
391.5SeehNM?=nm
401.5SeehLORDER?=lorder
411.5SeehTSORT?=tsort
421.5Seeh
431.1Seeh
441.4Smrg# deal with Solaris vs. NetBSD build environments for now ..
451.4SmrgOS!=uname -s
461.4Smrg.if (${OS} == "NetBSD")
471.4SmrgUSE_GENASSYM?=	no
481.4Smrg.else
491.11SeehUSE_GENASSYM?=	no
501.11SeehAWK=nawk
511.9Smrg.endif
521.9Smrg
531.9Smrg.if exists(/usr/ccs/bin/ld)
541.4SmrgSVR4=-U__SVR4 -U__svr4__ -D__NetBSD__
551.9Smrg.else
561.9SmrgSVR4=
571.4Smrg.endif
581.4Smrg
591.1Seeh# source tree is located via $S relative to the compilation directory
601.1Seeh.ifndef S
611.1SeehS!=	cd ../../../..; pwd
621.1Seeh.endif
631.1SeehSPARC64=	$S/arch/sparc64
641.1Seeh
651.1SeehINCLUDES=	-I. -I$S/arch -I$S -nostdinc
661.4SmrgCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL ${SVR4}
671.20SmrgCWARNFLAGS=	-Wimplicit -Wunused -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wparentheses -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
681.1Seeh#CWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
691.27SmycroftCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu
701.30Seeh.if defined(PROF)
711.30Seeh# We need to run the compiler in medlow memory model.
721.30SeehCFLAGS += -mcmodel=medlow
731.30Seeh.endif
741.27SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a
751.29SmycroftLINKFLAGS=	-Ttext f1000000 -Tdata f1400000 -e start
761.29Smycroft#LINKFLAGS=	-N -Ttext f1000000 -e start
771.15StsutsuiSTRIPFLAGS=	-g
781.10Smrg
791.10Smrg%INCLUDES
801.1Seeh
811.1Seeh### find out what to use for libkern
821.14Seeh# KERN_AS=	obj	# bcopy, bzero, memcpy, memset, etc. are in locore.s
831.1Seeh.include "$S/lib/libkern/Makefile.inc"
841.1Seeh.ifndef PROF
851.1SeehLIBKERN=	${KERNLIB}
861.1Seeh.else
871.1SeehLIBKERN=	${KERNLIB_PROF}
881.1Seeh.endif
891.1Seeh
901.1Seeh### find out what to use for libcompat
911.1Seeh.include "$S/compat/common/Makefile.inc"
921.1Seeh.ifndef PROF
931.1SeehLIBCOMPAT=	${COMPATLIB}
941.1Seeh.else
951.1SeehLIBCOMPAT=	${COMPATLIB_PROF}
961.1Seeh.endif
971.1Seeh
981.1Seeh# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
991.1Seeh# HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
1001.1Seeh
1011.27SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
1021.27SmycroftNOOPT_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -O0 -c $<
1031.1SeehNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
1041.1Seeh
1051.1Seeh%OBJS
1061.1Seeh
1071.1Seeh%CFILES
1081.1Seeh
1091.1Seeh%SFILES
1101.1Seeh
1111.1Seeh# load lines for config "xxx" will be emitted as:
1121.1Seeh# xxx: ${SYSTEM_DEP} swapxxx.o
1131.1Seeh#	${SYSTEM_LD_HEAD}
1141.1Seeh#	${SYSTEM_LD} swapxxx.o
1151.1Seeh#	${SYSTEM_LD_TAIL}
1161.1SeehSYSTEM_OBJ=	locore.o \
1171.6Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
1181.1SeehSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1191.27SmycroftSYSTEM_LD_HEAD=	rm -f $@
1201.1SeehSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1211.1Seeh		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1221.2SmrgSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1231.1Seeh
1241.1SeehDEBUG?=
1251.1Seeh.if ${DEBUG} == "-g"
1261.1SeehLINKFLAGS+=	-X
1271.1SeehSYSTEM_LD_TAIL+=; \
1281.12Scgd		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
1291.19Seeh		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
1301.19Seeh		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
1311.1Seeh.else
1321.1SeehLINKFLAGS+=	-S
1331.1Seeh.endif
1341.1Seeh
1351.1Seeh%LOAD
1361.2Smrg
1371.2Smrg.if ${USE_GENASSYM} == "no"
1381.1Seehassym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
1391.27Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1401.1Seeh	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
1411.1Seeh	mv -f assym.h.tmp assym.h
1421.1Seeh.else
1431.1SeehHOSTED_CC=	${CC}
1441.1SeehHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
1451.27SmycroftHOSTED_CFLAGS=	${CFLAGS}
1461.1Seeh
1471.1SeehHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
1481.1Seeh
1491.1Seehassym.h: genassym
1501.1Seeh	./genassym >assym.h
1511.1Seeh
1521.1Seehgenassym: genassym.o
1531.1Seeh	${CC} -o $@ genassym.o
1541.1Seeh
1551.1Seehgenassym.o: ${SPARC64}/sparc64/genassym.c
1561.1Seeh	${HOSTED_C}
1571.1Seeh.endif
1581.1Seeh
1591.1Seehparam.c: $S/conf/param.c
1601.1Seeh	rm -f param.c
1611.1Seeh	cp $S/conf/param.c .
1621.1Seeh
1631.1Seehparam.o: param.c Makefile
1641.1Seeh	${NORMAL_C}
1651.1Seeh
1661.1Seehioconf.o: ioconf.c
1671.1Seeh	${NORMAL_C}
1681.1Seeh
1691.1Seehnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1701.1Seeh	sh $S/conf/newvers.sh
1711.25Seeh	${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1721.22Seeh
1731.1Seeh
1741.21Smrg__CLEANKERNEL: .USE
1751.21Smrg	@echo "${.TARGET}ing the kernel objects"
1761.1Seeh	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1771.28Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1781.21Smrg
1791.21Smrg__CLEANDEPEND: .USE
1801.21Smrg	rm -f .depend
1811.21Smrg
1821.21Smrgclean: __CLEANKERNEL
1831.21Smrg
1841.21Smrgcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1851.1Seeh
1861.1Seehlint:
1871.1Seeh	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1881.1Seeh	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
1891.1Seeh	    ioconf.c param.c | \
1901.1Seeh	    grep -v 'static function .* unused'
1911.1Seeh
1921.1Seehtags:
1931.1Seeh	@echo "see $S/kern/Makefile for tags"
1941.1Seeh
1951.1Seehlinks:
1961.1Seeh	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1971.1Seeh	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1981.1Seeh	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1991.1Seeh	  sort -u | comm -23 - dontlink | \
2001.1Seeh	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
2011.1Seeh	sh makelinks && rm -f dontlink
2021.1Seeh
2031.1SeehSRCS=	${SPARC64}/sparc64/locore.s \
2041.1Seeh	param.c ioconf.c ${CFILES} ${SFILES}
2051.1Seehdepend: .depend
2061.1Seeh.depend: ${SRCS} assym.h param.c
2071.1Seeh	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
2081.1Seeh	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
2091.9Smrg.if (${SFILES} != "")
2101.1Seeh	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
2111.9Smrg.endif
2121.25Seeh	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \
2131.1Seeh	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
2141.1Seeh	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
2151.1Seeh	@rm -f assym.dep
2161.17Stron
2171.17Strondependall: depend all
2181.17Stron
2191.1Seeh
2201.1Seeh# depend on root or device configuration
2211.1Seehautoconf.o conf.o: Makefile
2221.2Smrg
2231.1Seeh# depend on network or filesystem configuration 
2241.1Seehuipc_proto.o vfs_conf.o: Makefile 
2251.1Seeh
2261.1Seeh# depend on maxusers
2271.1Seehmachdep.o: Makefile
2281.1Seeh
2291.1Seeh# depend on CPU configuration 
2301.1Seehbwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
2311.1Seehms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
2321.1Seehmachdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
2331.1Seeh
2341.1Seeh
2351.1Seehlocore.o: ${SPARC64}/sparc64/locore.s assym.h
2361.1Seeh	${NORMAL_S}
2371.23Shubertf
2381.23Shubertf# The install target can be redefined by putting a
2391.23Shubertf# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
2401.23ShubertfMACHINE_NAME!=  uname -n
2411.23Shubertfinstall: install-kernel-${MACHINE_NAME}
2421.23Shubertf.if !target(install-kernel-${MACHINE_NAME}})
2431.23Shubertfinstall-kernel-${MACHINE_NAME}:
2441.23Shubertf	rm -f /onetbsd
2451.23Shubertf	ln /netbsd /onetbsd
2461.23Shubertf	cp netbsd /nnetbsd
2471.23Shubertf	mv /nnetbsd /netbsd
2481.23Shubertf.endif
2491.1Seeh
2501.1Seeh%RULES
251