Makefile.sparc64 revision 1.32
11.32Sfvdl# 	$NetBSD: Makefile.sparc64,v 1.32 2000/12/04 16:01:18 fvdl 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.32Sfvdl#CWARNFLAGS=	-Wimplicit -Wunused -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wparentheses -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-main -Werror
681.1Seeh#CWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
691.32SfvdlCWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-main
701.32SfvdlCWARNFLAGS+=	-Wno-uninitialized
711.27SmycroftCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu
721.30Seeh.if defined(PROF)
731.30Seeh# We need to run the compiler in medlow memory model.
741.30SeehCFLAGS += -mcmodel=medlow
751.30Seeh.endif
761.27SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a
771.31Seeh
781.31Seeh#
791.31Seeh# Gotta find a way to make kernel base tuneable.
801.31Seeh#
811.31Seeh
821.31SeehLINKFLAGS=	-Ttext 01000000 -Tdata 01400000 -e start
831.31Seeh
841.31Seeh#LINKFLAGS=	-Ttext f1000000 -Tdata f1400000 -e start
851.15StsutsuiSTRIPFLAGS=	-g
861.10Smrg
871.10Smrg%INCLUDES
881.1Seeh
891.1Seeh### find out what to use for libkern
901.14Seeh# KERN_AS=	obj	# bcopy, bzero, memcpy, memset, etc. are in locore.s
911.1Seeh.include "$S/lib/libkern/Makefile.inc"
921.1Seeh.ifndef PROF
931.1SeehLIBKERN=	${KERNLIB}
941.1Seeh.else
951.1SeehLIBKERN=	${KERNLIB_PROF}
961.1Seeh.endif
971.1Seeh
981.1Seeh### find out what to use for libcompat
991.1Seeh.include "$S/compat/common/Makefile.inc"
1001.1Seeh.ifndef PROF
1011.1SeehLIBCOMPAT=	${COMPATLIB}
1021.1Seeh.else
1031.1SeehLIBCOMPAT=	${COMPATLIB_PROF}
1041.1Seeh.endif
1051.1Seeh
1061.1Seeh# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
1071.1Seeh# HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
1081.1Seeh
1091.27SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
1101.27SmycroftNOOPT_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -O0 -c $<
1111.1SeehNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
1121.1Seeh
1131.1Seeh%OBJS
1141.1Seeh
1151.1Seeh%CFILES
1161.1Seeh
1171.1Seeh%SFILES
1181.1Seeh
1191.1Seeh# load lines for config "xxx" will be emitted as:
1201.1Seeh# xxx: ${SYSTEM_DEP} swapxxx.o
1211.1Seeh#	${SYSTEM_LD_HEAD}
1221.1Seeh#	${SYSTEM_LD} swapxxx.o
1231.1Seeh#	${SYSTEM_LD_TAIL}
1241.1SeehSYSTEM_OBJ=	locore.o \
1251.6Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
1261.1SeehSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1271.27SmycroftSYSTEM_LD_HEAD=	rm -f $@
1281.1SeehSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1291.1Seeh		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1301.2SmrgSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1311.1Seeh
1321.1SeehDEBUG?=
1331.1Seeh.if ${DEBUG} == "-g"
1341.1SeehLINKFLAGS+=	-X
1351.1SeehSYSTEM_LD_TAIL+=; \
1361.12Scgd		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
1371.19Seeh		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
1381.19Seeh		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
1391.1Seeh.else
1401.1SeehLINKFLAGS+=	-S
1411.1Seeh.endif
1421.1Seeh
1431.1Seeh%LOAD
1441.2Smrg
1451.2Smrg.if ${USE_GENASSYM} == "no"
1461.1Seehassym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
1471.27Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1481.1Seeh	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
1491.1Seeh	mv -f assym.h.tmp assym.h
1501.1Seeh.else
1511.1SeehHOSTED_CC=	${CC}
1521.1SeehHOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
1531.27SmycroftHOSTED_CFLAGS=	${CFLAGS}
1541.1Seeh
1551.1SeehHOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
1561.1Seeh
1571.1Seehassym.h: genassym
1581.1Seeh	./genassym >assym.h
1591.1Seeh
1601.1Seehgenassym: genassym.o
1611.1Seeh	${CC} -o $@ genassym.o
1621.1Seeh
1631.1Seehgenassym.o: ${SPARC64}/sparc64/genassym.c
1641.1Seeh	${HOSTED_C}
1651.1Seeh.endif
1661.1Seeh
1671.1Seehparam.c: $S/conf/param.c
1681.1Seeh	rm -f param.c
1691.1Seeh	cp $S/conf/param.c .
1701.1Seeh
1711.1Seehparam.o: param.c Makefile
1721.1Seeh	${NORMAL_C}
1731.1Seeh
1741.1Seehioconf.o: ioconf.c
1751.1Seeh	${NORMAL_C}
1761.1Seeh
1771.1Seehnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1781.1Seeh	sh $S/conf/newvers.sh
1791.25Seeh	${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1801.22Seeh
1811.1Seeh
1821.21Smrg__CLEANKERNEL: .USE
1831.21Smrg	@echo "${.TARGET}ing the kernel objects"
1841.1Seeh	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1851.28Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1861.21Smrg
1871.21Smrg__CLEANDEPEND: .USE
1881.21Smrg	rm -f .depend
1891.21Smrg
1901.21Smrgclean: __CLEANKERNEL
1911.21Smrg
1921.21Smrgcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1931.1Seeh
1941.1Seehlint:
1951.1Seeh	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1961.1Seeh	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
1971.1Seeh	    ioconf.c param.c | \
1981.1Seeh	    grep -v 'static function .* unused'
1991.1Seeh
2001.1Seehtags:
2011.1Seeh	@echo "see $S/kern/Makefile for tags"
2021.1Seeh
2031.1Seehlinks:
2041.1Seeh	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
2051.1Seeh	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
2061.1Seeh	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
2071.1Seeh	  sort -u | comm -23 - dontlink | \
2081.1Seeh	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
2091.1Seeh	sh makelinks && rm -f dontlink
2101.1Seeh
2111.1SeehSRCS=	${SPARC64}/sparc64/locore.s \
2121.1Seeh	param.c ioconf.c ${CFILES} ${SFILES}
2131.1Seehdepend: .depend
2141.1Seeh.depend: ${SRCS} assym.h param.c
2151.1Seeh	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
2161.1Seeh	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
2171.9Smrg.if (${SFILES} != "")
2181.1Seeh	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
2191.9Smrg.endif
2201.25Seeh	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \
2211.1Seeh	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
2221.1Seeh	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
2231.1Seeh	@rm -f assym.dep
2241.17Stron
2251.17Strondependall: depend all
2261.17Stron
2271.1Seeh
2281.1Seeh# depend on root or device configuration
2291.1Seehautoconf.o conf.o: Makefile
2301.2Smrg
2311.1Seeh# depend on network or filesystem configuration 
2321.1Seehuipc_proto.o vfs_conf.o: Makefile 
2331.1Seeh
2341.1Seeh# depend on maxusers
2351.1Seehmachdep.o: Makefile
2361.1Seeh
2371.1Seeh# depend on CPU configuration 
2381.1Seehbwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
2391.1Seehms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
2401.1Seehmachdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
2411.1Seeh
2421.1Seeh
2431.1Seehlocore.o: ${SPARC64}/sparc64/locore.s assym.h
2441.1Seeh	${NORMAL_S}
2451.23Shubertf
2461.23Shubertf# The install target can be redefined by putting a
2471.23Shubertf# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
2481.23ShubertfMACHINE_NAME!=  uname -n
2491.23Shubertfinstall: install-kernel-${MACHINE_NAME}
2501.23Shubertf.if !target(install-kernel-${MACHINE_NAME}})
2511.23Shubertfinstall-kernel-${MACHINE_NAME}:
2521.23Shubertf	rm -f /onetbsd
2531.23Shubertf	ln /netbsd /onetbsd
2541.23Shubertf	cp netbsd /nnetbsd
2551.23Shubertf	mv /nnetbsd /netbsd
2561.23Shubertf.endif
2571.1Seeh
2581.1Seeh%RULES
259