Makefile.sparc64 revision 1.42
11.42Sjmc# 	$NetBSD: Makefile.sparc64,v 1.42 2001/10/26 06:45:40 jmc 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.41Sthorpej# Default to 32-bit.  Set the MACHINE_ARCH accordingly, using either
161.41Sthorpej# the 32-bit or 64-bit toolchain.
171.41SthorpejLP64?=	no
181.41Sthorpej.if ${LP64} == "yes"
191.40SthorpejMACHINE_ARCH=sparc64
201.41Sthorpej.else
211.41SthorpejMACHINE_ARCH=sparc
221.41Sthorpej.endif
231.42Sjmc
241.42SjmcUSETOOLS?=	no
251.40Sthorpej
261.39Sthorpej.include <bsd.own.mk>
271.39Sthorpej
281.1Seeh# DEBUG is set to -g if debugging.
291.1Seeh# PROF is set to -pg if profiling.
301.1Seeh
311.39SthorpejAR?=	ar
321.39SthorpejAS?=	as
331.1SeehCC?=	cc
341.39SthorpejCPP?=	cpp
351.39SthorpejLD?=	ld
361.39SthorpejLORDER?=lorder
371.1SeehMKDEP?=	mkdep
381.39SthorpejNM?=	nm
391.39SthorpejRANLIB?=ranlib
401.2SmrgSIZE?=	size
411.39SthorpejSTRIP?=	strip
421.39SthorpejTSORT?=	tsort -q
431.39Sthorpej
441.1SeehCOPTS?= 	-O2
451.4Smrg
461.1Seeh# source tree is located via $S relative to the compilation directory
471.1Seeh.ifndef S
481.1SeehS!=	cd ../../../..; pwd
491.1Seeh.endif
501.1SeehSPARC64=	$S/arch/sparc64
511.1Seeh
521.1SeehINCLUDES=	-I. -I$S/arch -I$S -nostdinc
531.39SthorpejCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dsparc64
541.39SthorpejCWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
551.39Sthorpej		-Wpointer-arith
561.39Sthorpej# XXX Delete -Wuninitialized for now, since the compiler doesn't
571.39Sthorpej# XXX always get it right.  --thorpej
581.32SfvdlCWARNFLAGS+=	-Wno-uninitialized
591.39SthorpejCWARNFLAGS+=	-Wno-main
601.40Sthorpej.if ${LP64} == "yes"
611.40SthorpejCPPFLAGS+=	-D_LP64
621.40Sthorpej.endif
631.40Sthorpej
641.27SmycroftCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu
651.30Seeh.if defined(PROF)
661.30Seeh# We need to run the compiler in medlow memory model.
671.40SthorpejCFLAGS+=	-mcmodel=medlow
681.30Seeh.endif
691.27SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a
701.31Seeh
711.31Seeh#
721.31Seeh# Gotta find a way to make kernel base tuneable.
731.31Seeh#
741.31Seeh
751.38SeehLINKFLAGS=	-Ttext 01000000 -Tdata 01800000 -e start
761.34Smrg#LINKFLAGS=	-Ttext f1000000 -Tdata f1400000 -e start
771.34Smrg
781.34SmrgLINKFLAGS+=	-n -T ${SPARC64}/conf/${KERN_LDSCRIPT}
791.40Sthorpej.if ${LP64} == "yes"
801.34SmrgKERN_LDSCRIPT?= kern.ldscript
811.35Smrg.else
821.35SmrgKERN_LDSCRIPT?= kern32.ldscript
831.35Smrg.endif
841.31Seeh
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.1Seehassym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
1461.27Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1471.1Seeh	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
1481.1Seeh	mv -f assym.h.tmp assym.h
1491.1Seeh
1501.1Seehparam.c: $S/conf/param.c
1511.1Seeh	rm -f param.c
1521.1Seeh	cp $S/conf/param.c .
1531.1Seeh
1541.1Seehparam.o: param.c Makefile
1551.1Seeh	${NORMAL_C}
1561.1Seeh
1571.1Seehioconf.o: ioconf.c
1581.1Seeh	${NORMAL_C}
1591.1Seeh
1601.1Seehnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1611.1Seeh	sh $S/conf/newvers.sh
1621.25Seeh	${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1631.22Seeh
1641.1Seeh
1651.21Smrg__CLEANKERNEL: .USE
1661.21Smrg	@echo "${.TARGET}ing the kernel objects"
1671.1Seeh	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1681.28Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1691.21Smrg
1701.21Smrg__CLEANDEPEND: .USE
1711.21Smrg	rm -f .depend
1721.21Smrg
1731.21Smrgclean: __CLEANKERNEL
1741.21Smrg
1751.21Smrgcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1761.1Seeh
1771.1Seehlint:
1781.1Seeh	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1791.1Seeh	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
1801.1Seeh	    ioconf.c param.c | \
1811.1Seeh	    grep -v 'static function .* unused'
1821.1Seeh
1831.1Seehtags:
1841.1Seeh	@echo "see $S/kern/Makefile for tags"
1851.1Seeh
1861.1Seehlinks:
1871.1Seeh	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1881.1Seeh	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1891.1Seeh	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1901.1Seeh	  sort -u | comm -23 - dontlink | \
1911.1Seeh	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1921.1Seeh	sh makelinks && rm -f dontlink
1931.1Seeh
1941.1SeehSRCS=	${SPARC64}/sparc64/locore.s \
1951.1Seeh	param.c ioconf.c ${CFILES} ${SFILES}
1961.1Seehdepend: .depend
1971.1Seeh.depend: ${SRCS} assym.h param.c
1981.1Seeh	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
1991.1Seeh	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
2001.9Smrg.if (${SFILES} != "")
2011.1Seeh	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
2021.9Smrg.endif
2031.25Seeh	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \
2041.1Seeh	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
2051.1Seeh	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
2061.1Seeh	@rm -f assym.dep
2071.17Stron
2081.17Strondependall: depend all
2091.17Stron
2101.1Seeh
2111.1Seeh# depend on root or device configuration
2121.1Seehautoconf.o conf.o: Makefile
2131.2Smrg
2141.1Seeh# depend on network or filesystem configuration 
2151.1Seehuipc_proto.o vfs_conf.o: Makefile 
2161.1Seeh
2171.1Seeh# depend on maxusers
2181.1Seehmachdep.o: Makefile
2191.1Seeh
2201.1Seeh# depend on CPU configuration 
2211.1Seehbwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
2221.1Seehms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
2231.1Seehmachdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
2241.1Seeh
2251.1Seeh
2261.1Seehlocore.o: ${SPARC64}/sparc64/locore.s assym.h
2271.1Seeh	${NORMAL_S}
2281.23Shubertf
2291.23Shubertf# The install target can be redefined by putting a
2301.23Shubertf# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
2311.23ShubertfMACHINE_NAME!=  uname -n
2321.23Shubertfinstall: install-kernel-${MACHINE_NAME}
2331.23Shubertf.if !target(install-kernel-${MACHINE_NAME}})
2341.23Shubertfinstall-kernel-${MACHINE_NAME}:
2351.23Shubertf	rm -f /onetbsd
2361.23Shubertf	ln /netbsd /onetbsd
2371.23Shubertf	cp netbsd /nnetbsd
2381.23Shubertf	mv /nnetbsd /netbsd
2391.23Shubertf.endif
2401.1Seeh
2411.1Seeh%RULES
242