Makefile.sparc64 revision 1.39
11.39Sthorpej# 	$NetBSD: Makefile.sparc64,v 1.39 2001/10/21 19:46:16 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.39Sthorpej.include <bsd.own.mk>
161.39Sthorpej
171.1Seeh# DEBUG is set to -g if debugging.
181.1Seeh# PROF is set to -pg if profiling.
191.1Seeh
201.39SthorpejAR?=	ar
211.39SthorpejAS?=	as
221.1SeehCC?=	cc
231.39SthorpejCPP?=	cpp
241.39SthorpejLD?=	ld
251.39SthorpejLORDER?=lorder
261.1SeehMKDEP?=	mkdep
271.39SthorpejNM?=	nm
281.39SthorpejRANLIB?=ranlib
291.2SmrgSIZE?=	size
301.39SthorpejSTRIP?=	strip
311.39SthorpejTSORT?=	tsort -q
321.39Sthorpej
331.1SeehCOPTS?= 	-O2
341.4Smrg
351.1Seeh# source tree is located via $S relative to the compilation directory
361.1Seeh.ifndef S
371.1SeehS!=	cd ../../../..; pwd
381.1Seeh.endif
391.1SeehSPARC64=	$S/arch/sparc64
401.1Seeh
411.1SeehINCLUDES=	-I. -I$S/arch -I$S -nostdinc
421.39SthorpejCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dsparc64
431.39SthorpejCWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
441.39Sthorpej		-Wpointer-arith
451.39Sthorpej# XXX Delete -Wuninitialized for now, since the compiler doesn't
461.39Sthorpej# XXX always get it right.  --thorpej
471.32SfvdlCWARNFLAGS+=	-Wno-uninitialized
481.39SthorpejCWARNFLAGS+=	-Wno-main
491.27SmycroftCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu
501.30Seeh.if defined(PROF)
511.30Seeh# We need to run the compiler in medlow memory model.
521.30SeehCFLAGS += -mcmodel=medlow
531.30Seeh.endif
541.27SmycroftAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a
551.31Seeh
561.31Seeh#
571.31Seeh# Gotta find a way to make kernel base tuneable.
581.31Seeh#
591.31Seeh
601.38SeehLINKFLAGS=	-Ttext 01000000 -Tdata 01800000 -e start
611.34Smrg#LINKFLAGS=	-Ttext f1000000 -Tdata f1400000 -e start
621.34Smrg
631.34SmrgLINKFLAGS+=	-n -T ${SPARC64}/conf/${KERN_LDSCRIPT}
641.35Smrg.if ${MACHINE_ARCH} == "sparc64"
651.34SmrgKERN_LDSCRIPT?= kern.ldscript
661.35Smrg.else
671.35SmrgKERN_LDSCRIPT?= kern32.ldscript
681.35Smrg.endif
691.31Seeh
701.15StsutsuiSTRIPFLAGS=	-g
711.10Smrg
721.10Smrg%INCLUDES
731.1Seeh
741.1Seeh### find out what to use for libkern
751.14Seeh# KERN_AS=	obj	# bcopy, bzero, memcpy, memset, etc. are in locore.s
761.1Seeh.include "$S/lib/libkern/Makefile.inc"
771.1Seeh.ifndef PROF
781.1SeehLIBKERN=	${KERNLIB}
791.1Seeh.else
801.1SeehLIBKERN=	${KERNLIB_PROF}
811.1Seeh.endif
821.1Seeh
831.1Seeh### find out what to use for libcompat
841.1Seeh.include "$S/compat/common/Makefile.inc"
851.1Seeh.ifndef PROF
861.1SeehLIBCOMPAT=	${COMPATLIB}
871.1Seeh.else
881.1SeehLIBCOMPAT=	${COMPATLIB_PROF}
891.1Seeh.endif
901.1Seeh
911.1Seeh# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
921.1Seeh# HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
931.1Seeh
941.27SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
951.27SmycroftNOOPT_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -O0 -c $<
961.1SeehNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
971.1Seeh
981.1Seeh%OBJS
991.1Seeh
1001.1Seeh%CFILES
1011.1Seeh
1021.1Seeh%SFILES
1031.1Seeh
1041.1Seeh# load lines for config "xxx" will be emitted as:
1051.1Seeh# xxx: ${SYSTEM_DEP} swapxxx.o
1061.1Seeh#	${SYSTEM_LD_HEAD}
1071.1Seeh#	${SYSTEM_LD} swapxxx.o
1081.1Seeh#	${SYSTEM_LD_TAIL}
1091.1SeehSYSTEM_OBJ=	locore.o \
1101.6Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
1111.1SeehSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1121.27SmycroftSYSTEM_LD_HEAD=	rm -f $@
1131.1SeehSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1141.1Seeh		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1151.2SmrgSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1161.1Seeh
1171.1SeehDEBUG?=
1181.1Seeh.if ${DEBUG} == "-g"
1191.1SeehLINKFLAGS+=	-X
1201.1SeehSYSTEM_LD_TAIL+=; \
1211.12Scgd		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
1221.19Seeh		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
1231.19Seeh		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
1241.1Seeh.else
1251.1SeehLINKFLAGS+=	-S
1261.1Seeh.endif
1271.1Seeh
1281.1Seeh%LOAD
1291.2Smrg
1301.1Seehassym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
1311.27Smycroft	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1321.1Seeh	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
1331.1Seeh	mv -f assym.h.tmp assym.h
1341.1Seeh
1351.1Seehparam.c: $S/conf/param.c
1361.1Seeh	rm -f param.c
1371.1Seeh	cp $S/conf/param.c .
1381.1Seeh
1391.1Seehparam.o: param.c Makefile
1401.1Seeh	${NORMAL_C}
1411.1Seeh
1421.1Seehioconf.o: ioconf.c
1431.1Seeh	${NORMAL_C}
1441.1Seeh
1451.1Seehnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1461.1Seeh	sh $S/conf/newvers.sh
1471.25Seeh	${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1481.22Seeh
1491.1Seeh
1501.21Smrg__CLEANKERNEL: .USE
1511.21Smrg	@echo "${.TARGET}ing the kernel objects"
1521.1Seeh	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1531.28Smycroft	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1541.21Smrg
1551.21Smrg__CLEANDEPEND: .USE
1561.21Smrg	rm -f .depend
1571.21Smrg
1581.21Smrgclean: __CLEANKERNEL
1591.21Smrg
1601.21Smrgcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1611.1Seeh
1621.1Seehlint:
1631.1Seeh	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1641.1Seeh	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
1651.1Seeh	    ioconf.c param.c | \
1661.1Seeh	    grep -v 'static function .* unused'
1671.1Seeh
1681.1Seehtags:
1691.1Seeh	@echo "see $S/kern/Makefile for tags"
1701.1Seeh
1711.1Seehlinks:
1721.1Seeh	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1731.1Seeh	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1741.1Seeh	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1751.1Seeh	  sort -u | comm -23 - dontlink | \
1761.1Seeh	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1771.1Seeh	sh makelinks && rm -f dontlink
1781.1Seeh
1791.1SeehSRCS=	${SPARC64}/sparc64/locore.s \
1801.1Seeh	param.c ioconf.c ${CFILES} ${SFILES}
1811.1Seehdepend: .depend
1821.1Seeh.depend: ${SRCS} assym.h param.c
1831.1Seeh	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
1841.1Seeh	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1851.9Smrg.if (${SFILES} != "")
1861.1Seeh	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1871.9Smrg.endif
1881.25Seeh	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \
1891.1Seeh	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
1901.1Seeh	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1911.1Seeh	@rm -f assym.dep
1921.17Stron
1931.17Strondependall: depend all
1941.17Stron
1951.1Seeh
1961.1Seeh# depend on root or device configuration
1971.1Seehautoconf.o conf.o: Makefile
1981.2Smrg
1991.1Seeh# depend on network or filesystem configuration 
2001.1Seehuipc_proto.o vfs_conf.o: Makefile 
2011.1Seeh
2021.1Seeh# depend on maxusers
2031.1Seehmachdep.o: Makefile
2041.1Seeh
2051.1Seeh# depend on CPU configuration 
2061.1Seehbwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
2071.1Seehms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
2081.1Seehmachdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
2091.1Seeh
2101.1Seeh
2111.1Seehlocore.o: ${SPARC64}/sparc64/locore.s assym.h
2121.1Seeh	${NORMAL_S}
2131.23Shubertf
2141.23Shubertf# The install target can be redefined by putting a
2151.23Shubertf# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
2161.23ShubertfMACHINE_NAME!=  uname -n
2171.23Shubertfinstall: install-kernel-${MACHINE_NAME}
2181.23Shubertf.if !target(install-kernel-${MACHINE_NAME}})
2191.23Shubertfinstall-kernel-${MACHINE_NAME}:
2201.23Shubertf	rm -f /onetbsd
2211.23Shubertf	ln /netbsd /onetbsd
2221.23Shubertf	cp netbsd /nnetbsd
2231.23Shubertf	mv /nnetbsd /netbsd
2241.23Shubertf.endif
2251.1Seeh
2261.1Seeh%RULES
227