xref: /original-bsd/sys/hp300/conf/Makefile.hp300 (revision 13deef58)
1#	@(#)Makefile.hp300	7.16 (Berkeley) 07/19/92
2#
3# Makefile for 4.4 BSD
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/conf/``machineid''
9# after which you should do
10#	 config machineid
11# Machine generic makefile changes should be made in
12#	/sys/conf/Makefile.``machinetype''
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
22# DEBUG is set to -g by config if debugging is requested (config -g).
23# PROF is set to -pg by config if profiling is requested (config -p).
24AS=	as ${DEBUG}
25CC=	cc ${DEBUG}
26CPP=	cpp
27LD=	ld
28TOUCH=	touch -f -c
29
30# source tree is located via $S relative to the compilation directory
31S=	../..
32HP300=	$S/hp300
33
34INCLUDES= -I. -I$S -I$S/sys
35COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Dmc68020 -Dhp300 -DFPCOPROC -DREFBIT
36CFLAGS=	-O ${COPTS}
37
38# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
39# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
40# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
41# is marked as config-dependent.
42
43NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
44NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
45
46DRIVER_C=	${CC} -c ${CFLAGS} ${PROF} $<
47DRIVER_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
48
49PROFILE_C=	${CC} -S -c ${COPTS} $<; \
50		sed -e s/_mcount/mcount/ -e s/subrmcount/subr_mcount/ <$*.s | \
51		${AS} -o $@; \
52		rm -f $*.s
53
54NORMAL_S=	${CPP} ${COPTS} $< | ${AS} -o $@
55NORMAL_S_C=	${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
56
57%OBJS
58
59%CFILES
60
61# load lines for config "xxx" will be emitted as:
62# xxx: ${SYSTEM_DEP} swapxxx.o
63#	${SYSTEM_LD_HEAD}
64#	${SYSTEM_LD} swapxxx.o
65#	${SYSTEM_LD_TAIL}
66SYSTEM_OBJ=	locore.o ${OBJS} param.o ioconf.o
67#SYSTEM_DEP=	Makefile symbols.sort ${SYSTEM_OBJ}
68SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
69SYSTEM_LD_HEAD=	rm -f $@
70SYSTEM_LD=	-@if [ X${DEBUG} = X-g ]; \
71		then strip=-X; \
72		else strip=-x; \
73		fi; \
74		echo ${LD} $$strip -n -o $@ -e start '$${SYSTEM_OBJ}' vers.o ../../libkern/obj/libkern.a; \
75		${LD} $$strip -n -o $@ -e start ${SYSTEM_OBJ} vers.o ../../libkern/obj/libkern.a
76#SYSTEM_LD_TAIL= @echo rearranging symbols;\
77#		symorder symbols.sort $@;\
78SYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
79		[ X${DEBUG} = X-g ] && { \
80		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
81		echo strip -d $@; strip -d $@; } || true
82
83%LOAD
84
85newvers:
86	sh $S/conf/newvers.sh
87	${CC} $(CFLAGS) -c vers.c
88
89clean:
90	rm -f eddep *vmunix vmunix.gdb tags *.o locore.i [a-z]*.s \
91		Errs errs linterrs makelinks
92
93lint: /tmp param.c
94	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
95	    ${HP300}/hp300/Locore.c ${CFILES} ${HP300}/hp300/swapgeneric.c \
96	    ioconf.c param.c| \
97	    grep -v 'struct/union .* never defined' | \
98	    grep -v 'possible pointer alignment problem'
99
100symbols.sort: ${HP300}/hp300/symbols.raw
101	grep -v '^#' ${HP300}/hp300/symbols.raw \
102	    | sed 's/^	//' | sort -u > symbols.sort
103
104locore.o: assym.s ${HP300}/hp300/vectors.s ${HP300}/hp300/locore.s
105locore.o: ${HP300}/include/trap.h ${HP300}/include/psl.h ${HP300}/hp300/pte.h
106locore.o: ${HP300}/include/cpu.h
107	${CPP} -DLOCORE ${COPTS} ${HP300}/hp300/locore.s | ${AS} -o locore.o
108
109# the following is necessary because autoconf.o depends on #if GENERIC
110autoconf.o: Makefile
111
112# the following are necessary because the files depend on the types of
113# hp cpu's included in the system configuration
114clock.o machdep.o autoconf.o conf.o: Makefile
115
116# depend on network or filesystem configuration
117af.o uipc_proto.o vfs_conf.o locore.o: Makefile
118
119# depend on maxusers
120assym.s: Makefile
121
122assym.s: genassym
123	./genassym >assym.s
124
125genassym:
126	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dhp300 -o genassym \
127	    ${HP300}/hp300/genassym.c
128
129depend: assym.s param.c
130	mkdep ${COPTS} ${CFILES} ioconf.c param.c
131	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${HP300}/hp300/genassym.c
132
133links:
134	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
135	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
136	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
137	  sort -u | comm -23 - dontlink | \
138	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
139	sh makelinks && rm -f dontlink
140
141tags:
142	@echo "see $S/kern/Makefile for tags"
143
144ioconf.o: ioconf.c
145	${CC} -c ${CFLAGS} ioconf.c
146
147param.c: $S/conf/param.c
148	rm -f param.c
149	cp $S/conf/param.c .
150
151param.o: param.c Makefile
152	${CC} -c ${CFLAGS} ${PARAM} param.c
153
154%RULES
155