Home | History | Annotate | Line # | Download | only in conf
Makefile.sparc64 revision 1.43
      1 # 	$NetBSD: Makefile.sparc64,v 1.43 2001/11/20 12:56:39 lukem 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 # Default to 32-bit.  Set the MACHINE_ARCH accordingly, using either
     16 # the 32-bit or 64-bit toolchain.
     17 LP64?=	no
     18 .if ${LP64} == "yes"
     19 MACHINE_ARCH=sparc64
     20 .else
     21 MACHINE_ARCH=sparc
     22 .endif
     23 
     24 USETOOLS?=	no
     25 
     26 .include <bsd.own.mk>
     27 
     28 # DEBUG is set to -g if debugging.
     29 # PROF is set to -pg if profiling.
     30 
     31 AR?=	ar
     32 AS?=	as
     33 CC?=	cc
     34 CPP?=	cpp
     35 LD?=	ld
     36 LORDER?=lorder
     37 MKDEP?=	mkdep
     38 NM?=	nm
     39 RANLIB?=ranlib
     40 SIZE?=	size
     41 STRIP?=	strip
     42 TSORT?=	tsort -q
     43 
     44 COPTS?= 	-O2
     45 
     46 # source tree is located via $S relative to the compilation directory
     47 .ifndef S
     48 S!=	cd ../../../..; pwd
     49 .endif
     50 SPARC64=	$S/arch/sparc64
     51 
     52 INCLUDES=	-I. -I$S/arch -I$S -nostdinc
     53 CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dsparc64
     54 CWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
     55 		-Wpointer-arith
     56 # XXX Delete -Wuninitialized for now, since the compiler doesn't
     57 # XXX always get it right.  --thorpej
     58 CWARNFLAGS+=	-Wno-uninitialized
     59 CWARNFLAGS+=	-Wno-main
     60 .if ${LP64} == "yes"
     61 CPPFLAGS+=	-D_LP64
     62 .endif
     63 
     64 CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu
     65 .if defined(PROF)
     66 # We need to run the compiler in medlow memory model.
     67 CFLAGS+=	-mcmodel=medlow
     68 .endif
     69 AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a
     70 
     71 #
     72 # Gotta find a way to make kernel base tuneable.
     73 #
     74 
     75 LINKFLAGS=	-Ttext 01000000 -Tdata 01800000 -e start
     76 #LINKFLAGS=	-Ttext f1000000 -Tdata f1400000 -e start
     77 
     78 LINKFLAGS+=	-n -T ${SPARC64}/conf/${KERN_LDSCRIPT}
     79 .if ${LP64} == "yes"
     80 KERN_LDSCRIPT?= kern.ldscript
     81 .else
     82 KERN_LDSCRIPT?= kern32.ldscript
     83 .endif
     84 
     85 STRIPFLAGS=	-g
     86 
     87 %INCLUDES
     88 
     89 ### find out what to use for libkern
     90 # KERN_AS=	obj	# bcopy, bzero, memcpy, memset, etc. are in locore.s
     91 .include "$S/lib/libkern/Makefile.inc"
     92 .ifndef PROF
     93 LIBKERN=	${KERNLIB}
     94 .else
     95 LIBKERN=	${KERNLIB_PROF}
     96 .endif
     97 
     98 ### find out what to use for libcompat
     99 .include "$S/compat/common/Makefile.inc"
    100 .ifndef PROF
    101 LIBCOMPAT=	${COMPATLIB}
    102 .else
    103 LIBCOMPAT=	${COMPATLIB_PROF}
    104 .endif
    105 
    106 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
    107 # HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
    108 
    109 NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
    110 NOOPT_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -O0 -c $<
    111 NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
    112 
    113 %OBJS
    114 
    115 %CFILES
    116 
    117 %SFILES
    118 
    119 # load lines for config "xxx" will be emitted as:
    120 # xxx: ${SYSTEM_DEP} swapxxx.o
    121 #	${SYSTEM_LD_HEAD}
    122 #	${SYSTEM_LD} swapxxx.o
    123 #	${SYSTEM_LD_TAIL}
    124 SYSTEM_OBJ=	locore.o \
    125 		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
    126 SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
    127 SYSTEM_LD_HEAD=	rm -f $@
    128 SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
    129 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
    130 SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
    131 
    132 DEBUG?=
    133 .if ${DEBUG} == "-g"
    134 LINKFLAGS+=	-X
    135 SYSTEM_LD_TAIL+=; \
    136 		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
    137 		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
    138 		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
    139 .else
    140 LINKFLAGS+=	-S
    141 .endif
    142 
    143 %LOAD
    144 
    145 assym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
    146 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    147 	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
    148 	mv -f assym.h.tmp assym.h
    149 
    150 param.c: $S/conf/param.c
    151 	rm -f param.c
    152 	cp $S/conf/param.c .
    153 
    154 param.o: param.c Makefile
    155 	${NORMAL_C}
    156 
    157 ioconf.o: ioconf.c
    158 	${NORMAL_C}
    159 
    160 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    161 	sh $S/conf/newvers.sh
    162 	${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    163 
    164 
    165 __CLEANKERNEL: .USE
    166 	@echo "${.TARGET}ing the kernel objects"
    167 	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
    168 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    169 
    170 __CLEANDEPEND: .USE
    171 	rm -f .depend
    172 
    173 clean: __CLEANKERNEL
    174 
    175 cleandir distclean: __CLEANKERNEL __CLEANDEPEND
    176 
    177 lint:
    178 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    179 	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
    180 	    ioconf.c param.c | \
    181 	    grep -v 'static function .* unused'
    182 
    183 tags:
    184 	@echo "see $S/kern/Makefile for tags"
    185 
    186 links:
    187 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    188 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    189 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    190 	  sort -u | comm -23 - dontlink | \
    191 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    192 	sh makelinks && rm -f dontlink
    193 
    194 SRCS=	${SPARC64}/sparc64/locore.s \
    195 	param.c ioconf.c ${CFILES} ${SFILES}
    196 depend: .depend
    197 .depend: ${SRCS} assym.h param.c
    198 	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
    199 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    200 .if (${SFILES} != "")
    201 	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
    202 .endif
    203 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \
    204 	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
    205 	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
    206 	@rm -f assym.dep
    207 
    208 dependall: depend all
    209 
    210 
    211 # depend on root or device configuration
    212 autoconf.o conf.o: Makefile
    213 
    214 # depend on network or filesystem configuration
    215 uipc_proto.o vfs_conf.o: Makefile
    216 
    217 # depend on maxusers
    218 machdep.o: Makefile
    219 
    220 # depend on CPU configuration
    221 bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
    222 ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
    223 machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
    224 
    225 
    226 locore.o: ${SPARC64}/sparc64/locore.s assym.h
    227 	${NORMAL_S}
    228 
    229 # The install target can be redefined by putting a
    230 # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
    231 MACHINE_NAME!=  uname -n
    232 install: install-kernel-${MACHINE_NAME}
    233 .if !target(install-kernel-${MACHINE_NAME}})
    234 install-kernel-${MACHINE_NAME}:
    235 	rm -f /onetbsd
    236 	ln /netbsd /onetbsd
    237 	cp netbsd /nnetbsd
    238 	mv /nnetbsd /netbsd
    239 .endif
    240 
    241 %RULES
    242