Makefile.alpha revision 1.35
11.35Scgd# $NetBSD: Makefile.alpha,v 1.35 1997/08/22 06:37:17 cgd 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.13SmycroftCC?=	cc
251.34ScgdCPP?=	cpp
261.13SmycroftLD?=	ld
271.19SmycroftMKDEP?=	mkdep
281.34ScgdSIZE?=	size
291.24SmycroftSTRIP?=	strip
301.1Scgd
311.1Scgd# source tree is located via $S relative to the compilation directory
321.23Smycroft.ifndef S
331.19SmycroftS!=	cd ../../../..; pwd
341.23Smycroft.endif
351.19SmycroftALPHA=	$S/arch/alpha
361.1Scgd
371.20SmycroftINCLUDES=	-I. -I$S/arch -I$S -nostdinc
381.21SmycroftCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
391.21Smycroft		-Dalpha
401.34ScgdCOPTS?=		-O2
411.26ScgdCWARNFLAGS?=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
421.28Scgd		-Wno-format
431.27SjonathanCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -mno-fp-regs
441.25ScgdAFLAGS=		-traditional -D_LOCORE
451.29ScgdLOADADDRESS?=	fffffc0000230000
461.29ScgdLINKFLAGS=	-N -Ttext ${LOADADDRESS} -e __start -G 4
471.24SmycroftSTRIPFLAGS=	-g -X -x
481.24Smycroft
491.1Scgd### find out what to use for libkern
501.1Scgd.include "$S/lib/libkern/Makefile.inc"
511.1Scgd.ifndef PROF
521.1ScgdLIBKERN=	${KERNLIB}
531.1Scgd.else
541.1ScgdLIBKERN=	${KERNLIB_PROF}
551.1Scgd.endif
561.1Scgd
571.5Schristos### find out what to use for libcompat
581.5Schristos.include "$S/compat/common/Makefile.inc"
591.5Schristos.ifndef PROF
601.5SchristosLIBCOMPAT=	${COMPATLIB}
611.5Schristos.else
621.5SchristosLIBCOMPAT=	${COMPATLIB_PROF}
631.5Schristos.endif
641.5Schristos
651.21Smycroft# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
661.21Smycroft# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
671.1Scgd
681.10SmycroftNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
691.25ScgdNORMAL_S=	${CPP} ${AFLAGS} ${CPPFLAGS} $< | sed -e 's,^\#.*,,' | ${AS} -o ${.TARGET}
701.1Scgd
711.1Scgd%OBJS
721.1Scgd
731.1Scgd%CFILES
741.1Scgd
751.10Smycroft%SFILES
761.10Smycroft
771.1Scgd# load lines for config "xxx" will be emitted as:
781.1Scgd# xxx: ${SYSTEM_DEP} swapxxx.o
791.1Scgd#	${SYSTEM_LD_HEAD}
801.1Scgd#	${SYSTEM_LD} swapxxx.o
811.1Scgd#	${SYSTEM_LD_TAIL}
821.10SmycroftSYSTEM_OBJ=	locore.o \
831.14Scgd		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
841.1ScgdSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
851.10SmycroftSYSTEM_LD_HEAD=	@rm -f $@
861.10SmycroftSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
871.10Smycroft		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
881.34ScgdSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
891.10Smycroft
901.10SmycroftDEBUG?=
911.8Scgd.if ${DEBUG} == "-g"
921.10SmycroftLINKFLAGS+=	-X
931.10SmycroftSYSTEM_LD_TAIL+=; \
941.10Smycroft		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
951.24Smycroft		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
961.8Scgd.else
971.19SmycroftLINKFLAGS+=	-S
981.8Scgd.endif
991.1Scgd
1001.1Scgd%LOAD
1011.1Scgd
1021.34Scgd# Use awk to cross-build assym.h from the genassym.s file.
1031.34Scgdassym.h: genassym.o ${ALPHA}/alpha/genassym.awk
1041.34Scgd	awk -f ${ALPHA}/alpha/genassym.awk < genassym.s > $@
1051.34Scgd
1061.34Scgd# The above rule lists genassym.o as a prerequisite so that the
1071.34Scgd# generated .depend rule is effective, even though we actually
1081.34Scgd# use genassym.s instead.   This always creates both.
1091.10Smycroftgenassym.o: ${ALPHA}/alpha/genassym.c
1101.34Scgd	${CC} ${CPPFLAGS} -S $<
1111.34Scgd	${CC} -c $*.s
1121.10Smycroft
1131.10Smycroftparam.c: $S/conf/param.c
1141.10Smycroft	rm -f param.c
1151.10Smycroft	cp $S/conf/param.c .
1161.1Scgd
1171.10Smycroftparam.o: param.c Makefile
1181.21Smycroft	${NORMAL_C}
1191.1Scgd
1201.10Smycroftioconf.o: ioconf.c
1211.10Smycroft	${NORMAL_C}
1221.1Scgd
1231.10Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1241.10Smycroft	sh $S/conf/newvers.sh
1251.10Smycroft	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1261.1Scgd
1271.1Scgd
1281.30Scgdclean: cleankernel
1291.30Scgdcleankernel:
1301.14Scgd	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1311.10Smycroft	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
1321.1Scgd
1331.10Smycroftlint:
1341.31Sperry	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1351.32Sperry	    ${ALPHA}/alpha/Locore.c ${CFILES} \
1361.10Smycroft	    ioconf.c param.c | \
1371.10Smycroft	    grep -v 'static function .* unused'
1381.1Scgd
1391.10Smycrofttags:
1401.10Smycroft	@echo "see $S/kern/Makefile for tags"
1411.1Scgd
1421.1Scgdlinks:
1431.1Scgd	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1441.1Scgd	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1451.1Scgd	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1461.1Scgd	  sort -u | comm -23 - dontlink | \
1471.10Smycroft	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1481.1Scgd	sh makelinks && rm -f dontlink
1491.1Scgd
1501.10SmycroftSRCS=	${ALPHA}/alpha/locore.s \
1511.14Scgd	param.c ioconf.c ${CFILES} ${SFILES}
1521.30Scgddepend: .depend
1531.14Scgd.depend: ${SRCS} assym.h param.c
1541.35Scgd	${MKDEP} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \
1551.35Scgd	    ${ALPHA}/alpha/locore.s
1561.19Smycroft	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1571.35Scgd	${MKDEP} -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${SFILES}
1581.34Scgd	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} ${ALPHA}/alpha/genassym.c
1591.10Smycroft
1601.1Scgd
1611.10Smycroft# depend on root or device configuration
1621.10Smycroftautoconf.o conf.o: Makefile
1631.10Smycroft 
1641.10Smycroft# depend on network or filesystem configuration 
1651.10Smycroftuipc_proto.o vfs_conf.o: Makefile 
1661.10Smycroft
1671.10Smycroft# depend on maxusers
1681.10Smycroftgenassym.o machdep.o: Makefile
1691.1Scgd
1701.10Smycroft# depend on CPU configuration 
1711.10Smycroftclock.o machdep.o apecs.o cia.o lca.o ioasic.o scc.o icasic.o: Makefile
1721.1Scgd
1731.10Smycroftlocore.o: ${ALPHA}/alpha/locore.s assym.h
1741.10Smycroft	${NORMAL_S}
1751.1Scgd
1761.1Scgd%RULES
177