Makefile.sun3 revision 1.5
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=	gcpp -traditional
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} -n -o $@ -e _start -N -T 0E004000 ${SYSTEM_OBJ} vers.o
72#SYSTEM_LD=	@strip=-x; [ X${DEBUG} = X-g ] && strip=-X; \
73#                ${LD} $$strip -n -o $@ -e _start -N -X -T 0E004000 ${SYSTEM_OBJ} vers.o
74
75#SYSTEM_LD_TAIL= @echo rearranging symbols;\
76#		symorder symbols.sort $@;\
77SYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
78		[ X${DEBUG} = X-g ] && { \
79		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
80		echo strip -d $@; strip -d $@; } || true
81
82%LOAD
83
84newvers:
85	sh $S/conf/newvers.sh
86	${CC} $(CFLAGS) -c vers.c
87
88clean:
89	rm -f eddep *vmunix tags *.o locore.i [a-z]*.s \
90		Errs errs linterrs makelinks
91
92lint: /tmp param.c
93	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
94	    ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
95	    ioconf.c param.c| \
96	    grep -v 'struct/union .* never defined' | \
97	    grep -v 'possible pointer alignment problem'
98
99symbols.sort: ${SUN3}/sun3/symbols.raw
100	grep -v '^#' ${SUN3}/sun3/symbols.raw \
101	    | sed 's/^	//' | sort -u > symbols.sort
102
103locore.o: assym.s ${SUN3}/sun3/locore.s 
104locore.o: ${SUN3}/include/trap.h ${SUN3}/include/psl.h 
105locore.o: ${SUN3}/include/cpu.h ${SUN3}/include/control.h
106#locore.o: assym.s ${SUN3}/sun3/vectors.s ${SUN3}/sun3/locore.s 
107#locore.o: ${SUN3}/include/trap.h ${SUN3}/include/psl.h ${SUN3}/sun3/pte.h
108#locore.o: ${SUN3}/include/cpu.h
109	${CPP} -DLOCORE ${COPTS} ${SUN3}/sun3/locore.s > plocore.s
110	echo "" >>plocore.s
111	${AS} -o locore.o plocore.s
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 -Dsun3 -o genassym \
131	    ${SUN3}/sun3/genassym.c
132
133depend: assym.s param.c
134	mkdep ${COPTS} ${CFILES} ioconf.c param.c
135	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${SUN3}/sun3/genassym.c ${SUN3}/sun3/locore.s
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
158vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
159	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
160	${CC} ${CFLAGS} -c vers.c
161
162%RULES
163