Makefile.sun3 revision 1.11
1# $Id: Makefile.sun3,v 1.11 1993/11/10 07:42:12 deraadt Exp $
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).
22DEBUG=-g
23# PROF is set to -pg by config if profiling is requested (config -p).
24AS=	gas 
25CC=	gcc ${DEBUG}
26CPP=	gcpp -traditional
27LD=	ld
28TOUCH=	touch -f -c
29GPROF.EX=/usr/src/usr.lib/libc/csu/sun3/gmon.ex
30
31# source tree is located via $S relative to the compilation directory
32S=	../../../..
33SUN3=	../..
34LIBKERN=../libkern.a
35
36INCLUDES= -I. -I$S -I$S/sys
37COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Dmc68020 -Dsun3
38CFLAGS=	${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		ex - $*.s < ${GPROF.EX}; \
53		${AS} -o $@ $*.s; \
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}
68DEBUG?=
69.if ${DEBUG} == "-g"
70LDX=-X
71.else
72LDX=-x
73.endif
74SYSTEM_OBJ=	locore.o ${OBJS} param.o ioconf.o
75#SYSTEM_DEP=	Makefile symbols.sort ${SYSTEM_OBJ}
76SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
77SYSTEM_LD_HEAD=	@echo loading $@; rm -f $@
78SYSTEM_LD=	-@echo ${LD} ${LDX} -p -N -e start -T 0E004000 -o $@ \
79		    '$${SYSTEM_OBJ}' vers.o ${LIBKERN}; \
80		${LD} ${LDX} -p -N -e start -T 0E004000 -o $@ \
81		    ${SYSTEM_OBJ} vers.o ${LIBKERN}
82#SYSTEM_LD_TAIL= @echo rearranging symbols;\
83#		symorder symbols.sort $@;\
84SYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
85		[ X${DEBUG} = X-g ] && { \
86		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
87		echo strip $@; strip $@; } || true
88
89%LOAD
90
91newvers:
92	sh $S/conf/newvers.sh
93	${CC} $(CFLAGS) -c vers.c
94
95clean:
96	rm -f eddep netbsd* tags *.o locore.i [a-z]*.s \
97		Errs errs linterrs makelinks
98
99lint: /tmp param.c
100	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
101	    ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
102	    ioconf.c param.c| \
103	    grep -v 'struct/union .* never defined' | \
104	    grep -v 'possible pointer alignment problem'
105
106symbols.sort: ${SUN3}/sun3/symbols.raw
107	grep -v '^#' ${SUN3}/sun3/symbols.raw \
108	    | sed 's/^	//' | sort -u > symbols.sort
109
110locore.o: assym.s ${SUN3}/sun3/locore.s 
111locore.o: ${SUN3}/include/trap.h ${SUN3}/include/psl.h 
112locore.o: ${SUN3}/include/cpu.h ${SUN3}/include/control.h
113#locore.o: assym.s ${SUN3}/sun3/vectors.s ${SUN3}/sun3/locore.s 
114#locore.o: ${SUN3}/include/trap.h ${SUN3}/include/psl.h ${SUN3}/sun3/pte.h
115#locore.o: ${SUN3}/include/cpu.h
116	${CPP} -DLOCORE ${COPTS} ${SUN3}/sun3/locore.s > plocore.s
117	echo "" >>plocore.s
118	${AS} -o locore.o plocore.s
119
120# the following is necessary because autoconf.o depends on #if GENERIC
121autoconf.o: Makefile
122
123sun3_startup.o: Makefile
124
125# depend on network configuration
126af.o uipc_proto.o locore.o: Makefile
127
128# depend on maxusers
129assym.s: Makefile
130
131assym.s: genassym
132	./genassym >assym.s
133
134genassym:
135	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dsun3 -o genassym \
136	    ${SUN3}/sun3/genassym.c
137
138depend: assym.s param.c
139	mkdep ${COPTS} ${CFILES} ioconf.c param.c
140	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${SUN3}/sun3/genassym.c 
141
142links:
143	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
144	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
145	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
146	  sort -u | comm -23 - dontlink | \
147	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
148	sh makelinks && rm -f dontlink
149
150tags:
151	@echo "see $S/kern/Makefile for tags"
152
153ioconf.o: ioconf.c
154	${CC} -c ${CFLAGS} ioconf.c
155
156param.c: $S/conf/param.c
157	rm -f param.c
158	cp $S/conf/param.c .
159
160param.o: param.c Makefile
161	${CC} -c ${CFLAGS} ${PARAM} param.c
162
163vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
164	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
165	${CC} ${CFLAGS} -c vers.c
166
167%RULES
168