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