1#	@(#)Makefile.luna68k	7.5 (Berkeley) 05/12/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	ln -s $S/libkern/obj/libkern.a libkern.a; \
80	echo ln -s $S/libkern/obj/libkern.a libkern.a
81
82newvers:
83	sh $S/conf/newvers.sh
84	${CC} $(CFLAGS) -c vers.c
85
86clean:
87	rm -f eddep *vmunix vmunix.gdb tags *.o locore.i [a-z]*.s \
88		Errs errs linterrs makelinks
89
90lint: /tmp param.c
91	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
92	    ${LUNA68K}/luna68k/Locore.c ${CFILES} ${LUNA68K}/luna68k/swapgeneric.c \
93	    ioconf.c param.c| \
94	    grep -v 'struct/union .* never defined' | \
95	    grep -v 'possible pointer alignment problem'
96
97symbols.sort: ${LUNA68K}/luna68k/symbols.raw
98	grep -v '^#' ${LUNA68K}/luna68k/symbols.raw \
99	    | sed 's/^	//' | sort -u > symbols.sort
100
101locore.o: assym.s ${LUNA68K}/luna68k/vectors.s ${LUNA68K}/luna68k/locore.s
102locore.o: ${LUNA68K}/include/trap.h ${LUNA68K}/include/psl.h ${LUNA68K}/luna68k/pte.h
103locore.o: ${LUNA68K}/include/cpu.h
104	${CPP} -DLOCORE ${COPTS} ${LUNA68K}/luna68k/locore.s | ${AS} -o locore.o
105
106# the following is necessary because autoconf.o depends on #if GENERIC
107autoconf.o: Makefile
108
109# the following are necessary because the files depend on the types of
110# hp cpu's included in the system configuration
111machdep.o sys_machdep.o pmap.o pmap_bootstrap.o trap.o: Makefile
112
113# depend on network or filesystem configuration
114af.o uipc_proto.o vfs_conf.o locore.o: Makefile
115
116# depend on maxusers
117assym.s: Makefile
118
119assym.s: genassym
120	./genassym >assym.s
121
122genassym:
123	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dluna68k -o genassym \
124	    ${LUNA68K}/luna68k/genassym.c
125
126depend: assym.s param.c vnode_if.h
127	mkdep ${COPTS} ${CFILES} ioconf.c param.c
128	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${LUNA68K}/luna68k/genassym.c
129
130links:
131	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
132	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
133	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
134	  sort -u | comm -23 - dontlink | \
135	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
136	sh makelinks && rm -f dontlink
137
138tags:
139	@echo "see $S/kern/Makefile for tags"
140
141ioconf.o: ioconf.c
142	${CC} -c ${CFLAGS} ioconf.c
143
144param.c: $S/conf/param.c
145	rm -f param.c
146	cp $S/conf/param.c .
147
148param.o: param.c Makefile
149	${CC} -c ${CFLAGS} ${PARAM} param.c
150
151vnode_if.c: $S/kern/vnode_if.sh $S/kern/vnode_if.src
152	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
153vnode_if.h: $S/kern/vnode_if.sh $S/kern/vnode_if.src
154	sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
155
156%RULES
157