Makefile.sparc64 revision 1.5
1# 	$NetBSD: Makefile.sparc64,v 1.5 1998/09/02 05:51:35 eeh 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
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
65.include "$S/lib/libkern/Makefile.inc"
66.ifndef PROF
67LIBKERN=	${KERNLIB}
68.else
69LIBKERN=	${KERNLIB_PROF}
70.endif
71
72### find out what to use for libcompat
73.include "$S/compat/common/Makefile.inc"
74.ifndef PROF
75LIBCOMPAT=	${COMPATLIB}
76.else
77LIBCOMPAT=	${COMPATLIB_PROF}
78.endif
79
80# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
81# HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
82
83NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
84NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
85
86%OBJS
87
88%CFILES
89
90%SFILES
91
92# load lines for config "xxx" will be emitted as:
93# xxx: ${SYSTEM_DEP} swapxxx.o
94#	${SYSTEM_LD_HEAD}
95#	${SYSTEM_LD} swapxxx.o
96#	${SYSTEM_LD_TAIL}
97SYSTEM_OBJ=	locore.o \
98		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
99SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
100SYSTEM_LD_HEAD=	@rm -f $@
101SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
102		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
103SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
104
105DEBUG?=
106.if ${DEBUG} == "-g"
107LINKFLAGS+=	-X
108SYSTEM_LD_TAIL+=; \
109		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
110		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
111.else
112LINKFLAGS+=	-S
113.endif
114
115%LOAD
116
117.if ${USE_GENASSYM} == "no"
118assym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
119	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
120	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
121	mv -f assym.h.tmp assym.h
122.else
123HOSTED_CC=	${CC}
124HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
125HOSTED_CFLAGS=	${CFLAGS}
126
127HOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
128
129assym.h: genassym
130	./genassym >assym.h
131
132genassym: genassym.o
133	${CC} -o $@ genassym.o
134
135genassym.o: ${SPARC64}/sparc64/genassym.c
136	${HOSTED_C}
137.endif
138
139param.c: $S/conf/param.c
140	rm -f param.c
141	cp $S/conf/param.c .
142
143param.o: param.c Makefile
144	${NORMAL_C}
145
146ioconf.o: ioconf.c
147	${NORMAL_C}
148
149newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
150	sh $S/conf/newvers.sh
151	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
152
153
154clean: cleankernel
155cleankernel:
156	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
157	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
158
159lint:
160	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
161	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
162	    ioconf.c param.c | \
163	    grep -v 'static function .* unused'
164
165tags:
166	@echo "see $S/kern/Makefile for tags"
167
168links:
169	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
170	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
171	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
172	  sort -u | comm -23 - dontlink | \
173	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
174	sh makelinks && rm -f dontlink
175
176SRCS=	${SPARC64}/sparc64/locore.s \
177	param.c ioconf.c ${CFILES} ${SFILES}
178depend: .depend
179.depend: ${SRCS} assym.h param.c
180	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
181	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
182	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
183	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
184	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
185	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
186	@rm -f assym.dep
187
188# depend on root or device configuration
189autoconf.o conf.o: Makefile
190
191# depend on network or filesystem configuration 
192uipc_proto.o vfs_conf.o: Makefile 
193
194# depend on maxusers
195machdep.o: Makefile
196
197# depend on CPU configuration 
198bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
199ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
200machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
201
202
203locore.o: ${SPARC64}/sparc64/locore.s assym.h
204	${NORMAL_S}
205
206%RULES
207