Makefile.mvme68k revision 1.14
1#	$NetBSD: Makefile.mvme68k,v 1.14 1996/08/12 00:51:48 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 -d
28TOUCH?=	touch -f -c
29
30# source tree is located via $S relative to the compilation directory
31S!=	cd ../../../..; pwd
32MVME68K=$S/arch/mvme68k
33
34INCLUDES=	-I. -I$S/arch -I$S -nostdinc
35CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
36		-Dmc68020 -Dmvme68k -DFPCOPROC
37CWARNFLAGS=	-Werror
38CFLAGS=		${DEBUG} ${CWARNFLAGS} -O2 -msoft-float
39AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
40LINKFLAGS=	-n -Ttext 8000 -e start
41
42### find out what to use for libkern
43.include "$S/lib/libkern/Makefile.inc"
44.ifndef PROF
45LIBKERN=	${KERNLIB}
46.else
47LIBKERN=	${KERNLIB_PROF}
48.endif
49
50### find out what to use for libcompat
51.include "$S/compat/common/Makefile.inc"
52.ifndef PROF
53LIBCOMPAT=    ${COMPATLIB}
54.else
55LIBCOMPAT=    ${COMPATLIB_PROF}
56.endif
57
58### for the Motorola 68040 Floating Point Software Product
59.include "$S/arch/m68k/fpsp/Makefile.inc"
60
61# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
62# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
63
64NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
65NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
66
67HOSTED_C=	${NORMAL_C:S/^-pg$//:S/^-p$//:S/^-nostdinc$//}
68
69%OBJS
70
71%CFILES
72
73%SFILES
74
75# load lines for config "xxx" will be emitted as:
76# xxx: ${SYSTEM_DEP} swapxxx.o
77#	${SYSTEM_LD_HEAD}
78#	${SYSTEM_LD} swapxxx.o
79#	${SYSTEM_LD_TAIL}
80SYSTEM_OBJ=	locore.o ${FPSP} \
81		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
82SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
83SYSTEM_LD_HEAD=	@rm -f $@
84SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
85		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
86SYSTEM_LD_TAIL=	@size $@; chmod 755 $@
87
88DEBUG?=
89.if ${DEBUG} == "-g"
90LINKFLAGS+=	-X
91SYSTEM_LD_TAIL+=; \
92		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
93		echo ${STRIP} $@; ${STRIP} $@
94.else
95LINKFLAGS+=	-S
96.endif
97
98%LOAD
99
100assym.h: genassym
101	./genassym >assym.h
102
103genassym: genassym.o
104	${CC} -o $@ genassym.o
105
106genassym.o: ${MVME68K}/mvme68k/genassym.c
107	${HOSTED_C}
108
109param.c: $S/conf/param.c
110	rm -f param.c
111	cp $S/conf/param.c .
112
113param.o: param.c Makefile
114	${NORMAL_C}
115
116ioconf.o: ioconf.c
117	${NORMAL_C}
118
119newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
120	sh $S/conf/newvers.sh
121	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
122
123
124clean::
125	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
126	    [Ee]rrs linterrs makelinks genassym genassym.o assym.h
127
128lint:
129	@lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \
130	    ${MVME68K}/mvme68k/Locore.c ${CFILES} ${MVME68K}/mvme68k/swapgeneric.c \
131	    ioconf.c param.c | \
132	    grep -v 'static function .* unused'
133
134tags:
135	@echo "see $S/kern/Makefile for tags"
136
137links:
138	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
139	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
140	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
141	  sort -u | comm -23 - dontlink | \
142	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
143	sh makelinks && rm -f dontlink
144
145SRCS=	${MVME68K}/mvme68k/locore.s \
146	param.c ioconf.c ${CFILES} ${SFILES}
147depend:: .depend
148.depend: ${SRCS} assym.h param.c
149	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
150	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
151	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
152	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/genassym.c
153
154
155# depend on root or device configuration
156autoconf.o conf.o: Makefile
157 
158# depend on network or filesystem configuration 
159uipc_proto.o vfs_conf.o: Makefile 
160
161# depend on maxusers
162genassym.o machdep.o: Makefile
163
164# depend on CPU configuration 
165locore.o pmap.o sys_machdep.o trap.o: Makefile
166
167
168locore.o: ${MVME68K}/mvme68k/locore.s assym.h
169	${NORMAL_S}
170
171%RULES
172