Makefile.alpha revision 1.47
11.47Sthorpej# $NetBSD: Makefile.alpha,v 1.47 1999/01/15 23:37:05 thorpej Exp $
21.10Smycroft
31.1Scgd# Makefile for NetBSD
41.1Scgd#
51.1Scgd# This makefile is constructed from a machine description:
61.1Scgd#	config machineid
71.1Scgd# Most changes should be made in the machine description
81.10Smycroft#	/sys/arch/alpha/conf/``machineid''
91.1Scgd# after which you should do
101.10Smycroft#	config machineid
111.1Scgd# Machine generic makefile changes should be made in
121.10Smycroft#	/sys/arch/alpha/conf/Makefile.alpha
131.1Scgd# after which config should be rerun for all machines of that type.
141.1Scgd#
151.1Scgd# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
161.1Scgd#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
171.1Scgd#
181.1Scgd# -DTRACE	compile in kernel tracing hooks
191.1Scgd# -DQUOTA	compile in file system quotas
201.1Scgd
211.1Scgd# DEBUG is set to -g if debugging.
221.1Scgd# PROF is set to -pg if profiling.
231.1Scgd
241.40SthorpejAR?=	ar
251.40SthorpejAS?=	as
261.13SmycroftCC?=	cc
271.34ScgdCPP?=	cpp
281.13SmycroftLD?=	ld
291.39SthorpejLORDER?=lorder
301.19SmycroftMKDEP?=	mkdep
311.39SthorpejNM?=	nm
321.40SthorpejRANLIB?=ranlib
331.34ScgdSIZE?=	size
341.24SmycroftSTRIP?=	strip
351.39SthorpejTSORT?=	tsort -q
361.1Scgd
371.1Scgd# source tree is located via $S relative to the compilation directory
381.23Smycroft.ifndef S
391.19SmycroftS!=	cd ../../../..; pwd
401.23Smycroft.endif
411.19SmycroftALPHA=	$S/arch/alpha
421.1Scgd
431.42StvHAVE_GCC28!=	${CC} --version | egrep "^(2\.8|egcs)" ; echo 
441.20SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
451.47SthorpejCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -Dalpha
461.34ScgdCOPTS?=		-O2
471.26ScgdCWARNFLAGS?=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
481.46Saugustss		-Wno-format -Wpointer-arith
491.42Stv.if (${HAVE_GCC28} != "")
501.42StvCWARNFLAGS+=	-Wno-main
511.42Stv.endif
521.27SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -mno-fp-regs
531.25ScgdAFLAGS=		-traditional -D_LOCORE
541.41SrossLOADADDRESS?=	fffffc0000300000
551.38SrossLINKFLAGS=	-N -Ttext ${LOADADDRESS} -e __transfer -G 4
561.24SmycroftSTRIPFLAGS=	-g -X -x
571.24Smycroft
581.1Scgd### find out what to use for libkern
591.1Scgd.include "$S/lib/libkern/Makefile.inc"
601.1Scgd.ifndef PROF
611.1ScgdLIBKERN=	${KERNLIB}
621.1Scgd.else
631.1ScgdLIBKERN=	${KERNLIB_PROF}
641.1Scgd.endif
651.1Scgd
661.5Schristos### find out what to use for libcompat
671.5Schristos.include "$S/compat/common/Makefile.inc"
681.5Schristos.ifndef PROF
691.5SchristosLIBCOMPAT=	${COMPATLIB}
701.5Schristos.else
711.5SchristosLIBCOMPAT=	${COMPATLIB_PROF}
721.5Schristos.endif
731.5Schristos
741.21Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
751.21Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
761.1Scgd
771.10SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
781.43SthorpejNOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
791.25ScgdNORMAL_S=	${CPP} ${AFLAGS} ${CPPFLAGS} $< | sed -e 's,^\#.*,,' | ${AS} -o ${.TARGET}
801.1Scgd
811.1Scgd%OBJS
821.1Scgd
831.1Scgd%CFILES
841.1Scgd
851.10Smycroft%SFILES
861.10Smycroft
871.1Scgd# load lines for config "xxx" will be emitted as:
881.1Scgd# xxx: ${SYSTEM_DEP} swapxxx.o
891.1Scgd#	${SYSTEM_LD_HEAD}
901.1Scgd#	${SYSTEM_LD} swapxxx.o
911.1Scgd#	${SYSTEM_LD_TAIL}
921.38SrossSYSTEM_OBJ=	locore.o transfer.o \
931.45Sdrochner		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
941.1ScgdSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
951.10SmycroftSYSTEM_LD_HEAD=	@rm -f $@
961.10SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
971.10Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
981.34ScgdSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
991.10Smycroft
1001.10SmycroftDEBUG?=
1011.8Scgd.if ${DEBUG} == "-g"
1021.10SmycroftLINKFLAGS+=	-X
1031.10SmycroftSYSTEM_LD_TAIL+=; \
1041.10Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1051.24Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1061.8Scgd.else
1071.19SmycroftLINKFLAGS+=	-S
1081.8Scgd.endif
1091.1Scgd
1101.1Scgd%LOAD
1111.1Scgd
1121.34Scgd# Use awk to cross-build assym.h from the genassym.s file.
1131.37Sgwrassym.h: genassym.o $S/kern/genassym.awk
1141.37Sgwr	awk -f $S/kern/genassym.awk < genassym.s > $@
1151.34Scgd
1161.34Scgd# The above rule lists genassym.o as a prerequisite so that the
1171.34Scgd# generated .depend rule is effective, even though we actually
1181.34Scgd# use genassym.s instead.   This always creates both.
1191.10Smycroftgenassym.o: ${ALPHA}/alpha/genassym.c
1201.34Scgd	${CC} ${CPPFLAGS} -S $<
1211.34Scgd	${CC} -c $*.s
1221.10Smycroft
1231.10Smycroftparam.c: $S/conf/param.c
1241.10Smycroft	rm -f param.c
1251.10Smycroft	cp $S/conf/param.c .
1261.1Scgd
1271.10Smycroftparam.o: param.c Makefile
1281.21Smycroft	${NORMAL_C}
1291.1Scgd
1301.10Smycroftioconf.o: ioconf.c
1311.10Smycroft	${NORMAL_C}
1321.1Scgd
1331.10Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1341.10Smycroft	sh $S/conf/newvers.sh
1351.10Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1361.1Scgd
1371.1Scgd
1381.36Schristos__CLEANKERNEL: .USE
1391.36Schristos	@echo "${.TARGET}ing the kernel objects"
1401.14Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1411.36Schristos	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1421.36Schristos
1431.36Schristos__CLEANDEPEND: .USE
1441.36Schristos	rm -f .depend
1451.36Schristos
1461.36Schristosclean: __CLEANKERNEL
1471.36Schristos
1481.44Slukemcleandir distclean: __CLEANKERNEL __CLEANDEPEND
1491.1Scgd
1501.10Smycroftlint:
1511.31Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1521.32Sperry	    ${ALPHA}/alpha/Locore.c ${CFILES} \
1531.10Smycroft	    ioconf.c param.c | \
1541.10Smycroft	    grep -v 'static function .* unused'
1551.1Scgd
1561.10Smycrofttags:
1571.10Smycroft	@echo "see $S/kern/Makefile for tags"
1581.1Scgd
1591.1Scgdlinks:
1601.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1611.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1621.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1631.1Scgd	  sort -u | comm -23 - dontlink | \
1641.10Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1651.1Scgd	sh makelinks && rm -f dontlink
1661.1Scgd
1671.38SrossSRCS=	${ALPHA}/alpha/locore.s ${ALPHA}/alpha/transfer.s \
1681.14Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1691.30Scgddepend: .depend
1701.14Scgd.depend: ${SRCS} assym.h param.c
1711.35Scgd	${MKDEP} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \
1721.35Scgd	    ${ALPHA}/alpha/locore.s
1731.38Sross	${MKDEP} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \
1741.38Sross	    ${ALPHA}/alpha/transfer.s
1751.19Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1761.35Scgd	${MKDEP} -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${SFILES}
1771.34Scgd	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} ${ALPHA}/alpha/genassym.c
1781.10Smycroft
1791.1Scgd
1801.10Smycroft# depend on root or device configuration
1811.10Smycroftautoconf.o conf.o: Makefile
1821.10Smycroft 
1831.10Smycroft# depend on network or filesystem configuration 
1841.10Smycroftuipc_proto.o vfs_conf.o: Makefile 
1851.10Smycroft
1861.10Smycroft# depend on maxusers
1871.10Smycroftgenassym.o machdep.o: Makefile
1881.1Scgd
1891.10Smycroft# depend on CPU configuration 
1901.10Smycroftclock.o machdep.o apecs.o cia.o lca.o ioasic.o scc.o icasic.o: Makefile
1911.1Scgd
1921.10Smycroftlocore.o: ${ALPHA}/alpha/locore.s assym.h
1931.38Sross	${NORMAL_S}
1941.38Sross
1951.38Srosstransfer.o: ${ALPHA}/alpha/transfer.s
1961.10Smycroft	${NORMAL_S}
1971.1Scgd
1981.1Scgd%RULES
199