Makefile.powerpc revision 1.10
11.10Sthorpej#	$NetBSD: Makefile.powerpc,v 1.10 1997/11/12 22:26:27 thorpej Exp $
21.1Sws#
31.1Sws# Makefile for NetBSD
41.1Sws#
51.1Sws# This makefile is constructed from a machine description:
61.1Sws#	config machineid
71.1Sws# Most changes should be made in the machine description
81.1Sws#	/sys/arch/powerpc/conf/``machineid''
91.1Sws# after which you should do
101.1Sws#	config machineid
111.1Sws# Machine generic makefile changes should be made in
121.1Sws#	/sys/arch/powerpc/conf/Makefile.powerpc
131.1Sws# after which config should be rerun for all machines of that type.
141.1Sws#
151.1Sws# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
161.1Sws#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
171.1Sws#
181.1Sws# -DTRACE	compile in kernel tracing hooks
191.1Sws# -DQUOTA	compile in file system quotas
201.1Sws#
211.1Sws.SUFFIXES:	.S .c .o
221.1Sws
231.1Sws# DEBUG is set to -g if debugging.
241.1Sws# PROF is set to -pg if profiling.
251.1Sws
261.1SwsCC?=	cc
271.1SwsLD?=	ld
281.10SthorpejLORDER?=lorder
291.1SwsMKDEP?=	mkdep
301.10SthorpejNM?=	nm
311.10SthorpejSIZE?=	size
321.1SwsSTRIP?=	strip
331.10SthorpejTSORT?=	tsort -q
341.2SjonathanCOPTS?= 	-O2
351.1Sws
361.1Sws# source tree is located via $S relative to the compilation directory
371.1Sws.ifndef	S
381.1SwsS!=	cd ../../../..; pwd
391.1Sws.endif
401.1SwsPPC=	$S/arch/powerpc
411.1Sws
421.1SwsINCLUDES=	-I. -I$S/arch -I$S -nostdinc
431.6SthorpejCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
441.1Sws		-Dpowerpc
451.1SwsCWARNFLAGS=	-Werror -Wreturn-type
461.2SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
471.1SwsAFLAGS=		-D_LOCORE
481.6SthorpejLINKFLAGS=	-N -Ttext 100000 -e __start
491.6SthorpejSTRIPFLAGS=	--strip-debug
501.1Sws
511.1Sws### find out what to use for libkern
521.1Sws.include "$S/lib/libkern/Makefile.inc"
531.1Sws.ifndef PROF
541.1SwsLIBKERN=	${KERNLIB}
551.1Sws.else
561.1SwsLIBKERN=	${KERNLIB_PROF}
571.1Sws.endif
581.1Sws
591.1Sws### find out what to use for libcompat
601.1Sws.include "$S/compat/common/Makefile.inc"
611.1Sws.ifndef PROF
621.1SwsLIBCOMPAT=	${COMPATLIB}
631.1Sws.else
641.1SwsLIBCOMPAT=	${COMPATLIB_PROF}
651.1Sws.endif
661.1Sws
671.1Sws# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
681.1Sws# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
691.1Sws
701.1SwsNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
711.1Sws
721.1SwsNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
731.1Sws
741.1Sws#.c.o:
751.1Sws#	${NORMAL_C}
761.1Sws#
771.1Sws#.S.o:
781.1Sws#	${NORMAL_S}
791.1Sws
801.1Sws%OBJS
811.1Sws
821.1Sws%CFILES
831.1Sws
841.1Sws%SFILES
851.1Sws
861.1Sws# load lines for config "xxx" will be emitted as:
871.1Sws# xxx: ${SYSTEM_DEP} swapxxx.o
881.1Sws#	${SYSTEM_LD_HEAD}
891.1Sws#	${SYSTEM_LD} swapxxx.o
901.1Sws#	${SYSTEM_LD_TAIL}
911.1SwsSYSTEM_OBJ=	locore.o \
921.1Sws		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
931.1SwsSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
941.1SwsSYSTEM_LD_HEAD=	rm -f $@
951.1SwsSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
961.1Sws		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
971.1SwsSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
981.1Sws
991.1SwsDEBUG?=
1001.1Sws.if ${DEBUG} == "-g"
1011.1SwsLINKFLAGS+=	-X
1021.1SwsSYSTEM_LD_TAIL+=; \
1031.1Sws		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1041.1Sws		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1051.1Sws.else
1061.1SwsLINKFLAGS+=	-S
1071.1Sws.endif
1081.1Sws
1091.1Sws%LOAD
1101.1Sws
1111.7Sthorpejassym.h: $S/kern/genassym.sh ${PPC}/powerpc/genassym.cf
1121.6Sthorpej	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1131.7Sthorpej	    < ${PPC}/powerpc/genassym.cf > assym.h.tmp && \
1141.6Sthorpej	mv -f assym.h.tmp assym.h
1151.1Sws
1161.1Swsparam.c: $S/conf/param.c
1171.1Sws	rm -f param.c
1181.1Sws	cp $S/conf/param.c .
1191.1Sws
1201.1Swsparam.o: param.c Makefile
1211.1Sws	${NORMAL_C}
1221.1Sws
1231.1Swsioconf.o: ioconf.c
1241.1Sws	${NORMAL_C}
1251.1Sws
1261.1Swsnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1271.1Sws	sh $S/conf/newvers.sh
1281.1Sws	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1291.1Sws
1301.9Schristos__CLEANKERNEL: .USE
1311.9Schristos	@echo "${.TARGET}ing the kernel objects"
1321.1Sws	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1331.9Schristos	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1341.9Schristos
1351.9Schristos__CLEANDEPEND: .USE
1361.9Schristos	rm -f .depend
1371.9Schristos
1381.9Schristosclean: __CLEANKERNEL
1391.9Schristos
1401.9Schristoscleandir: __CLEANKERNEL __CLEANDEPEND
1411.1Sws
1421.1Swslint:
1431.3Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1441.4Sperry		${PPC}/powerpc/Locore.c ${CFILES} \
1451.1Sws		ioconf.c param.c | \
1461.1Sws		grep -v 'static function .* unused'
1471.1Sws
1481.1Swstags:
1491.1Sws	@echo "see $S/kern/Makefile for tags"
1501.1Sws
1511.1Swslinks:
1521.1Sws	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1531.1Sws	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1541.1Sws	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1551.1Sws	  sort -u | comm -23 - dontlink | \
1561.1Sws	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1571.1Sws	sh makelinks && rm -f dontlink
1581.1Sws
1591.1SwsSRCS=	${PPC}/powerpc/locore.S \
1601.1Sws	param.c ioconf.c ${CFILES} ${SFILES}
1611.6Sthorpejdepend: .depend
1621.1Sws.depend: ${SRCS} assym.h param.c
1631.1Sws	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${PPC}/powerpc/locore.S
1641.1Sws	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1651.1Sws.if ${SFILES} != ""
1661.1Sws	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1671.1Sws.endif
1681.8Sleo	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1691.8Sleo	  ${CPPFLAGS} < ${PPC}/powerpc/genassym.cf
1701.8Sleo	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1711.8Sleo	@rm -f assym.dep
1721.1Sws
1731.1Sws# depend on root or device configuration
1741.1Swsautoconf.o conf.o: Makefile
1751.1Sws
1761.1Sws# depend on network or filesystem configuration
1771.1Swsuipc_proto.o vfs_conf.o: Makefile
1781.1Sws
1791.1Sws# depend on maxusers
1801.6Sthorpejmachdep.o: Makefile
1811.1Sws
1821.1Sws# depend on CPU configuration
1831.1Swslocore.o machdep.o: Makefile
1841.1Sws
1851.1Sws
1861.1Swslocore.o: ${PPC}/powerpc/locore.S assym.h
1871.1Sws	${NORMAL_S}
1881.1Sws
1891.1Sws%RULES
190