Makefile.sun3 revision 1.4
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 -N -X -T 0E004000 ${SYSTEM_OBJ} vers.o
72
73#SYSTEM_LD_TAIL= @echo rearranging symbols;\
74#		symorder symbols.sort $@;\
75SYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
76		[ X${DEBUG} = X-g ] && { \
77		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
78		echo strip -d $@; strip -d $@; } || true
79
80%LOAD
81
82newvers:
83	sh $S/conf/newvers.sh
84	${CC} $(CFLAGS) -c vers.c
85
86clean:
87	rm -f eddep *vmunix 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	    ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
93	    ioconf.c param.c| \
94	    grep -v 'struct/union .* never defined' | \
95	    grep -v 'possible pointer alignment problem'
96
97symbols.sort: ${SUN3}/sun3/symbols.raw
98	grep -v '^#' ${SUN3}/sun3/symbols.raw \
99	    | sed 's/^	//' | sort -u > symbols.sort
100
101locore.o: assym.s ${SUN3}/sun3/locore.s 
102locore.o: ${SUN3}/include/trap.h ${SUN3}/include/psl.h 
103locore.o: ${SUN3}/include/cpu.h ${SUN3}/include/control.h
104#locore.o: assym.s ${SUN3}/sun3/vectors.s ${SUN3}/sun3/locore.s 
105#locore.o: ${SUN3}/include/trap.h ${SUN3}/include/psl.h ${SUN3}/sun3/pte.h
106#locore.o: ${SUN3}/include/cpu.h
107	${CPP} -DLOCORE ${COPTS} ${SUN3}/sun3/locore.s > plocore.s
108	echo "" >>plocore.s
109	${AS} -o locore.o plocore.s
110
111# the following is necessary because autoconf.o depends on #if GENERIC
112autoconf.o: Makefile
113
114# the following are necessary because the files depend on the types of
115# hp cpu's included in the system configuration
116clock.o machdep.o autoconf.o conf.o: Makefile
117
118# depend on network configuration
119af.o uipc_proto.o locore.o: Makefile
120
121# depend on maxusers
122assym.s: Makefile
123
124assym.s: genassym
125	./genassym >assym.s
126
127genassym:
128	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dsun3 -o genassym \
129	    ${SUN3}/sun3/genassym.c
130
131depend: assym.s param.c
132	mkdep ${COPTS} ${CFILES} ioconf.c param.c
133	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${SUN3}/sun3/genassym.c locore.s
134
135links:
136	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
137	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
138	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
139	  sort -u | comm -23 - dontlink | \
140	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
141	sh makelinks && rm -f dontlink
142
143tags:
144	@echo "see $S/kern/Makefile for tags"
145
146ioconf.o: ioconf.c
147	${CC} -c ${CFLAGS} ioconf.c
148
149param.c: $S/conf/param.c
150	rm -f param.c
151	cp $S/conf/param.c .
152
153param.o: param.c Makefile
154	${CC} -c ${CFLAGS} ${PARAM} param.c
155
156vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
157	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
158	${CC} ${CFLAGS} -c vers.c
159
160%RULES
161