Makefile.next68k revision 1.1
11.1Sdbj# $NetBSD: Makefile.next68k,v 1.1 1998/06/09 07:53:05 dbj Exp $
21.1Sdbj
31.1Sdbj# Makefile for NetBSD
41.1Sdbj#
51.1Sdbj# This makefile is constructed from a machine description:
61.1Sdbj#	config machineid
71.1Sdbj# Most changes should be made in the machine description
81.1Sdbj#	/sys/arch/next68k/conf/``machineid''
91.1Sdbj# after which you should do
101.1Sdbj#	config machineid
111.1Sdbj# Machine generic makefile changes should be made in
121.1Sdbj#	/sys/arch/next68k/conf/Makefile.next68k
131.1Sdbj# after which config should be rerun for all machines of that type.
141.1Sdbj#
151.1Sdbj# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
161.1Sdbj#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
171.1Sdbj#
181.1Sdbj# -DTRACE	compile in kernel tracing hooks
191.1Sdbj# -DQUOTA	compile in file system quotas
201.1Sdbj
211.1Sdbj# DEBUG is set to -g if debugging.
221.1Sdbj# PROF is set to -pg if profiling.
231.1Sdbj
241.1Sdbj# since we are cross compiling, these get set wrong
251.1Sdbj# if we don't put them here.
261.1SdbjMACHINE=next68k
271.1SdbjMACHINE_ARCH=m68k
281.1Sdbj
291.1SdbjAR?=	ar
301.1SdbjAS?=	as
311.1SdbjCC?=	cc
321.1SdbjCPP?=	cpp
331.1SdbjLD?=	ld
341.1SdbjLORDER?=lorder
351.1SdbjMKDEP?=	mkdep
361.1SdbjNM?=	nm
371.1SdbjRANLIB?=ranlib
381.1SdbjSIZE?=	size
391.1SdbjSTRIP?=	strip
401.1SdbjTSORT?=	tsort -q
411.1Sdbj
421.1SdbjDEBUG=-g
431.1SdbjCOPTS?= -O2
441.1Sdbj
451.1Sdbj# source tree is located via $S relative to the compilation directory
461.1Sdbj.ifndef S
471.1SdbjS!=	cd ../../../..; pwd
481.1Sdbj.endif
491.1SdbjNEXT68K=	$S/arch/next68k
501.1Sdbj
511.1SdbjINCLUDES=	-I. -I$S/arch -I$S -nostdinc
521.1SdbjCPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
531.1Sdbj		-undef -Dmc68020 -Dnext68k -D__NetBSD__
541.1Sdbj#		-U__NeXT__ -UNeXT -U__NeXT -U_NEXT_SOURCE -U__MACH__ \
551.1Sdbj#		-DCROSS_COMPILE_NEXTSTEP
561.1Sdbj#CWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
571.1SdbjCWARNFLAGS=	-Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-format
581.1SdbjCFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
591.1SdbjAFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
601.1SdbjLINKFLAGS=	-n -Ttext 0 -e start 
611.1Sdbj#LINKFLAGS=	-seg1addr 0x4000000
621.1SdbjSTRIPFLAGS=	-d
631.1Sdbj# -S is used in gnu strip, rather than -d:
641.1Sdbj#STRIPFLAGS=	-S
651.1Sdbj
661.1Sdbj### Find out what to use for libkern.
671.1Sdbj.include "$S/lib/libkern/Makefile.inc"
681.1Sdbj.ifndef PROF
691.1SdbjLIBKERN=${KERNLIB}
701.1Sdbj.else
711.1SdbjLIBKERN=${KERNLIB_PROF}
721.1Sdbj.endif
731.1Sdbj
741.1Sdbj### Find out what to use for libcompat.
751.1Sdbj.include "$S/compat/common/Makefile.inc"
761.1Sdbj.ifndef PROF
771.1SdbjLIBCOMPAT=${COMPATLIB}
781.1Sdbj.else
791.1SdbjLIBCOMPAT=${COMPATLIB_PROF}
801.1Sdbj.endif
811.1Sdbj
821.1Sdbj### for the Motorola 68040 Floating Point Software Product
831.1Sdbj.include "$S/arch/m68k/fpsp/Makefile.inc"
841.1Sdbj
851.1Sdbj# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
861.1Sdbj# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
871.1Sdbj
881.1SdbjNORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
891.1SdbjNORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
901.1Sdbj#NORMAL_S=	${CPP} ${AFLAGS} ${CPPFLAGS} $< | sed -e 's/^\#.*//' | ${AS} -o ${.TARGET}
911.1Sdbj
921.1Sdbj%OBJS
931.1Sdbj
941.1Sdbj%CFILES
951.1Sdbj
961.1Sdbj%SFILES
971.1Sdbj
981.1Sdbj# load lines for config "xxx" will be emitted as:
991.1Sdbj# xxx: ${SYSTEM_DEP} swapxxx.o
1001.1Sdbj#	${SYSTEM_LD_HEAD}
1011.1Sdbj#	${SYSTEM_LD} swapxxx.o
1021.1Sdbj#	${SYSTEM_LD_TAIL}
1031.1SdbjSYSTEM_OBJ=	locore.o ${FPSP} \
1041.1Sdbj		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
1051.1SdbjSYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
1061.1SdbjSYSTEM_LD_HEAD=	@rm -f $@
1071.1SdbjSYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
1081.1Sdbj		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
1091.1SdbjSYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
1101.1Sdbj
1111.1SdbjDEBUG?=
1121.1Sdbj.if ${DEBUG} == "-g"
1131.1SdbjLINKFLAGS+=	-X
1141.1SdbjSYSTEM_LD_TAIL+=; \
1151.1Sdbj		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
1161.1Sdbj		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
1171.1Sdbj.else
1181.1SdbjLINKFLAGS+=	-S
1191.1Sdbj.endif
1201.1Sdbj
1211.1Sdbj%LOAD
1221.1Sdbj
1231.1Sdbjassym.h: $S/kern/genassym.sh ${NEXT68K}/next68k/genassym.cf
1241.1Sdbj	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
1251.1Sdbj	    < ${NEXT68K}/next68k/genassym.cf > assym.h.tmp && \
1261.1Sdbj	mv -f assym.h.tmp assym.h
1271.1Sdbj
1281.1Sdbjparam.c: $S/conf/param.c
1291.1Sdbj	rm -f param.c
1301.1Sdbj	cp $S/conf/param.c .
1311.1Sdbj
1321.1Sdbjparam.o: param.c Makefile
1331.1Sdbj	${NORMAL_C}
1341.1Sdbj
1351.1Sdbjioconf.o: ioconf.c
1361.1Sdbj	${NORMAL_C}
1371.1Sdbj
1381.1Sdbjnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
1391.1Sdbj	sh $S/conf/newvers.sh
1401.1Sdbj	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
1411.1Sdbj
1421.1Sdbj__CLEANKERNEL: .USE
1431.1Sdbj	@echo "${.TARGET}ing the kernel objects"
1441.1Sdbj	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
1451.1Sdbj	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
1461.1Sdbj
1471.1Sdbj__CLEANDEPEND: .USE
1481.1Sdbj	rm -f .depend
1491.1Sdbj
1501.1Sdbjclean: __CLEANKERNEL
1511.1Sdbj
1521.1Sdbjcleandir: __CLEANKERNEL __CLEANDEPEND
1531.1Sdbj
1541.1Sdbjlint:
1551.1Sdbj	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
1561.1Sdbj	    ${CFILES} ioconf.c param.c | \
1571.1Sdbj	    grep -v 'static function .* unused'
1581.1Sdbj
1591.1Sdbjtags:
1601.1Sdbj	@echo "see $S/kern/Makefile for tags"
1611.1Sdbj
1621.1Sdbjlinks:
1631.1Sdbj	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
1641.1Sdbj	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
1651.1Sdbj	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
1661.1Sdbj	  sort -u | comm -23 - dontlink | \
1671.1Sdbj	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
1681.1Sdbj	sh makelinks && rm -f dontlink
1691.1Sdbj
1701.1SdbjSRCS=	${NEXT68K}/next68k/locore.s \
1711.1Sdbj	param.c ioconf.c ${CFILES} ${SFILES}
1721.1Sdbjdepend: .depend
1731.1Sdbj.depend: ${SRCS} assym.h param.c
1741.1Sdbj	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${NEXT68K}/next68k/locore.s
1751.1Sdbj	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
1761.1Sdbj	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
1771.1Sdbj	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
1781.1Sdbj	  ${CPPFLAGS} < ${NEXT68K}/next68k/genassym.cf
1791.1Sdbj	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
1801.1Sdbj	@rm -f assym.dep
1811.1Sdbj
1821.1Sdbj
1831.1Sdbj# depend on root or device configuration
1841.1Sdbjautoconf.o conf.o: Makefile
1851.1Sdbj 
1861.1Sdbj# depend on network or filesystem configuration 
1871.1Sdbjuipc_proto.o vfs_conf.o: Makefile 
1881.1Sdbj
1891.1Sdbj# depend on maxusers
1901.1Sdbjgenassym.o machdep.o: Makefile
1911.1Sdbj
1921.1Sdbj# depend on CPU configuration 
1931.1Sdbjlocore.o pmap.o trap.o: Makefile
1941.1Sdbj
1951.1Sdbj
1961.1Sdbjlocore.o: ${NEXT68K}/next68k/locore.s assym.h
1971.1Sdbj	${NORMAL_S}
1981.1Sdbj
1991.1Sdbj%RULES
200