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