Makefile.hp300 revision 1.25
1#	$NetBSD: Makefile.hp300,v 1.25 1995/08/05 23:39:41 mycroft 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/hp300/conf/``machineid''
11# after which you should do
12#	 config machineid
13# Machine generic makefile changes should be made in
14#	/sys/arch/hp300/conf/Makefile.hp300
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=	../../../..
35HP300=	../..
36
37INCLUDES= -I. -I$S/arch -I$S -I$S/sys
38COPTS=	${INCLUDES} ${IDENT} -D_KERNEL -Dmc68020 -Dhp300 -DFPCOPROC
39CFLAGS=	-O6 -Werror ${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}
88SYSTEM_OBJ=	locore.o ${FPSP} vnode_if.o ${OBJS} param.o ioconf.o \
89		${LIBKERN} ${LIBCOMPAT}
90SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
91SYSTEM_LD_HEAD=	rm -f $@
92SYSTEM_LD=	-@if [ X${DEBUG} = X-g ]; \
93		then strip=-X; \
94		else strip=-x; \
95		fi; \
96		echo ${LD} $$strip -n -T 0 -o $@ -e start '$${SYSTEM_OBJ}' vers.o; \
97		${LD} $$strip -n -T 0 -o $@ -e start ${SYSTEM_OBJ} vers.o
98SYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
99		[ X${DEBUG} = X-g ] && { \
100		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
101		echo strip -d $@; strip -d $@; } || true
102
103%LOAD
104
105vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
106	sh $S/conf/newvers.sh
107	${CC} ${CFLAGS} -c vers.c
108
109clean::
110	rm -f eddep *netbsd netbsd.gdb tags vnode_if.[ch] *.o locore.i \
111		[a-z]*.s [Ee]rrs linterrs makelinks genassym
112
113lint: /tmp param.c
114	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
115	    ${HP300}/hp300/Locore.c ${CFILES} ${HP300}/hp300/swapgeneric.c \
116	    ioconf.c param.c | \
117	    grep -v 'struct/union .* never defined' | \
118	    grep -v 'possible pointer alignment problem'
119
120locore.o: assym.s ${HP300}/hp300/vectors.s ${HP300}/hp300/locore.s 
121locore.o: ${HP300}/include/trap.h ${HP300}/include/psl.h ${HP300}/include/pte.h
122locore.o: ${HP300}/include/cpu.h
123	${CPP} -DLOCORE ${COPTS} ${HP300}/hp300/locore.s | ${AS} -o locore.o
124
125# the following is necessary because autoconf.o depends on #if GENERIC
126autoconf.o: Makefile
127
128# the following are necessary because the files depend on the types of
129# hp cpu's included in the system configuration
130machdep.o sys_machdep.o pmap.o pmap_bootstrap.o trap.o dma.o: Makefile
131
132# depend on network or filesystem configuration
133uipc_proto.o vfs_conf.o locore.o: Makefile
134
135# depend on maxusers
136assym.s: Makefile
137
138assym.s: genassym
139	./genassym >assym.s
140
141genassym: ${HP300}/hp300/genassym.c
142	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dhp300 -o genassym \
143	    ${HP300}/hp300/genassym.c
144
145depend: assym.s param.c vnode_if.h
146	mkdep ${COPTS} ${CFILES} ioconf.c param.c
147	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${HP300}/hp300/genassym.c
148
149links:
150	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
151	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
152	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
153	  sort -u | comm -23 - dontlink | \
154	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
155	sh makelinks && rm -f dontlink
156
157tags:
158	@echo "see $S/kern/Makefile for tags"
159
160ioconf.o: ioconf.c
161	${CC} -c ${CFLAGS} ioconf.c
162
163param.c: $S/conf/param.c
164	rm -f param.c
165	cp $S/conf/param.c .
166
167param.o: param.c Makefile
168	${CC} -c ${CFLAGS} ${PARAM} param.c
169
170vnode_if.c vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
171	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
172
173%RULES
174