Makefile.powerpc revision 1.11
11.11Sthorpej#	$NetBSD: Makefile.powerpc,v 1.11 1997/11/12 23:12:26 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.11SthorpejAR?=	ar
271.11SthorpejAS?=	as
281.1SwsCC?=	cc
291.11SthorpejCPP?=	cpp
301.1SwsLD?=	ld
311.10SthorpejLORDER?=lorder
321.1SwsMKDEP?=	mkdep
331.10SthorpejNM?=	nm
341.11SthorpejRANLIB?=ranlib
351.10SthorpejSIZE?=	size
361.1SwsSTRIP?=	strip
371.10SthorpejTSORT?=	tsort -q
381.11Sthorpej
391.11SthorpejCOPTS?= -O2
401.1Sws
411.1Sws# source tree is located via $S relative to the compilation directory
421.1Sws.ifndef	S
431.1SwsS!=	cd ../../../..; pwd
441.1Sws.endif
451.1SwsPPC=	$S/arch/powerpc
461.1Sws
471.1SwsINCLUDES=	-I. -I$S/arch -I$S -nostdinc
481.6SthorpejCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
491.1Sws		-Dpowerpc
501.1SwsCWARNFLAGS=	-Werror -Wreturn-type
511.2SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
521.1SwsAFLAGS=		-D_LOCORE
531.6SthorpejLINKFLAGS=	-N -Ttext 100000 -e __start
541.6SthorpejSTRIPFLAGS=	--strip-debug
551.1Sws
561.1Sws### find out what to use for libkern
571.1Sws.include "$S/lib/libkern/Makefile.inc"
581.1Sws.ifndef PROF
591.1SwsLIBKERN=	${KERNLIB}
601.1Sws.else
611.1SwsLIBKERN=	${KERNLIB_PROF}
621.1Sws.endif
631.1Sws
641.1Sws### find out what to use for libcompat
651.1Sws.include "$S/compat/common/Makefile.inc"
661.1Sws.ifndef PROF
671.1SwsLIBCOMPAT=	${COMPATLIB}
681.1Sws.else
691.1SwsLIBCOMPAT=	${COMPATLIB_PROF}
701.1Sws.endif
711.1Sws
721.1Sws# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
731.1Sws# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
741.1Sws
751.1SwsNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
761.1Sws
771.1SwsNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
781.1Sws
791.1Sws#.c.o:
801.1Sws#	${NORMAL_C}
811.1Sws#
821.1Sws#.S.o:
831.1Sws#	${NORMAL_S}
841.1Sws
851.1Sws%OBJS
861.1Sws
871.1Sws%CFILES
881.1Sws
891.1Sws%SFILES
901.1Sws
911.1Sws# load lines for config "xxx" will be emitted as:
921.1Sws# xxx: ${SYSTEM_DEP} swapxxx.o
931.1Sws#	${SYSTEM_LD_HEAD}
941.1Sws#	${SYSTEM_LD} swapxxx.o
951.1Sws#	${SYSTEM_LD_TAIL}
961.1SwsSYSTEM_OBJ=	locore.o \
971.1Sws		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
981.1SwsSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
991.1SwsSYSTEM_LD_HEAD=	rm -f $@
1001.1SwsSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1011.1Sws		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1021.1SwsSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1031.1Sws
1041.1SwsDEBUG?=
1051.1Sws.if ${DEBUG} == "-g"
1061.1SwsLINKFLAGS+=	-X
1071.1SwsSYSTEM_LD_TAIL+=; \
1081.1Sws		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1091.1Sws		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1101.1Sws.else
1111.1SwsLINKFLAGS+=	-S
1121.1Sws.endif
1131.1Sws
1141.1Sws%LOAD
1151.1Sws
1161.7Sthorpejassym.h: $S/kern/genassym.sh ${PPC}/powerpc/genassym.cf
1171.6Sthorpej	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1181.7Sthorpej	    < ${PPC}/powerpc/genassym.cf > assym.h.tmp && \
1191.6Sthorpej	mv -f assym.h.tmp assym.h
1201.1Sws
1211.1Swsparam.c: $S/conf/param.c
1221.1Sws	rm -f param.c
1231.1Sws	cp $S/conf/param.c .
1241.1Sws
1251.1Swsparam.o: param.c Makefile
1261.1Sws	${NORMAL_C}
1271.1Sws
1281.1Swsioconf.o: ioconf.c
1291.1Sws	${NORMAL_C}
1301.1Sws
1311.1Swsnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1321.1Sws	sh $S/conf/newvers.sh
1331.1Sws	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1341.1Sws
1351.9Schristos__CLEANKERNEL: .USE
1361.9Schristos	@echo "${.TARGET}ing the kernel objects"
1371.1Sws	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1381.9Schristos	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1391.9Schristos
1401.9Schristos__CLEANDEPEND: .USE
1411.9Schristos	rm -f .depend
1421.9Schristos
1431.9Schristosclean: __CLEANKERNEL
1441.9Schristos
1451.9Schristoscleandir: __CLEANKERNEL __CLEANDEPEND
1461.1Sws
1471.1Swslint:
1481.3Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1491.4Sperry		${PPC}/powerpc/Locore.c ${CFILES} \
1501.1Sws		ioconf.c param.c | \
1511.1Sws		grep -v 'static function .* unused'
1521.1Sws
1531.1Swstags:
1541.1Sws	@echo "see $S/kern/Makefile for tags"
1551.1Sws
1561.1Swslinks:
1571.1Sws	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1581.1Sws	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1591.1Sws	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1601.1Sws	  sort -u | comm -23 - dontlink | \
1611.1Sws	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1621.1Sws	sh makelinks && rm -f dontlink
1631.1Sws
1641.1SwsSRCS=	${PPC}/powerpc/locore.S \
1651.1Sws	param.c ioconf.c ${CFILES} ${SFILES}
1661.6Sthorpejdepend: .depend
1671.1Sws.depend: ${SRCS} assym.h param.c
1681.1Sws	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${PPC}/powerpc/locore.S
1691.1Sws	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1701.1Sws.if ${SFILES} != ""
1711.1Sws	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1721.1Sws.endif
1731.8Sleo	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1741.8Sleo	  ${CPPFLAGS} < ${PPC}/powerpc/genassym.cf
1751.8Sleo	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1761.8Sleo	@rm -f assym.dep
1771.1Sws
1781.1Sws# depend on root or device configuration
1791.1Swsautoconf.o conf.o: Makefile
1801.1Sws
1811.1Sws# depend on network or filesystem configuration
1821.1Swsuipc_proto.o vfs_conf.o: Makefile
1831.1Sws
1841.1Sws# depend on maxusers
1851.6Sthorpejmachdep.o: Makefile
1861.1Sws
1871.1Sws# depend on CPU configuration
1881.1Swslocore.o machdep.o: Makefile
1891.1Sws
1901.1Sws
1911.1Swslocore.o: ${PPC}/powerpc/locore.S assym.h
1921.1Sws	${NORMAL_S}
1931.1Sws
1941.1Sws%RULES
195