Makefile.sun3 revision 1.20
1# $Id: Makefile.sun3,v 1.20 1994/06/28 21:40:34 gwr 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# For cross development, uncomment XINC, and
21# copy a few things from NetBSD:/usr/include
22# into compile/xinc : nlist.h setjmp.h stab.h
23XINC = -nostdinc -I../xinc
24AWK = nawk
25
26# DEBUG is set to -g by config if debugging is requested (config -g).
27# DEBUG=-g XXX
28# PROF is set to -pg by config if profiling is requested (config -p).
29AS=	gas 
30CC=	gcc ${DEBUG}
31CPP=	gcpp -traditional ${XINC}
32LD=	ld
33TOUCH=	touch -f -c
34GPROF.EX=/usr/src/usr.lib/libc/csu/sun3/gmon.ex
35
36# source tree is located via $S relative to the compilation directory
37S=	../../../..
38SUN3=	../..
39LIBKERN=../libkern.a
40
41INCLUDES= ${XINC} -I. -I../.. -I$S -I$S/sys -I$S/arch
42COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Dmc68020 -Dsun3
43CFLAGS=	${COPTS}
44
45# compile rules: rules are named ${TYPE}_${SUFFIX}${CONFIG_DEP}
46# where TYPE is NORMAL, DRIVER, or PROFILE}; SUFFIX is the file suffix,
47# capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file
48# is marked as config-dependent.
49
50NORMAL_C=	${CC} -c ${CFLAGS} ${PROF} $<
51NORMAL_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
52
53DRIVER_C=	${CC} -c ${CFLAGS} ${PROF} $<
54DRIVER_C_C=	${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
55
56PROFILE_C=	${CC} -S -c ${COPTS} $<; \
57		ex - $*.s < ${GPROF.EX}; \
58		${AS} -o $@ $*.s; \
59		rm -f $*.s
60
61NORMAL_S=	${CPP} ${COPTS} $< | ${AS} -o $@
62NORMAL_S_C=	${CPP} ${COPTS} ${PARAM} $< | ${AS} -o $@
63
64%OBJS
65
66%CFILES
67
68# load lines for config "xxx" will be emitted as:
69# xxx: ${SYSTEM_DEP} swapxxx.o
70#	${SYSTEM_LD_HEAD}
71#	${SYSTEM_LD} swapxxx.o
72#	${SYSTEM_LD_TAIL}
73DEBUG?=
74.if ${DEBUG} == "-g"
75LDX=-X
76.else
77LDX=-S
78.endif
79SYSTEM_OBJ=	locore.o vnode_if.o ${OBJS} param.o ioconf.o
80#SYSTEM_DEP=	Makefile symbols.sort ${SYSTEM_OBJ}
81SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
82SYSTEM_LD_HEAD=	@echo loading $@; rm -f $@
83SYSTEM_LD=	-@echo ${LD} ${LDX} -n -N -e start -T 0E004000 -o $@ \
84		    '$${SYSTEM_OBJ}' vers.o ${LIBKERN}; \
85		${LD} ${LDX} -n -N -e start -T 0E004000 -o $@ \
86		    ${SYSTEM_OBJ} vers.o ${LIBKERN}
87#SYSTEM_LD_TAIL= @echo rearranging symbols;\
88#		symorder symbols.sort $@;\
89SYSTEM_LD_TAIL=	@size $@; chmod 755 $@; \
90		[ X${DEBUG} = X-g ] && { \
91		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
92		echo strip $@; strip $@; } || true
93
94%LOAD
95
96newvers:
97	sh $S/conf/newvers.sh
98	${CC} $(CFLAGS) -c vers.c
99
100clean:
101	rm -f eddep netbsd* tags *.o locore.i [a-z]*.s \
102		Errs errs linterrs makelinks
103
104lint: /tmp param.c
105	@lint -hbxn -DGENERIC -Dvolatile= ${COPTS} ${PARAM} -UKGDB \
106	    ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \
107	    ioconf.c param.c| \
108	    grep -v 'struct/union .* never defined' | \
109	    grep -v 'possible pointer alignment problem'
110
111symbols.sort: ${SUN3}/sun3/symbols.raw
112	grep -v '^#' ${SUN3}/sun3/symbols.raw \
113	    | sed 's/^	//' | sort -u > symbols.sort
114
115locore.o: assym.s ${SUN3}/sun3/locore.s ${SUN3}/include/asm.h \
116	${S}/sys/syscall.h ${SUN3}/sun3/lib.s ${SUN3}/sun3/m68k.s \
117	${SUN3}/sun3/signal.s ${SUN3}/sun3/process.s \
118	${SUN3}/sun3/softint.s ${SUN3}/sun3/interrupt.s \
119	${SUN3}/sun3/trap.s
120	${CPP} -DLOCORE ${COPTS} ${SUN3}/sun3/locore.s > plocore.s
121	echo "" >>plocore.s
122	${AS} -o locore.o plocore.s
123
124# the following is necessary because autoconf.o depends on #if GENERIC
125autoconf.o: Makefile
126
127# depends on device configuration
128conf.o : Makefile
129
130# depends on value of SYMTAB_SPACE
131db_aout.o : Makefile
132
133sun3_startup.o pmap.o kern_xxx.o: Makefile
134
135# depend on network configuration
136af.o uipc_proto.o locore.o: Makefile
137
138# depend on maxusers
139assym.s: Makefile
140
141assym.s: genassym
142	./genassym >assym.s
143
144genassym:
145	${CC} ${INCLUDES} ${IDENT} ${PARAM} -Dmc68020 -Dsun3 -o genassym \
146	    ${SUN3}/sun3/genassym.c
147
148depend: assym.s param.c vnode_if.h
149	mkdep ${COPTS} ${CFILES} ioconf.c param.c
150	mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${SUN3}/sun3/genassym.c 
151
152links:
153	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
154	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
155	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
156	  sort -u | comm -23 - dontlink | \
157	  sed 's,../.*/\(.*.o\),rm -f \1;ln -s ../GENERIC/\1 \1,' > makelinks
158	sh makelinks && rm -f dontlink
159
160tags:
161	@echo "see $S/kern/Makefile for tags"
162
163ioconf.o: ioconf.c
164	${CC} -c ${CFLAGS} ioconf.c
165
166param.c: $S/conf/param.c
167	rm -f param.c
168	cp $S/conf/param.c .
169
170param.o: param.c Makefile
171	${CC} -c ${CFLAGS} ${PARAM} param.c
172
173vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
174	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
175	${CC} ${CFLAGS} -c vers.c
176
177vnode_if.c vnode_if.h : $S/kern/vnode_if.sh $S/kern/vnode_if.src
178	AWK="${AWK}" sh $S/kern/vnode_if.sh $S/kern/vnode_if.src
179
180%RULES
181