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