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