Home | History | Annotate | Line # | Download | only in conf
Makefile.sparc64 revision 1.12.2.2
      1 # 	$NetBSD: Makefile.sparc64,v 1.12.2.2 2000/12/08 09:30:32 bouyer 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 -Wno-main -Werror
     68 #CWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
     69 CWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-main
     70 CWARNFLAGS+=	-Wno-uninitialized
     71 CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu
     72 .if defined(PROF)
     73 # We need to run the compiler in medlow memory model.
     74 CFLAGS += -mcmodel=medlow
     75 .endif
     76 AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a
     77 
     78 #
     79 # Gotta find a way to make kernel base tuneable.
     80 #
     81 
     82 LINKFLAGS=	-Ttext 01000000 -Tdata 01400000 -e start
     83 
     84 #LINKFLAGS=	-Ttext f1000000 -Tdata f1400000 -e start
     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 .if ${USE_GENASSYM} == "no"
    146 assym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
    147 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    148 	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
    149 	mv -f assym.h.tmp assym.h
    150 .else
    151 HOSTED_CC=	${CC}
    152 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
    153 HOSTED_CFLAGS=	${CFLAGS}
    154 
    155 HOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
    156 
    157 assym.h: genassym
    158 	./genassym >assym.h
    159 
    160 genassym: genassym.o
    161 	${CC} -o $@ genassym.o
    162 
    163 genassym.o: ${SPARC64}/sparc64/genassym.c
    164 	${HOSTED_C}
    165 .endif
    166 
    167 param.c: $S/conf/param.c
    168 	rm -f param.c
    169 	cp $S/conf/param.c .
    170 
    171 param.o: param.c Makefile
    172 	${NORMAL_C}
    173 
    174 ioconf.o: ioconf.c
    175 	${NORMAL_C}
    176 
    177 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    178 	sh $S/conf/newvers.sh
    179 	${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    180 
    181 
    182 __CLEANKERNEL: .USE
    183 	@echo "${.TARGET}ing the kernel objects"
    184 	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
    185 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    186 
    187 __CLEANDEPEND: .USE
    188 	rm -f .depend
    189 
    190 clean: __CLEANKERNEL
    191 
    192 cleandir distclean: __CLEANKERNEL __CLEANDEPEND
    193 
    194 lint:
    195 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    196 	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
    197 	    ioconf.c param.c | \
    198 	    grep -v 'static function .* unused'
    199 
    200 tags:
    201 	@echo "see $S/kern/Makefile for tags"
    202 
    203 links:
    204 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    205 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    206 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    207 	  sort -u | comm -23 - dontlink | \
    208 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    209 	sh makelinks && rm -f dontlink
    210 
    211 SRCS=	${SPARC64}/sparc64/locore.s \
    212 	param.c ioconf.c ${CFILES} ${SFILES}
    213 depend: .depend
    214 .depend: ${SRCS} assym.h param.c
    215 	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
    216 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    217 .if (${SFILES} != "")
    218 	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
    219 .endif
    220 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \
    221 	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
    222 	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
    223 	@rm -f assym.dep
    224 
    225 dependall: depend all
    226 
    227 
    228 # depend on root or device configuration
    229 autoconf.o conf.o: Makefile
    230 
    231 # depend on network or filesystem configuration 
    232 uipc_proto.o vfs_conf.o: Makefile 
    233 
    234 # depend on maxusers
    235 machdep.o: Makefile
    236 
    237 # depend on CPU configuration 
    238 bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
    239 ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
    240 machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
    241 
    242 
    243 locore.o: ${SPARC64}/sparc64/locore.s assym.h
    244 	${NORMAL_S}
    245 
    246 # The install target can be redefined by putting a
    247 # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
    248 MACHINE_NAME!=  uname -n
    249 install: install-kernel-${MACHINE_NAME}
    250 .if !target(install-kernel-${MACHINE_NAME}})
    251 install-kernel-${MACHINE_NAME}:
    252 	rm -f /onetbsd
    253 	ln /netbsd /onetbsd
    254 	cp netbsd /nnetbsd
    255 	mv /nnetbsd /netbsd
    256 .endif
    257 
    258 %RULES
    259