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