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