Makefile.mvme68k revision 1.23
1#	$NetBSD: Makefile.mvme68k,v 1.23 1997/03/17 22:16:03 gwr 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
24# Simplify cross-build...
25MACHINE_ARCH=m68k
26MACHINE=mvme68k
27
28CC?=	cc
29LD?=	ld
30MKDEP?=	mkdep
31STRIP?=	strip
32COPTS?= 	-O2
33
34# source tree is located via $S relative to the compilation directory
35.ifndef S
36S!=	cd ../../../..; pwd
37.endif
38MVME68K=$S/arch/mvme68k
39
40# Override CPP defaults entirely, so cross-compilation works.
41# Keep -nostdinc before all -I flags, similar for -undef ...
42INCLUDES=	-nostdinc -I. -I$S/arch -I$S
43XDEFS=		-undef -D__NetBSD__ -Dm68k -Dmc68000
44DEFINES=	-D_KERNEL -Dmc68020 -Dmvme68k
45CPPFLAGS=	${INCLUDES} ${XDEFS} ${DEFINES} ${IDENT} ${PARAM}
46CWARNFLAGS=	-Werror
47CFLAGS= 	${DEBUG} ${COPTS} -msoft-float ${CWARNFLAGS}
48APPFLAGS=	-P -traditional ${CPPFLAGS} -D_LOCORE
49AFLAGS= 	-m68030
50LINKFLAGS=	-n -Ttext 8000 -e start
51STRIPFLAGS=	-d
52
53### find out what to use for libkern
54.include "$S/lib/libkern/Makefile.inc"
55.ifndef PROF
56LIBKERN=	${KERNLIB}
57.else
58LIBKERN=	${KERNLIB_PROF}
59.endif
60
61### find out what to use for libcompat
62.include "$S/compat/common/Makefile.inc"
63.ifndef PROF
64LIBCOMPAT=	${COMPATLIB}
65.else
66LIBCOMPAT=	${COMPATLIB_PROF}
67.endif
68
69### for the Motorola 68040 Floating Point Software Product
70.include "$S/arch/m68k/fpsp/Makefile.inc"
71
72# compile rules: rules are named NORMAL_${SUFFIX} where SUFFIX is
73# the file suffix, capitalized (e.g. C for a .c file).
74
75NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
76
77# Please do not assume the compiler does "-x ..." (gcc-only).
78# This needs an intermediate file.  The original file is always
79# safe in some far away directory, so just use the base name.
80NORMAL_S=	${CPP} ${APPFLAGS} $< > $*.s ;\
81		${AS} ${AFLAGS} -o $@ $*.s ; rm $*.s
82
83%OBJS
84
85%CFILES
86
87%SFILES
88
89# load lines for config "xxx" will be emitted as:
90# xxx: ${SYSTEM_DEP} swapxxx.o
91#	${SYSTEM_LD_HEAD}
92#	${SYSTEM_LD} swapxxx.o
93#	${SYSTEM_LD_TAIL}
94SYSTEM_OBJ=	locore.o ${FPSP} \
95		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
96SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
97SYSTEM_LD_HEAD=	@rm -f $@
98SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
99		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
100SYSTEM_LD_TAIL=	@size $@; chmod 755 $@
101
102DEBUG?=
103.if ${DEBUG} == "-g"
104LINKFLAGS+=	-X
105SYSTEM_LD_TAIL+=; \
106		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
107		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
108.else
109LINKFLAGS+=	-S
110.endif
111
112%LOAD
113
114assym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
115	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
116	    < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
117	mv -f assym.h.tmp assym.h
118
119param.c: $S/conf/param.c
120	rm -f param.c
121	cp $S/conf/param.c .
122
123param.o: param.c Makefile
124	${NORMAL_C}
125
126ioconf.o: ioconf.c
127	${NORMAL_C}
128
129newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
130	sh $S/conf/newvers.sh
131	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
132
133
134clean: cleankernel
135cleankernel:
136	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
137	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
138
139lint:
140	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
141	    ${MVME68K}/mvme68k/Locore.c ${CFILES} \
142	    ioconf.c param.c | \
143	    grep -v 'static function .* unused'
144
145tags:
146	@echo "see $S/kern/Makefile for tags"
147
148links:
149	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
150	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
151	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
152	  sort -u | comm -23 - dontlink | \
153	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
154	sh makelinks && rm -f dontlink
155
156SRCS=	${MVME68K}/mvme68k/locore.s \
157	param.c ioconf.c ${CFILES} ${SFILES}
158depend: .depend
159.depend: ${SRCS} assym.h param.c
160	${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES}
161
162# XXX - see below
163#	${MKDEP} -a ${APPFLAGS} ${MVME68K}/mvme68k/locore.s
164#	${MKDEP} -a ${APPFLAGS} ${SFILES}
165#
166# For cross-compilation, the "gcc -M" mkdep script is convenient,
167# but that does not correctly make rules from *.s files.  The
168# easiest work-around is to just list those dependencies here.
169locore.o:   assym.h m68k/asm.h m68k/trap.h
170copy.o:     assym.h m68k/asm.h $S/sys/errno.h
171bcopy.o:    assym.h m68k/asm.h
172copypage.o: assym.h m68k/asm.h
173
174
175# depend on root or device configuration
176autoconf.o conf.o: Makefile
177 
178# depend on network or filesystem configuration 
179uipc_proto.o vfs_conf.o: Makefile 
180
181# depend on maxusers
182machdep.o: Makefile
183
184# depend on CPU configuration 
185locore.o pmap.o sys_machdep.o trap.o: Makefile
186
187
188locore.o: ${MVME68K}/mvme68k/locore.s assym.h
189	${NORMAL_S}
190
191%RULES
192