Makefile.sparc64 revision 1.41
11.41Sthorpej# 	$NetBSD: Makefile.sparc64,v 1.41 2001/10/24 19:12:18 thorpej 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.40Sthorpej
241.39Sthorpej.include <bsd.own.mk>
251.39Sthorpej
261.1Seeh# DEBUG is set to -g if debugging.
271.1Seeh# PROF is set to -pg if profiling.
281.1Seeh
291.39SthorpejAR?=	ar
301.39SthorpejAS?=	as
311.1SeehCC?=	cc
321.39SthorpejCPP?=	cpp
331.39SthorpejLD?=	ld
341.39SthorpejLORDER?=lorder
351.1SeehMKDEP?=	mkdep
361.39SthorpejNM?=	nm
371.39SthorpejRANLIB?=ranlib
381.2SmrgSIZE?=	size
391.39SthorpejSTRIP?=	strip
401.39SthorpejTSORT?=	tsort -q
411.39Sthorpej
421.1SeehCOPTS?= 	-O2
431.4Smrg
441.1Seeh# source tree is located via $S relative to the compilation directory
451.1Seeh.ifndef S
461.1SeehS!=	cd ../../../..; pwd
471.1Seeh.endif
481.1SeehSPARC64=	$S/arch/sparc64
491.1Seeh
501.1SeehINCLUDES=	-I. -I$S/arch -I$S -nostdinc
511.39SthorpejCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dsparc64
521.39SthorpejCWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
531.39Sthorpej		-Wpointer-arith
541.39Sthorpej# XXX Delete -Wuninitialized for now, since the compiler doesn't
551.39Sthorpej# XXX always get it right.  --thorpej
561.32SfvdlCWARNFLAGS+=	-Wno-uninitialized
571.39SthorpejCWARNFLAGS+=	-Wno-main
581.40Sthorpej.if ${LP64} == "yes"
591.40SthorpejCPPFLAGS+=	-D_LP64
601.40Sthorpej.endif
611.40Sthorpej
621.27SmycroftCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu
631.30Seeh.if defined(PROF)
641.30Seeh# We need to run the compiler in medlow memory model.
651.40SthorpejCFLAGS+=	-mcmodel=medlow
661.30Seeh.endif
671.27SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a
681.31Seeh
691.31Seeh#
701.31Seeh# Gotta find a way to make kernel base tuneable.
711.31Seeh#
721.31Seeh
731.38SeehLINKFLAGS=	-Ttext 01000000 -Tdata 01800000 -e start
741.34Smrg#LINKFLAGS=	-Ttext f1000000 -Tdata f1400000 -e start
751.34Smrg
761.34SmrgLINKFLAGS+=	-n -T ${SPARC64}/conf/${KERN_LDSCRIPT}
771.40Sthorpej.if ${LP64} == "yes"
781.34SmrgKERN_LDSCRIPT?= kern.ldscript
791.35Smrg.else
801.35SmrgKERN_LDSCRIPT?= kern32.ldscript
811.35Smrg.endif
821.31Seeh
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.1Seehassym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
1441.27Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1451.1Seeh	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
1461.1Seeh	mv -f assym.h.tmp assym.h
1471.1Seeh
1481.1Seehparam.c: $S/conf/param.c
1491.1Seeh	rm -f param.c
1501.1Seeh	cp $S/conf/param.c .
1511.1Seeh
1521.1Seehparam.o: param.c Makefile
1531.1Seeh	${NORMAL_C}
1541.1Seeh
1551.1Seehioconf.o: ioconf.c
1561.1Seeh	${NORMAL_C}
1571.1Seeh
1581.1Seehnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1591.1Seeh	sh $S/conf/newvers.sh
1601.25Seeh	${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1611.22Seeh
1621.1Seeh
1631.21Smrg__CLEANKERNEL: .USE
1641.21Smrg	@echo "${.TARGET}ing the kernel objects"
1651.1Seeh	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1661.28Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1671.21Smrg
1681.21Smrg__CLEANDEPEND: .USE
1691.21Smrg	rm -f .depend
1701.21Smrg
1711.21Smrgclean: __CLEANKERNEL
1721.21Smrg
1731.21Smrgcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1741.1Seeh
1751.1Seehlint:
1761.1Seeh	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1771.1Seeh	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
1781.1Seeh	    ioconf.c param.c | \
1791.1Seeh	    grep -v 'static function .* unused'
1801.1Seeh
1811.1Seehtags:
1821.1Seeh	@echo "see $S/kern/Makefile for tags"
1831.1Seeh
1841.1Seehlinks:
1851.1Seeh	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1861.1Seeh	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1871.1Seeh	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1881.1Seeh	  sort -u | comm -23 - dontlink | \
1891.1Seeh	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1901.1Seeh	sh makelinks && rm -f dontlink
1911.1Seeh
1921.1SeehSRCS=	${SPARC64}/sparc64/locore.s \
1931.1Seeh	param.c ioconf.c ${CFILES} ${SFILES}
1941.1Seehdepend: .depend
1951.1Seeh.depend: ${SRCS} assym.h param.c
1961.1Seeh	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
1971.1Seeh	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1981.9Smrg.if (${SFILES} != "")
1991.1Seeh	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
2001.9Smrg.endif
2011.25Seeh	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \
2021.1Seeh	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
2031.1Seeh	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
2041.1Seeh	@rm -f assym.dep
2051.17Stron
2061.17Strondependall: depend all
2071.17Stron
2081.1Seeh
2091.1Seeh# depend on root or device configuration
2101.1Seehautoconf.o conf.o: Makefile
2111.2Smrg
2121.1Seeh# depend on network or filesystem configuration 
2131.1Seehuipc_proto.o vfs_conf.o: Makefile 
2141.1Seeh
2151.1Seeh# depend on maxusers
2161.1Seehmachdep.o: Makefile
2171.1Seeh
2181.1Seeh# depend on CPU configuration 
2191.1Seehbwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
2201.1Seehms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
2211.1Seehmachdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
2221.1Seeh
2231.1Seeh
2241.1Seehlocore.o: ${SPARC64}/sparc64/locore.s assym.h
2251.1Seeh	${NORMAL_S}
2261.23Shubertf
2271.23Shubertf# The install target can be redefined by putting a
2281.23Shubertf# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
2291.23ShubertfMACHINE_NAME!=  uname -n
2301.23Shubertfinstall: install-kernel-${MACHINE_NAME}
2311.23Shubertf.if !target(install-kernel-${MACHINE_NAME}})
2321.23Shubertfinstall-kernel-${MACHINE_NAME}:
2331.23Shubertf	rm -f /onetbsd
2341.23Shubertf	ln /netbsd /onetbsd
2351.23Shubertf	cp netbsd /nnetbsd
2361.23Shubertf	mv /nnetbsd /netbsd
2371.23Shubertf.endif
2381.1Seeh
2391.1Seeh%RULES
240