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