xref: /netbsd-src/sys/arch/mvme68k/conf/Makefile.mvme68k (revision 9573504567626934c7ee01c7dce0c4bb1dfe7403)
1#	$NetBSD: Makefile.mvme68k,v 1.3 1995/09/19 23:50:22 thorpej Exp $
2
3#	@(#)Makefile.hp300	8.2 (Berkeley) 1/23/94
4#
5# Makefile for NetBSD
6#
7# This makefile is constructed from a machine description:
8#	config machineid
9# Most changes should be made in the machine description
10#	/sys/arch/mvme68k/conf/``machineid''
11# after which you should do
12#	 config.new machineid
13# Machine generic makefile changes should be made in
14#	/sys/arch/mvme68k/conf/Makefile.mvme68k
15# after which config should be rerun for all machines of that type.
16#
17# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
18#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
19#
20# -DTRACE	compile in kernel tracing hooks
21# -DQUOTA	compile in file system quotas
22
23
24# DEBUG is set to -g by config if debugging is requested (config -g).
25# PROF is set to -pg by config if profiling is requested (config -p).
26AS=     as ${DEBUG}
27AWK=	awk
28CC=     cc ${DEBUG}
29CPP=    cpp
30LD=     ld
31TOUCH=	touch -f -c
32
33# source tree is located via $S relative to the compilation directory
34S=	../../../..
35MVME68K=	../..
36
37INCLUDES= -I. -I$S/arch -I$S -I$S/sys
38COPTS=	${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dmvme68k -DFPCOPROC
39CFLAGS=	-O -Werror -fno-builtin ${COPTS}
40
41### find out what to use for libkern
42.include "$S/lib/libkern/Makefile.inc"
43.ifndef PROF
44LIBKERN=	${KERNLIB}
45.else
46LIBKERN=	${KERNLIB_PROF}
47.endif
48
49### find out what to use for libcompat
50.include "$S/compat/common/Makefile.inc"
51.ifndef PROF
52LIBCOMPAT=    ${COMPATLIB}
53.else
54LIBCOMPAT=    ${COMPATLIB_PROF}
55.endif
56
57### for the Motorola 68040 Floating Point Software Product
58.include "$S/arch/m68k/fpsp/Makefile.inc"
59
60# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
61# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
62# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
63# is marked as config-dependent.
64
65NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
66NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
67
68DRIVER_C=	${CC} -c ${CFLAGS} ${PROF} $<
69DRIVER_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
70
71PROFILE_C=	${CC} -S -c ${COPTS} $<; \
72		sed -e s/_mcount/mcount/ -e s/subrmcount/subr_mcount/ <$*.s | \
73		${AS} -o $@; \
74		rm -f $*.s
75
76NORMAL_S=	${CPP} ${COPTS} $< | ${AS} -o $@
77NORMAL_S_C=	${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
78
79%OBJS
80
81%CFILES
82
83# load lines for config "xxx" will be emitted as:
84# xxx: ${SYSTEM_DEP} swapxxx.o
85#	${SYSTEM_LD_HEAD}
86#	${SYSTEM_LD} swapxxx.o
87#	${SYSTEM_LD_TAIL}
88DEBUG?=
89.if ${DEBUG} == "-g"
90LDX=-X
91.else
92LDX=-x
93.endif
94SYSTEM_OBJ=	locore.o ${FPSP} vnode_if.o ${OBJS} param.o ioconf.o \
95	${LIBKERN} ${LIBCOMPAT}
96SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
97SYSTEM_LD_HEAD=	@echo loading $@; rm -f $@
98SYSTEM_LD=	@${LD} ${LDX} -Ttext 0x8000 -n -o $@ -e start \
99		    ${SYSTEM_OBJ} vers.o
100SYSTEM_LD_TAIL=	@echo rearranging symbols; size $@; chmod 755 $@
101
102%LOAD
103
104newvers: vers.o
105
106vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
107	sh $S/conf/newvers.sh
108	${CC} ${CFLAGS} -c vers.c
109
110clean::
111	rm -f eddep *netbsd netbsd.gdb tags vnode_if.[ch] *.o locore.i \
112	    [a-z]*.s [Ee]rrs linterrs makelinks genassym
113
114lint: /tmp param.c
115	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
116	    ${MVME68K}/mvme68k/Locore.c ${CFILES} ${MVME68K}/mvme68k/swapgeneric.c \
117	    ioconf.c param.c | \
118	    grep -v 'struct/union .* never defined' | \
119	    grep -v 'possible pointer alignment problem'
120
121locore.o: assym.s ${MVME68K}/mvme68k/vectors.s ${MVME68K}/mvme68k/locore.s
122locore.o: ${MVME68K}/include/trap.h ${MVME68K}/include/psl.h ${MVME68K}/include/pte.h
123locore.o: ${MVME68K}/include/cpu.h
124	${CPP} -DLOCORE ${COPTS} ${MVME68K}/mvme68k/locore.s | ${AS} -o locore.o
125
126# depend on maxusers
127assym.s: Makefile
128
129assym.s: genassym
130	./genassym > assym.s
131
132genassym: ${MVME68K}/mvme68k/genassym.c Makefile
133	cc ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dmvme68k -o genassym \
134	    ${MVME68K}/mvme68k/genassym.c
135
136depend: assym.s param.c vnode_if.h
137	mkdep ${COPTS} ${CFILES} ioconf.c param.c
138	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${MVME68K}/mvme68k/genassym.c
139
140links:
141	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
142	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
143	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
144	  sort -u | comm -23 - dontlink | \
145	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
146	sh makelinks && rm -f dontlink
147
148tags:
149	@echo "see $S/kern/Makefile for tags"
150
151ioconf.o: ioconf.c
152	${CC} -c ${CFLAGS} ioconf.c
153
154param.c: $S/conf/param.c
155	rm -f param.c
156	cp $S/conf/param.c .
157
158param.o: param.c Makefile
159	${CC} -c ${CFLAGS} ${PARAM} param.c
160
161vnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
162	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
163
164%RULES
165