Makefile.powerpc revision 1.6
11.6Sthorpej#	$NetBSD: Makefile.powerpc,v 1.6 1997/04/16 23:26:06 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.1SwsMKDEP?=	mkdep
291.1SwsSTRIP?=	strip
301.1SwsSIZE?=	size
311.2SjonathanCOPTS?= 	-O2
321.1Sws
331.1Sws# source tree is located via $S relative to the compilation directory
341.1Sws.ifndef	S
351.1SwsS!=	cd ../../../..; pwd
361.1Sws.endif
371.1SwsPPC=	$S/arch/powerpc
381.1Sws
391.1SwsINCLUDES=	-I. -I$S/arch -I$S -nostdinc
401.6SthorpejCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
411.1Sws		-Dpowerpc
421.1SwsCWARNFLAGS=	-Werror -Wreturn-type
431.2SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
441.1SwsAFLAGS=		-D_LOCORE
451.6SthorpejLINKFLAGS=	-N -Ttext 100000 -e __start
461.6SthorpejSTRIPFLAGS=	--strip-debug
471.1Sws
481.1Sws### find out what to use for libkern
491.1Sws.include "$S/lib/libkern/Makefile.inc"
501.1Sws.ifndef PROF
511.1SwsLIBKERN=	${KERNLIB}
521.1Sws.else
531.1SwsLIBKERN=	${KERNLIB_PROF}
541.1Sws.endif
551.1Sws
561.1Sws### find out what to use for libcompat
571.1Sws.include "$S/compat/common/Makefile.inc"
581.1Sws.ifndef PROF
591.1SwsLIBCOMPAT=	${COMPATLIB}
601.1Sws.else
611.1SwsLIBCOMPAT=	${COMPATLIB_PROF}
621.1Sws.endif
631.1Sws
641.1Sws# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
651.1Sws# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
661.1Sws
671.1SwsNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
681.1Sws
691.1SwsNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
701.1Sws
711.1Sws#.c.o:
721.1Sws#	${NORMAL_C}
731.1Sws#
741.1Sws#.S.o:
751.1Sws#	${NORMAL_S}
761.1Sws
771.1Sws%OBJS
781.1Sws
791.1Sws%CFILES
801.1Sws
811.1Sws%SFILES
821.1Sws
831.1Sws# load lines for config "xxx" will be emitted as:
841.1Sws# xxx: ${SYSTEM_DEP} swapxxx.o
851.1Sws#	${SYSTEM_LD_HEAD}
861.1Sws#	${SYSTEM_LD} swapxxx.o
871.1Sws#	${SYSTEM_LD_TAIL}
881.1SwsSYSTEM_OBJ=	locore.o \
891.1Sws		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
901.1SwsSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
911.1SwsSYSTEM_LD_HEAD=	rm -f $@
921.1SwsSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
931.1Sws		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
941.1SwsSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
951.1Sws
961.1SwsDEBUG?=
971.1Sws.if ${DEBUG} == "-g"
981.1SwsLINKFLAGS+=	-X
991.1SwsSYSTEM_LD_TAIL+=; \
1001.1Sws		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1011.1Sws		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1021.1Sws.else
1031.1SwsLINKFLAGS+=	-S
1041.1Sws.endif
1051.1Sws
1061.1Sws%LOAD
1071.1Sws
1081.6Sthorpejassym.h: $S/kern/genassym.sh ${PPC}/hp300/genassym.cf
1091.6Sthorpej	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1101.6Sthorpej	    < ${PPC}/hp300/genassym.cf > assym.h.tmp && \
1111.6Sthorpej	mv -f assym.h.tmp assym.h
1121.1Sws
1131.1Swsparam.c: $S/conf/param.c
1141.1Sws	rm -f param.c
1151.1Sws	cp $S/conf/param.c .
1161.1Sws
1171.1Swsparam.o: param.c Makefile
1181.1Sws	${NORMAL_C}
1191.1Sws
1201.1Swsioconf.o: ioconf.c
1211.1Sws	${NORMAL_C}
1221.1Sws
1231.1Swsnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1241.1Sws	sh $S/conf/newvers.sh
1251.1Sws	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1261.1Sws
1271.5Smycroftclean: cleankernel
1281.5Smycroftcleankernel:
1291.1Sws	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1301.6Sthorpej		[Ee]rrs linterrs makelinks assym.h
1311.1Sws
1321.1Swslint:
1331.3Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1341.4Sperry		${PPC}/powerpc/Locore.c ${CFILES} \
1351.1Sws		ioconf.c param.c | \
1361.1Sws		grep -v 'static function .* unused'
1371.1Sws
1381.1Swstags:
1391.1Sws	@echo "see $S/kern/Makefile for tags"
1401.1Sws
1411.1Swslinks:
1421.1Sws	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1431.1Sws	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1441.1Sws	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1451.1Sws	  sort -u | comm -23 - dontlink | \
1461.1Sws	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1471.1Sws	sh makelinks && rm -f dontlink
1481.1Sws
1491.1SwsSRCS=	${PPC}/powerpc/locore.S \
1501.1Sws	param.c ioconf.c ${CFILES} ${SFILES}
1511.6Sthorpejdepend: .depend
1521.1Sws.depend: ${SRCS} assym.h param.c
1531.1Sws	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${PPC}/powerpc/locore.S
1541.1Sws	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1551.1Sws.if ${SFILES} != ""
1561.1Sws	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1571.1Sws.endif
1581.1Sws
1591.1Sws# depend on root or device configuration
1601.1Swsautoconf.o conf.o: Makefile
1611.1Sws
1621.1Sws# depend on network or filesystem configuration
1631.1Swsuipc_proto.o vfs_conf.o: Makefile
1641.1Sws
1651.1Sws# depend on maxusers
1661.6Sthorpejmachdep.o: Makefile
1671.1Sws
1681.1Sws# depend on CPU configuration
1691.1Swslocore.o machdep.o: Makefile
1701.1Sws
1711.1Sws
1721.1Swslocore.o: ${PPC}/powerpc/locore.S assym.h
1731.1Sws	${NORMAL_S}
1741.1Sws
1751.1Sws%RULES
176