Makefile.sparc64 revision 1.31
11.31Seeh# 	$NetBSD: Makefile.sparc64,v 1.31 2000/09/28 19:56:15 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.31Seeh
761.31Seeh#
771.31Seeh# Gotta find a way to make kernel base tuneable.
781.31Seeh#
791.31Seeh
801.31SeehLINKFLAGS=	-Ttext 01000000 -Tdata 01400000 -e start
811.31Seeh
821.31Seeh#LINKFLAGS=	-Ttext f1000000 -Tdata f1400000 -e start
831.15StsutsuiSTRIPFLAGS=	-g
841.10Smrg
851.10Smrg%INCLUDES
861.1Seeh
871.1Seeh### find out what to use for libkern
881.14Seeh# KERN_AS=	obj	# bcopy, bzero, memcpy, memset, etc. are in locore.s
891.1Seeh.include "$S/lib/libkern/Makefile.inc"
901.1Seeh.ifndef PROF
911.1SeehLIBKERN=	${KERNLIB}
921.1Seeh.else
931.1SeehLIBKERN=	${KERNLIB_PROF}
941.1Seeh.endif
951.1Seeh
961.1Seeh### find out what to use for libcompat
971.1Seeh.include "$S/compat/common/Makefile.inc"
981.1Seeh.ifndef PROF
991.1SeehLIBCOMPAT=	${COMPATLIB}
1001.1Seeh.else
1011.1SeehLIBCOMPAT=	${COMPATLIB_PROF}
1021.1Seeh.endif
1031.1Seeh
1041.1Seeh# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
1051.1Seeh# HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
1061.1Seeh
1071.27SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
1081.27SmycroftNOOPT_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -O0 -c $<
1091.1SeehNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
1101.1Seeh
1111.1Seeh%OBJS
1121.1Seeh
1131.1Seeh%CFILES
1141.1Seeh
1151.1Seeh%SFILES
1161.1Seeh
1171.1Seeh# load lines for config "xxx" will be emitted as:
1181.1Seeh# xxx: ${SYSTEM_DEP} swapxxx.o
1191.1Seeh#	${SYSTEM_LD_HEAD}
1201.1Seeh#	${SYSTEM_LD} swapxxx.o
1211.1Seeh#	${SYSTEM_LD_TAIL}
1221.1SeehSYSTEM_OBJ=	locore.o \
1231.6Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
1241.1SeehSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1251.27SmycroftSYSTEM_LD_HEAD=	rm -f $@
1261.1SeehSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1271.1Seeh		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1281.2SmrgSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1291.1Seeh
1301.1SeehDEBUG?=
1311.1Seeh.if ${DEBUG} == "-g"
1321.1SeehLINKFLAGS+=	-X
1331.1SeehSYSTEM_LD_TAIL+=; \
1341.12Scgd		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
1351.19Seeh		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
1361.19Seeh		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
1371.1Seeh.else
1381.1SeehLINKFLAGS+=	-S
1391.1Seeh.endif
1401.1Seeh
1411.1Seeh%LOAD
1421.2Smrg
1431.2Smrg.if ${USE_GENASSYM} == "no"
1441.1Seehassym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
1451.27Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1461.1Seeh	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
1471.1Seeh	mv -f assym.h.tmp assym.h
1481.1Seeh.else
1491.1SeehHOSTED_CC=	${CC}
1501.1SeehHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
1511.27SmycroftHOSTED_CFLAGS=	${CFLAGS}
1521.1Seeh
1531.1SeehHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
1541.1Seeh
1551.1Seehassym.h: genassym
1561.1Seeh	./genassym >assym.h
1571.1Seeh
1581.1Seehgenassym: genassym.o
1591.1Seeh	${CC} -o $@ genassym.o
1601.1Seeh
1611.1Seehgenassym.o: ${SPARC64}/sparc64/genassym.c
1621.1Seeh	${HOSTED_C}
1631.1Seeh.endif
1641.1Seeh
1651.1Seehparam.c: $S/conf/param.c
1661.1Seeh	rm -f param.c
1671.1Seeh	cp $S/conf/param.c .
1681.1Seeh
1691.1Seehparam.o: param.c Makefile
1701.1Seeh	${NORMAL_C}
1711.1Seeh
1721.1Seehioconf.o: ioconf.c
1731.1Seeh	${NORMAL_C}
1741.1Seeh
1751.1Seehnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1761.1Seeh	sh $S/conf/newvers.sh
1771.25Seeh	${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1781.22Seeh
1791.1Seeh
1801.21Smrg__CLEANKERNEL: .USE
1811.21Smrg	@echo "${.TARGET}ing the kernel objects"
1821.1Seeh	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1831.28Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1841.21Smrg
1851.21Smrg__CLEANDEPEND: .USE
1861.21Smrg	rm -f .depend
1871.21Smrg
1881.21Smrgclean: __CLEANKERNEL
1891.21Smrg
1901.21Smrgcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1911.1Seeh
1921.1Seehlint:
1931.1Seeh	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1941.1Seeh	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
1951.1Seeh	    ioconf.c param.c | \
1961.1Seeh	    grep -v 'static function .* unused'
1971.1Seeh
1981.1Seehtags:
1991.1Seeh	@echo "see $S/kern/Makefile for tags"
2001.1Seeh
2011.1Seehlinks:
2021.1Seeh	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
2031.1Seeh	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
2041.1Seeh	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
2051.1Seeh	  sort -u | comm -23 - dontlink | \
2061.1Seeh	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
2071.1Seeh	sh makelinks && rm -f dontlink
2081.1Seeh
2091.1SeehSRCS=	${SPARC64}/sparc64/locore.s \
2101.1Seeh	param.c ioconf.c ${CFILES} ${SFILES}
2111.1Seehdepend: .depend
2121.1Seeh.depend: ${SRCS} assym.h param.c
2131.1Seeh	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
2141.1Seeh	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
2151.9Smrg.if (${SFILES} != "")
2161.1Seeh	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
2171.9Smrg.endif
2181.25Seeh	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \
2191.1Seeh	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
2201.1Seeh	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
2211.1Seeh	@rm -f assym.dep
2221.17Stron
2231.17Strondependall: depend all
2241.17Stron
2251.1Seeh
2261.1Seeh# depend on root or device configuration
2271.1Seehautoconf.o conf.o: Makefile
2281.2Smrg
2291.1Seeh# depend on network or filesystem configuration 
2301.1Seehuipc_proto.o vfs_conf.o: Makefile 
2311.1Seeh
2321.1Seeh# depend on maxusers
2331.1Seehmachdep.o: Makefile
2341.1Seeh
2351.1Seeh# depend on CPU configuration 
2361.1Seehbwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
2371.1Seehms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
2381.1Seehmachdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
2391.1Seeh
2401.1Seeh
2411.1Seehlocore.o: ${SPARC64}/sparc64/locore.s assym.h
2421.1Seeh	${NORMAL_S}
2431.23Shubertf
2441.23Shubertf# The install target can be redefined by putting a
2451.23Shubertf# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
2461.23ShubertfMACHINE_NAME!=  uname -n
2471.23Shubertfinstall: install-kernel-${MACHINE_NAME}
2481.23Shubertf.if !target(install-kernel-${MACHINE_NAME}})
2491.23Shubertfinstall-kernel-${MACHINE_NAME}:
2501.23Shubertf	rm -f /onetbsd
2511.23Shubertf	ln /netbsd /onetbsd
2521.23Shubertf	cp netbsd /nnetbsd
2531.23Shubertf	mv /nnetbsd /netbsd
2541.23Shubertf.endif
2551.1Seeh
2561.1Seeh%RULES
257