Makefile.mvme68k revision 1.31
1#	$NetBSD: Makefile.mvme68k,v 1.31 1997/11/12 22:26:11 thorpej 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
26LORDER?=lorder
27MKDEP?=	mkdep
28NM?=	nm
29SIZE?=	size
30STRIP?=	strip
31TSORT?=	tsort -q
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
43CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
44		-Dmc68020 -Dmvme68k
45CWARNFLAGS=	-Werror
46CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
47AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
48LINKFLAGS=	-n -Ttext 8000 -e start
49STRIPFLAGS=	-d
50
51HOSTED_CC=	${CC}
52HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
53HOSTED_CFLAGS=	${CFLAGS}
54
55### find out what to use for libkern
56.include "$S/lib/libkern/Makefile.inc"
57.ifndef PROF
58LIBKERN=	${KERNLIB}
59.else
60LIBKERN=	${KERNLIB_PROF}
61.endif
62
63### find out what to use for libcompat
64.include "$S/compat/common/Makefile.inc"
65.ifndef PROF
66LIBCOMPAT=	${COMPATLIB}
67.else
68LIBCOMPAT=	${COMPATLIB_PROF}
69.endif
70
71### for the Motorola 68040 Floating Point Software Product
72.include "$S/arch/m68k/fpsp/Makefile.inc"
73
74# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
75# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
76
77NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
78NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
79
80HOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
81
82%OBJS
83
84%CFILES
85
86%SFILES
87
88# load lines for config "xxx" will be emitted as:
89# xxx: ${SYSTEM_DEP} swapxxx.o
90#	${SYSTEM_LD_HEAD}
91#	${SYSTEM_LD} swapxxx.o
92#	${SYSTEM_LD_TAIL}
93SYSTEM_OBJ=	locore.o ${FPSP} \
94		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
95SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
96SYSTEM_LD_HEAD=	@rm -f $@
97SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
98		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
99SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
100
101DEBUG?=
102.if ${DEBUG} == "-g"
103LINKFLAGS+=	-X
104SYSTEM_LD_TAIL+=; \
105		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
106		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
107.else
108LINKFLAGS+=	-S
109.endif
110
111%LOAD
112
113assym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
114	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
115	    < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
116	mv -f assym.h.tmp assym.h
117
118param.c: $S/conf/param.c
119	rm -f param.c
120	cp $S/conf/param.c .
121
122param.o: param.c Makefile
123	${NORMAL_C}
124
125ioconf.o: ioconf.c
126	${NORMAL_C}
127
128newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
129	sh $S/conf/newvers.sh
130	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
131
132__CLEANKERNEL: .USE
133	@echo "${.TARGET}ing the kernel objects"
134	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
135	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
136
137__CLEANDEPEND: .USE
138	rm -f .depend
139
140clean: __CLEANKERNEL
141
142cleandir: __CLEANKERNEL __CLEANDEPEND
143
144lint:
145	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
146	    ${CFILES} ioconf.c param.c | \
147	    grep -v 'static function .* unused'
148
149tags:
150	@echo "see $S/kern/Makefile for tags"
151
152links:
153	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
154	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
155	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
156	  sort -u | comm -23 - dontlink | \
157	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
158	sh makelinks && rm -f dontlink
159
160SRCS=	${MVME68K}/mvme68k/locore.s \
161	param.c ioconf.c ${CFILES} ${SFILES}
162depend: .depend
163.depend: ${SRCS} assym.h param.c
164	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
165	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
166	-if test -n "${SFILES}"; then \
167		${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
168	fi
169	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
170	  ${CPPFLAGS} < ${MVME68K}/mvme68k/genassym.cf
171	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
172	@rm -f assym.dep
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