Makefile.mvme68k revision 1.27
1#	$NetBSD: Makefile.mvme68k,v 1.27 1997/09/12 07:55:19 mycroft Exp $
2
3# Makefile for NetBSD
4#
5# This makefile is constructed from a machine description:
6#	config machineid
7# Most changes should be made in the machine description
8#	/sys/arch/mvme68k/conf/``machineid''
9# after which you should do
10#	config machineid
11# Machine generic makefile changes should be made in
12#	/sys/arch/mvme68k/conf/Makefile.mvme68k
13# after which config should be rerun for all machines of that type.
14#
15# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
16#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
17#
18# -DTRACE	compile in kernel tracing hooks
19# -DQUOTA	compile in file system quotas
20
21# DEBUG is set to -g if debugging.
22# PROF is set to -pg if profiling.
23
24CC?=	cc
25LD?=	ld
26MKDEP?=	mkdep
27STRIP?=	strip
28COPTS?= 	-O2
29
30# source tree is located via $S relative to the compilation directory
31.ifndef S
32S!=	cd ../../../..; pwd
33.endif
34MVME68K=$S/arch/mvme68k
35
36# Override CPP defaults entirely, so cross-compilation works.
37# Keep -nostdinc before all -I flags, similar for -undef ...
38INCLUDES=	-nostdinc -I. -I$S/arch -I$S
39CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
40		-Dmc68020 -Dmvme68k -DFPCOPROC
41CWARNFLAGS=	-Werror
42CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
43AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
44LINKFLAGS=	-n -Ttext 8000 -e start
45STRIPFLAGS=	-d
46
47HOSTED_CC=	${CC}
48HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
49HOSTED_CFLAGS=	${CFLAGS}
50
51### find out what to use for libkern
52.include "$S/lib/libkern/Makefile.inc"
53.ifndef PROF
54LIBKERN=	${KERNLIB}
55.else
56LIBKERN=	${KERNLIB_PROF}
57.endif
58
59### find out what to use for libcompat
60.include "$S/compat/common/Makefile.inc"
61.ifndef PROF
62LIBCOMPAT=	${COMPATLIB}
63.else
64LIBCOMPAT=	${COMPATLIB_PROF}
65.endif
66
67### for the Motorola 68040 Floating Point Software Product
68.include "$S/arch/m68k/fpsp/Makefile.inc"
69
70# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
71# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
72
73NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
74NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
75
76HOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
77
78%OBJS
79
80%CFILES
81
82%SFILES
83
84# load lines for config "xxx" will be emitted as:
85# xxx: ${SYSTEM_DEP} swapxxx.o
86#	${SYSTEM_LD_HEAD}
87#	${SYSTEM_LD} swapxxx.o
88#	${SYSTEM_LD_TAIL}
89SYSTEM_OBJ=	locore.o ${FPSP} \
90		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
91SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
92SYSTEM_LD_HEAD=	@rm -f $@
93SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
94		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
95SYSTEM_LD_TAIL=	@size $@; chmod 755 $@
96
97DEBUG?=
98.if ${DEBUG} == "-g"
99LINKFLAGS+=	-X
100SYSTEM_LD_TAIL+=; \
101		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
102		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
103.else
104LINKFLAGS+=	-S
105.endif
106
107%LOAD
108
109assym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
110	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
111	    < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
112	mv -f assym.h.tmp assym.h
113
114param.c: $S/conf/param.c
115	rm -f param.c
116	cp $S/conf/param.c .
117
118param.o: param.c Makefile
119	${NORMAL_C}
120
121ioconf.o: ioconf.c
122	${NORMAL_C}
123
124newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
125	sh $S/conf/newvers.sh
126	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
127
128
129clean: cleankernel
130cleankernel:
131	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
132	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
133
134lint:
135	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
136	    ${CFILES} ioconf.c param.c | \
137	    grep -v 'static function .* unused'
138
139tags:
140	@echo "see $S/kern/Makefile for tags"
141
142links:
143	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
144	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
145	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
146	  sort -u | comm -23 - dontlink | \
147	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
148	sh makelinks && rm -f dontlink
149
150SRCS=	${MVME68K}/mvme68k/locore.s \
151	param.c ioconf.c ${CFILES} ${SFILES}
152depend: .depend
153.depend: ${SRCS} assym.h param.c
154	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
155	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
156	-if test -n "${SFILES}"; then \
157		${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
158	fi
159	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
160	  ${CPPFLAGS} < ${MVME68K}/mvme68k/genassym.cf
161	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
162	@rm -f assym.dep
163
164
165# depend on root or device configuration
166autoconf.o conf.o: Makefile
167 
168# depend on network or filesystem configuration 
169uipc_proto.o vfs_conf.o: Makefile 
170
171# depend on maxusers
172machdep.o: Makefile
173
174# depend on CPU configuration 
175locore.o pmap.o sys_machdep.o trap.o: Makefile
176
177
178locore.o: ${MVME68K}/mvme68k/locore.s assym.h
179	${NORMAL_S}
180
181%RULES
182