1#	@(#)Makefile.luna68k	7.6 (Berkeley) 06/02/93
2#
3# from: hp300/conf/Makefile.hp300	7.21 (Berkeley) 2/12/93
4#
5# Makefile for 4.4 BSD
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/conf/``machineid''
11# after which you should do
12#	 config machineid
13# Machine generic makefile changes should be made in
14#	/sys/conf/Makefile.``machinetype''
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}
27CC=	cc ${DEBUG}
28CPP=	cpp
29LD=	ld
30TOUCH=	touch -f -c
31
32# source tree is located via $S relative to the compilation directory
33S=	../..
34LUNA68K=	$S/luna68k
35
36INCLUDES= -I. -I$S -I$S/sys
37COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Dmc68020 -Dluna68k -DFPCOPROC
38CFLAGS=	-O ${COPTS}
39
40# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
41# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
42# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
43# is marked as config-dependent.
44
45NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
46NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
47
48DRIVER_C=	${CC} -c ${CFLAGS} ${PROF} $<
49DRIVER_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
50
51PROFILE_C=	${CC} -S -c ${COPTS} $<; \
52		sed -e s/_mcount/mcount/ -e s/subrmcount/subr_mcount/ <$*.s | \
53		${AS} -o $@; \
54		rm -f $*.s
55
56NORMAL_S=	${CPP} ${COPTS} $< | ${AS} -o $@
57NORMAL_S_C=	${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
58
59%OBJS
60
61%CFILES
62
63# load lines for config "xxx" will be emitted as:
64# xxx: ${SYSTEM_DEP} swapxxx.o
65#	${SYSTEM_LD_HEAD}
66#	${SYSTEM_LD} swapxxx.o
67#	${SYSTEM_LD_TAIL}
68SYSTEM_OBJ=	locore.o ${OBJS} param.o ioconf.o vnode_if.o
69SYSTEM_DEP=	Makefile ${SYSTEM_OBJ} libkern.a
70SYSTEM_LD_HEAD=	rm -f $@
71SYSTEM_LD=	@strip=-x; \
72		echo ${LD} $$strip -n -o $@ '$${SYSTEM_OBJ}' vers.o libkern.a; \
73		${LD} $$strip -n -o $@ ${SYSTEM_OBJ} vers.o libkern.a
74SYSTEM_LD_TAIL=	@size $@; chmod 755 $@
75
76%LOAD
77
78libkern.a:
79	-@if [ X${PROF} = X ]; \
80	then ln -s $S/libkern/obj/libkern.a libkern.a; \
81	else ln -s $S/libkern/obj/libkern_p.a libkern.a; \
82	fi; \
83	echo ln -s $S/libkern/obj/libkern.a libkern.a
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	    ${LUNA68K}/luna68k/Locore.c ${CFILES} ${LUNA68K}/luna68k/swapgeneric.c \
96	    ioconf.c param.c| \
97	    grep -v 'struct/union .* never defined' | \
98	    grep -v 'possible pointer alignment problem'
99
100symbols.sort: ${LUNA68K}/luna68k/symbols.raw
101	grep -v '^#' ${LUNA68K}/luna68k/symbols.raw \
102	    | sed 's/^	//' | sort -u > symbols.sort
103
104locore.o: assym.s ${LUNA68K}/luna68k/vectors.s ${LUNA68K}/luna68k/locore.s
105locore.o: ${LUNA68K}/include/trap.h ${LUNA68K}/include/psl.h ${LUNA68K}/luna68k/pte.h
106locore.o: ${LUNA68K}/include/cpu.h
107	${CPP} -DLOCORE ${COPTS} ${LUNA68K}/luna68k/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
114machdep.o sys_machdep.o pmap.o pmap_bootstrap.o trap.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 -Dluna68k -o genassym \
127	    ${LUNA68K}/luna68k/genassym.c
128
129depend: assym.s param.c vnode_if.h
130	mkdep ${COPTS} ${CFILES} ioconf.c param.c
131	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${LUNA68K}/luna68k/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
154vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
155	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
156vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
157	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
158
159%RULES
160