Makefile.sparc64 revision 1.9
1# 	$NetBSD: Makefile.sparc64,v 1.9 1999/06/05 01:56:31 mrg Exp $
2
3# Makefile for NetBSD
4#
5# This makefile is constructed from a machine description:
6#	config machineid
7# Most changes should be made in the machine description
8#	/sys/arch/sparc64/conf/``machineid''
9# after which you should do
10#	config machineid
11# Machine generic makefile changes should be made in
12#	/sys/arch/sparc64/conf/Makefile.sparc64
13# after which config should be rerun for all machines of that type.
14#
15# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
16#	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
17#
18# -DTRACE	compile in kernel tracing hooks
19# -DQUOTA	compile in file system quotas
20
21# DEBUG is set to -g if debugging.
22# PROF is set to -pg if profiling.
23
24.include "/etc/mk.conf"
25
26CC?=	cc
27.if exists(/usr/ccs/bin/ld)
28LD?=	/usr/ccs/bin/ld #Need to use Solaris ld to use the solaris loader
29.endif
30MKDEP?=	mkdep
31STRIP?=	strip
32SIZE?=	size
33COPTS?= 	-O2
34#### Stuff for cross compiling
35STRIPFLAGS=	-S
36NM?=nm
37LORDER?=lorder
38TSORT?=tsort
39
40
41# deal with Solaris vs. NetBSD build environments for now ..
42OS!=uname -s
43.if (${OS} == "NetBSD")
44USE_GENASSYM?=	no
45.else
46USE_GENASSYM?=	yes
47.endif
48
49.if exists(/usr/ccs/bin/ld)
50SVR4=-U__SVR4 -U__svr4__ -D__NetBSD__
51.else
52SVR4=
53.endif
54
55# source tree is located via $S relative to the compilation directory
56.ifndef S
57S!=	cd ../../../..; pwd
58.endif
59SPARC64=	$S/arch/sparc64
60
61INCLUDES=	-I. -I$S/arch -I$S -nostdinc
62CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL ${SVR4}
63CWARNFLAGS=	-Wimplicit -Wunused -Wswitch -Wcomment -Wtrigraphs -Wchar-subscripts -Wuninitialized -Wparentheses -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith
64#CWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
65CFLAGS=		${DEBUG} ${CWARNFLAGS} -O2 -Wa,-Av9a -mno-fpu
66AFLAGS=		-x assembler-with-cpp -Wa,-Av9a -traditional-cpp -D_LOCORE
67LINKFLAGS=	-N -p -Ttext f8000000 -e start >lderr
68#STRIPFLAGS=	-d
69
70### find out what to use for libkern
71KERN_AS=	obj
72.include "$S/lib/libkern/Makefile.inc"
73.ifndef PROF
74LIBKERN=	${KERNLIB}
75.else
76LIBKERN=	${KERNLIB_PROF}
77.endif
78
79### find out what to use for libcompat
80.include "$S/compat/common/Makefile.inc"
81.ifndef PROF
82LIBCOMPAT=	${COMPATLIB}
83.else
84LIBCOMPAT=	${COMPATLIB_PROF}
85.endif
86
87# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
88# HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
89
90NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
91NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
92
93%OBJS
94
95%CFILES
96
97%SFILES
98
99# load lines for config "xxx" will be emitted as:
100# xxx: ${SYSTEM_DEP} swapxxx.o
101#	${SYSTEM_LD_HEAD}
102#	${SYSTEM_LD} swapxxx.o
103#	${SYSTEM_LD_TAIL}
104SYSTEM_OBJ=	locore.o \
105		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
106SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
107SYSTEM_LD_HEAD=	@rm -f $@
108SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
109		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
110SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
111
112DEBUG?=
113.if ${DEBUG} == "-g"
114LINKFLAGS+=	-X
115SYSTEM_LD_TAIL+=; \
116		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
117		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
118.else
119LINKFLAGS+=	-S
120.endif
121
122%LOAD
123
124.if ${USE_GENASSYM} == "no"
125assym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
126	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
127	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
128	mv -f assym.h.tmp assym.h
129.else
130HOSTED_CC=	${CC}
131HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
132HOSTED_CFLAGS=	${CFLAGS}
133
134HOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
135
136assym.h: genassym
137	./genassym >assym.h
138
139genassym: genassym.o
140	${CC} -o $@ genassym.o
141
142genassym.o: ${SPARC64}/sparc64/genassym.c
143	${HOSTED_C}
144.endif
145
146param.c: $S/conf/param.c
147	rm -f param.c
148	cp $S/conf/param.c .
149
150param.o: param.c Makefile
151	${NORMAL_C}
152
153ioconf.o: ioconf.c
154	${NORMAL_C}
155
156newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
157	sh $S/conf/newvers.sh
158	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
159
160
161clean: cleankernel
162cleankernel:
163	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
164	    [Ee]rrs lderr linterrs makelinks assym.h.tmp assym.h
165
166lint:
167	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
168	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
169	    ioconf.c param.c | \
170	    grep -v 'static function .* unused'
171
172tags:
173	@echo "see $S/kern/Makefile for tags"
174
175links:
176	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
177	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
178	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
179	  sort -u | comm -23 - dontlink | \
180	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
181	sh makelinks && rm -f dontlink
182
183SRCS=	${SPARC64}/sparc64/locore.s \
184	param.c ioconf.c ${CFILES} ${SFILES}
185depend: .depend
186.depend: ${SRCS} assym.h param.c
187	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
188	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
189.if (${SFILES} != "")
190	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
191.endif
192	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
193	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
194	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
195	@rm -f assym.dep
196
197# depend on root or device configuration
198autoconf.o conf.o: Makefile
199
200# depend on network or filesystem configuration 
201uipc_proto.o vfs_conf.o: Makefile 
202
203# depend on maxusers
204machdep.o: Makefile
205
206# depend on CPU configuration 
207bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
208ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
209machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
210
211
212locore.o: ${SPARC64}/sparc64/locore.s assym.h
213	${NORMAL_S}
214
215%RULES
216