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