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