Makefile.hp300 revision 1.14
1#	from: @(#)Makefile.hp300	8.2 (Berkeley) 1/23/94
2#	$Id: Makefile.hp300,v 1.14 1994/05/23 10:17:41 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
30
31# source tree is located via $S relative to the compilation directory
32S=	../../../..
33HP300=	../..
34
35INCLUDES= -I. -I$S/arch -I$S -I$S/sys
36COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Dmc68020 -Dhp300 -DFPCOPROC
37CFLAGS=	-O ${COPTS}
38
39### find out what to use for libkern
40.include "$S/lib/libkern/Makefile.inc"
41.ifndef PROF
42LIBKERN=	${KERNLIB}
43.else
44LIBKERN=	${KERNLIB_PROF}
45.endif
46
47# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
48# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
49# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
50# is marked as config-dependent.
51
52NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
53NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
54
55DRIVER_C=	${CC} -c ${CFLAGS} ${PROF} $<
56DRIVER_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
57
58PROFILE_C=	${CC} -S -c ${COPTS} $<; \
59		sed -e s/_mcount/mcount/ -e s/subrmcount/subr_mcount/ <$*.s | \
60		${AS} -o $@; \
61		rm -f $*.s
62
63NORMAL_S=	${CPP} ${COPTS} $< | ${AS} -o $@
64NORMAL_S_C=	${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
65
66%OBJS
67
68%CFILES
69
70# load lines for config "xxx" will be emitted as:
71# xxx: ${SYSTEM_DEP} swapxxx.o
72#	${SYSTEM_LD_HEAD}
73#	${SYSTEM_LD} swapxxx.o
74#	${SYSTEM_LD_TAIL}
75SYSTEM_OBJ=	locore.o ${OBJS} param.o ioconf.o ${LIBKERN}
76SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
77SYSTEM_LD_HEAD=	rm -f $@
78SYSTEM_LD=	-@if [ X${DEBUG} = X-g ]; \
79		then strip=-X; \
80		else strip=-x; \
81		fi; \
82		echo ${LD} $$strip -n -T 0 -o $@ -e start '$${SYSTEM_OBJ}' vers.o; \
83		${LD} $$strip -n -T 0 -o $@ -e start ${SYSTEM_OBJ} vers.o
84SYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
85		[ X${DEBUG} = X-g ] && { \
86		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
87		echo strip -d $@; strip -d $@; } || true
88
89%LOAD
90
91vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
92	sh $S/conf/newvers.sh
93	${CC} ${CFLAGS} -c vers.c
94
95clean:
96	rm -f eddep *netbsd netbsd.gdb tags *.o locore.i [a-z]*.s \
97		[Ee]rrs linterrs makelinks
98
99lint: /tmp param.c
100	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
101	    ${HP300}/hp300/Locore.c ${CFILES} ${HP300}/hp300/swapgeneric.c \
102	    ioconf.c param.c | \
103	    grep -v 'struct/union .* never defined' | \
104	    grep -v 'possible pointer alignment problem'
105
106locore.o: assym.s ${HP300}/hp300/vectors.s ${HP300}/hp300/locore.s 
107locore.o: ${HP300}/include/trap.h ${HP300}/include/psl.h ${HP300}/include/pte.h
108locore.o: ${HP300}/include/cpu.h
109	${CPP} -DLOCORE ${COPTS} ${HP300}/hp300/locore.s | ${AS} -o locore.o
110
111# the following is necessary because autoconf.o depends on #if GENERIC
112autoconf.o: Makefile
113
114# the following are necessary because the files depend on the types of
115# hp cpu's included in the system configuration
116machdep.o sys_machdep.o pmap.o pmap_bootstrap.o trap.o dma.o: Makefile
117
118# depend on network or filesystem configuration
119uipc_proto.o vfs_conf.o locore.o: Makefile
120
121# depend on maxusers
122assym.s: Makefile
123
124assym.s: genassym
125	./genassym >assym.s
126
127genassym:
128	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dhp300 -o genassym \
129	    ${HP300}/hp300/genassym.c
130
131depend: assym.s param.c
132	mkdep ${COPTS} ${CFILES} ioconf.c param.c
133	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${HP300}/hp300/genassym.c
134
135links:
136	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
137	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
138	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
139	  sort -u | comm -23 - dontlink | \
140	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
141	sh makelinks && rm -f dontlink
142
143tags:
144	@echo "see $S/kern/Makefile for tags"
145
146ioconf.o: ioconf.c
147	${CC} -c ${CFLAGS} ioconf.c
148
149param.c: $S/conf/param.c
150	rm -f param.c
151	cp $S/conf/param.c .
152
153param.o: param.c Makefile
154	${CC} -c ${CFLAGS} ${PARAM} param.c
155
156vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
157	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
158vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
159	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
160
161%RULES
162