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