Makefile.sun3 revision 1.3
1#
2# Makefile for 4.4 BSD
3#
4# This makefile is constructed from a machine description:
5#	config machineid
6# Most changes should be made in the machine description
7#	/sys/conf/``machineid''
8# after which you should do
9#	 config machineid
10# Machine generic makefile changes should be made in
11#	/sys/conf/Makefile.``machinetype''
12# after which config should be rerun for all machines of that type.
13#
14# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
15#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
16#
17# -DTRACE	compile in kernel tracing hooks
18# -DQUOTA	compile in file system quotas
19
20
21# DEBUG is set to -g by config if debugging is requested (config -g).
22# PROF is set to -pg by config if profiling is requested (config -p).
23AS=	gas ${DEBUG}
24CC=	gcc ${DEBUG}
25CPP=	cpp
26LD=	ld
27TOUCH=	touch -f -c
28GPROF.EX=/usr/src/usr.lib/libc/csu/sun3/gmon.ex
29
30# source tree is located via $S relative to the compilation directory
31S=	../../../..
32SUN3=	../..
33
34INCLUDES= -I. -I$S -I$S/sys
35COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Dmc68020 -Dsun3
36CFLAGS=	${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		ex - $*.s < ${GPROF.EX}; \
51		${AS} -o $@ $*.s; \
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=	@echo loading $@; rm -f $@
70SYSTEM_LD=	@strip=-x; [ X${DEBUG} = X-g ] && strip=-X; \
71		${LD} $$strip -n -o $@ -e start ${SYSTEM_OBJ} vers.o
72#SYSTEM_LD_TAIL= @echo rearranging symbols;\
73#		symorder symbols.sort $@;\
74SYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
75		[ X${DEBUG} = X-g ] && { \
76		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
77		echo strip -d $@; strip -d $@; } || true
78
79%LOAD
80
81newvers:
82	sh $S/conf/newvers.sh
83	${CC} $(CFLAGS) -c vers.c
84
85clean:
86	rm -f eddep *vmunix tags *.o locore.i [a-z]*.s \
87		Errs errs linterrs makelinks
88
89lint: /tmp param.c
90	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
91	    ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
92	    ioconf.c param.c| \
93	    grep -v 'struct/union .* never defined' | \
94	    grep -v 'possible pointer alignment problem'
95
96symbols.sort: ${SUN3}/sun3/symbols.raw
97	grep -v '^#' ${SUN3}/sun3/symbols.raw \
98	    | sed 's/^	//' | sort -u > symbols.sort
99
100locore.o: assym.s ${SUN3}/sun3/locore.s 
101locore.o: ${SUN3}/include/trap.h ${SUN3}/include/psl.h 
102locore.o: ${SUN3}/include/cpu.h ${SUN3}/include/control.h
103#locore.o: assym.s ${SUN3}/sun3/vectors.s ${SUN3}/sun3/locore.s 
104#locore.o: ${SUN3}/include/trap.h ${SUN3}/include/psl.h ${SUN3}/sun3/pte.h
105#locore.o: ${SUN3}/include/cpu.h
106	${CPP} -DLOCORE ${COPTS} ${SUN3}/sun3/locore.s > plocore.s
107	echo "" >>plocore.s
108	${AS} -o locore.o plocore.s
109
110# the following is necessary because autoconf.o depends on #if GENERIC
111autoconf.o: Makefile
112
113# the following are necessary because the files depend on the types of
114# hp cpu's included in the system configuration
115clock.o machdep.o autoconf.o conf.o: Makefile
116
117# depend on network configuration
118af.o uipc_proto.o locore.o: Makefile
119
120# depend on maxusers
121assym.s: Makefile
122
123assym.s: genassym
124	./genassym >assym.s
125
126genassym:
127	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dsun3 -o genassym \
128	    ${SUN3}/sun3/genassym.c
129
130depend: assym.s param.c
131	mkdep ${COPTS} ${CFILES} ioconf.c param.c
132	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${SUN3}/sun3/genassym.c
133
134links:
135	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
136	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
137	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
138	  sort -u | comm -23 - dontlink | \
139	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
140	sh makelinks && rm -f dontlink
141
142tags:
143	@echo "see $S/kern/Makefile for tags"
144
145ioconf.o: ioconf.c
146	${CC} -c ${CFLAGS} ioconf.c
147
148param.c: $S/conf/param.c
149	rm -f param.c
150	cp $S/conf/param.c .
151
152param.o: param.c Makefile
153	${CC} -c ${CFLAGS} ${PARAM} param.c
154
155vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
156	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
157	${CC} ${CFLAGS} -c vers.c
158
159%RULES
160