1#	@(#)Makefile.luna68k	7.1 (Berkeley) 06/15/92
2#
3# From: hp300/conf/Makefile.luna68k	7.13 (Berkeley) 2/24/92
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 -DREFBIT
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
69#SYSTEM_DEP=	Makefile symbols.sort ${SYSTEM_OBJ}
70SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
71SYSTEM_LD_HEAD=	rm -f $@
72#SYSTEM_LD=	@if [ X${DEBUG} = X-g ]; \
73#		then strip=-X; \
74#		else strip=-x; \
75#		fi; \
76#		echo ${LD} $$strip -n -o $@ -e start '$${SYSTEM_OBJ}' vers.o libquad.a; \
77#		${LD} $$strip -n -o $@ -e start ${SYSTEM_OBJ} vers.o libquad.a
78SYSTEM_LD=	@strip=-x; \
79		${LD} $$strip -n -o $@ ${SYSTEM_OBJ} vers.o libquad.a
80#SYSTEM_LD_TAIL= @echo rearranging symbols;\
81#		symorder symbols.sort $@;\
82SYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
83		[ X${DEBUG} = X-g ] && { \
84		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
85		echo strip -d $@; strip -d $@; } || true
86
87%LOAD
88
89newvers:
90	sh $S/conf/newvers.sh
91	${CC} $(CFLAGS) -c vers.c
92
93clean:
94	rm -f eddep *vmunix vmunix.gdb tags *.o locore.i [a-z]*.s \
95		Errs errs linterrs makelinks
96
97lint: /tmp param.c
98	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
99	    ${LUNA68K}/luna68k/Locore.c ${CFILES} ${LUNA68K}/luna68k/swapgeneric.c \
100	    ioconf.c param.c| \
101	    grep -v 'struct/union .* never defined' | \
102	    grep -v 'possible pointer alignment problem'
103
104symbols.sort: ${LUNA68K}/luna68k/symbols.raw
105	grep -v '^#' ${LUNA68K}/luna68k/symbols.raw \
106	    | sed 's/^	//' | sort -u > symbols.sort
107
108locore.o: assym.s ${LUNA68K}/luna68k/vectors.s ${LUNA68K}/luna68k/locore.s
109locore.o: ${LUNA68K}/include/trap.h ${LUNA68K}/include/psl.h ${LUNA68K}/luna68k/pte.h
110locore.o: ${LUNA68K}/include/cpu.h
111	${CPP} -DLOCORE ${COPTS} ${LUNA68K}/luna68k/locore.s | ${AS} -o locore.o
112
113# the following is necessary because autoconf.o depends on #if GENERIC
114autoconf.o: Makefile
115
116# the following are necessary because the files depend on the types of
117# hp cpu's included in the system configuration
118clock.o machdep.o autoconf.o conf.o: Makefile
119
120# depend on network configuration
121af.o uipc_proto.o locore.o: Makefile
122
123# depend on maxusers
124assym.s: Makefile
125
126assym.s: genassym
127	./genassym >assym.s
128
129genassym:
130	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dluna68k -o genassym \
131	    ${LUNA68K}/luna68k/genassym.c
132
133depend: assym.s param.c
134	mkdep ${COPTS} ${CFILES} ioconf.c param.c
135	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${LUNA68K}/luna68k/genassym.c
136
137links:
138	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
139	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
140	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
141	  sort -u | comm -23 - dontlink | \
142	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
143	sh makelinks && rm -f dontlink
144
145tags:
146	@echo "see $S/kern/Makefile for tags"
147
148ioconf.o: ioconf.c
149	${CC} -c ${CFLAGS} ioconf.c
150
151param.c: $S/conf/param.c
152	rm -f param.c
153	cp $S/conf/param.c .
154
155param.o: param.c Makefile
156	${CC} -c ${CFLAGS} ${PARAM} param.c
157
158%RULES
159