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