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