Home | History | Annotate | Line # | Download | only in conf
Makefile.sparc64 revision 1.40
      1  1.40   thorpej # 	$NetBSD: Makefile.sparc64,v 1.40 2001/10/24 18:49:39 thorpej 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.40   thorpej # Always use sparc64 as the MACHINE_ARCH, so we select the correct
     16  1.40   thorpej # toolchain (i.e. need v9 instruction support in the assembler, etc.)
     17  1.40   thorpej # 32-bit vs. 64-bit will be selected based on compiler/assember options.
     18  1.40   thorpej MACHINE_ARCH=sparc64
     19  1.40   thorpej 
     20  1.39   thorpej .include <bsd.own.mk>
     21  1.39   thorpej 
     22   1.1       eeh # DEBUG is set to -g if debugging.
     23   1.1       eeh # PROF is set to -pg if profiling.
     24   1.1       eeh 
     25  1.39   thorpej AR?=	ar
     26  1.39   thorpej AS?=	as
     27   1.1       eeh CC?=	cc
     28  1.39   thorpej CPP?=	cpp
     29  1.39   thorpej LD?=	ld
     30  1.39   thorpej LORDER?=lorder
     31   1.1       eeh MKDEP?=	mkdep
     32  1.39   thorpej NM?=	nm
     33  1.39   thorpej RANLIB?=ranlib
     34   1.2       mrg SIZE?=	size
     35  1.39   thorpej STRIP?=	strip
     36  1.39   thorpej TSORT?=	tsort -q
     37  1.39   thorpej 
     38   1.1       eeh COPTS?= 	-O2
     39   1.4       mrg 
     40   1.1       eeh # source tree is located via $S relative to the compilation directory
     41   1.1       eeh .ifndef S
     42   1.1       eeh S!=	cd ../../../..; pwd
     43   1.1       eeh .endif
     44   1.1       eeh SPARC64=	$S/arch/sparc64
     45   1.1       eeh 
     46   1.1       eeh INCLUDES=	-I. -I$S/arch -I$S -nostdinc
     47  1.39   thorpej CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dsparc64
     48  1.39   thorpej CWARNFLAGS=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
     49  1.39   thorpej 		-Wpointer-arith
     50  1.39   thorpej # XXX Delete -Wuninitialized for now, since the compiler doesn't
     51  1.39   thorpej # XXX always get it right.  --thorpej
     52  1.32      fvdl CWARNFLAGS+=	-Wno-uninitialized
     53  1.39   thorpej CWARNFLAGS+=	-Wno-main
     54  1.40   thorpej 
     55  1.40   thorpej # Select the compiler, assembler, and linker flags based on the
     56  1.40   thorpej # LP64 variable.
     57  1.40   thorpej LP64?=	no
     58  1.40   thorpej .if ${LP64} == "yes"
     59  1.40   thorpej CC:=		${CC} -m64
     60  1.40   thorpej AS:=		${AS} -64
     61  1.40   thorpej LD:=		${LD} -m elf64_sparc
     62  1.40   thorpej CPPFLAGS+=	-D_LP64
     63  1.40   thorpej .else
     64  1.40   thorpej CC:=		${CC} -m32
     65  1.40   thorpej AS:=		${AS} -32
     66  1.40   thorpej LD:=		${LD} -m elf32_sparc
     67  1.40   thorpej .endif
     68  1.40   thorpej 
     69  1.27   mycroft CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu
     70  1.30       eeh .if defined(PROF)
     71  1.30       eeh # We need to run the compiler in medlow memory model.
     72  1.40   thorpej CFLAGS+=	-mcmodel=medlow
     73  1.30       eeh .endif
     74  1.27   mycroft AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a
     75  1.31       eeh 
     76  1.31       eeh #
     77  1.31       eeh # Gotta find a way to make kernel base tuneable.
     78  1.31       eeh #
     79  1.31       eeh 
     80  1.38       eeh LINKFLAGS=	-Ttext 01000000 -Tdata 01800000 -e start
     81  1.34       mrg #LINKFLAGS=	-Ttext f1000000 -Tdata f1400000 -e start
     82  1.34       mrg 
     83  1.34       mrg LINKFLAGS+=	-n -T ${SPARC64}/conf/${KERN_LDSCRIPT}
     84  1.40   thorpej .if ${LP64} == "yes"
     85  1.34       mrg KERN_LDSCRIPT?= kern.ldscript
     86  1.35       mrg .else
     87  1.35       mrg KERN_LDSCRIPT?= kern32.ldscript
     88  1.35       mrg .endif
     89  1.31       eeh 
     90  1.15   tsutsui STRIPFLAGS=	-g
     91  1.10       mrg 
     92  1.10       mrg %INCLUDES
     93   1.1       eeh 
     94   1.1       eeh ### find out what to use for libkern
     95  1.14       eeh # KERN_AS=	obj	# bcopy, bzero, memcpy, memset, etc. are in locore.s
     96   1.1       eeh .include "$S/lib/libkern/Makefile.inc"
     97   1.1       eeh .ifndef PROF
     98   1.1       eeh LIBKERN=	${KERNLIB}
     99   1.1       eeh .else
    100   1.1       eeh LIBKERN=	${KERNLIB_PROF}
    101   1.1       eeh .endif
    102   1.1       eeh 
    103   1.1       eeh ### find out what to use for libcompat
    104   1.1       eeh .include "$S/compat/common/Makefile.inc"
    105   1.1       eeh .ifndef PROF
    106   1.1       eeh LIBCOMPAT=	${COMPATLIB}
    107   1.1       eeh .else
    108   1.1       eeh LIBCOMPAT=	${COMPATLIB_PROF}
    109   1.1       eeh .endif
    110   1.1       eeh 
    111   1.1       eeh # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
    112   1.1       eeh # HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
    113   1.1       eeh 
    114  1.27   mycroft NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
    115  1.27   mycroft NOOPT_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -O0 -c $<
    116   1.1       eeh NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
    117   1.1       eeh 
    118   1.1       eeh %OBJS
    119   1.1       eeh 
    120   1.1       eeh %CFILES
    121   1.1       eeh 
    122   1.1       eeh %SFILES
    123   1.1       eeh 
    124   1.1       eeh # load lines for config "xxx" will be emitted as:
    125   1.1       eeh # xxx: ${SYSTEM_DEP} swapxxx.o
    126   1.1       eeh #	${SYSTEM_LD_HEAD}
    127   1.1       eeh #	${SYSTEM_LD} swapxxx.o
    128   1.1       eeh #	${SYSTEM_LD_TAIL}
    129   1.1       eeh SYSTEM_OBJ=	locore.o \
    130   1.6  drochner 		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
    131   1.1       eeh SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
    132  1.27   mycroft SYSTEM_LD_HEAD=	rm -f $@
    133   1.1       eeh SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
    134   1.1       eeh 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
    135   1.2       mrg SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
    136   1.1       eeh 
    137   1.1       eeh DEBUG?=
    138   1.1       eeh .if ${DEBUG} == "-g"
    139   1.1       eeh LINKFLAGS+=	-X
    140   1.1       eeh SYSTEM_LD_TAIL+=; \
    141  1.12       cgd 		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
    142  1.19       eeh 		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
    143  1.19       eeh 		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
    144   1.1       eeh .else
    145   1.1       eeh LINKFLAGS+=	-S
    146   1.1       eeh .endif
    147   1.1       eeh 
    148   1.1       eeh %LOAD
    149   1.2       mrg 
    150   1.1       eeh assym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf
    151  1.27   mycroft 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    152   1.1       eeh 	    < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \
    153   1.1       eeh 	mv -f assym.h.tmp assym.h
    154   1.1       eeh 
    155   1.1       eeh param.c: $S/conf/param.c
    156   1.1       eeh 	rm -f param.c
    157   1.1       eeh 	cp $S/conf/param.c .
    158   1.1       eeh 
    159   1.1       eeh param.o: param.c Makefile
    160   1.1       eeh 	${NORMAL_C}
    161   1.1       eeh 
    162   1.1       eeh ioconf.o: ioconf.c
    163   1.1       eeh 	${NORMAL_C}
    164   1.1       eeh 
    165   1.1       eeh newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    166   1.1       eeh 	sh $S/conf/newvers.sh
    167  1.25       eeh 	${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    168  1.22       eeh 
    169   1.1       eeh 
    170  1.21       mrg __CLEANKERNEL: .USE
    171  1.21       mrg 	@echo "${.TARGET}ing the kernel objects"
    172   1.1       eeh 	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
    173  1.28   mycroft 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    174  1.21       mrg 
    175  1.21       mrg __CLEANDEPEND: .USE
    176  1.21       mrg 	rm -f .depend
    177  1.21       mrg 
    178  1.21       mrg clean: __CLEANKERNEL
    179  1.21       mrg 
    180  1.21       mrg cleandir distclean: __CLEANKERNEL __CLEANDEPEND
    181   1.1       eeh 
    182   1.1       eeh lint:
    183   1.1       eeh 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    184   1.1       eeh 	    ${SPARC64}/sparc64/Locore.c ${CFILES} \
    185   1.1       eeh 	    ioconf.c param.c | \
    186   1.1       eeh 	    grep -v 'static function .* unused'
    187   1.1       eeh 
    188   1.1       eeh tags:
    189   1.1       eeh 	@echo "see $S/kern/Makefile for tags"
    190   1.1       eeh 
    191   1.1       eeh links:
    192   1.1       eeh 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    193   1.1       eeh 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    194   1.1       eeh 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    195   1.1       eeh 	  sort -u | comm -23 - dontlink | \
    196   1.1       eeh 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    197   1.1       eeh 	sh makelinks && rm -f dontlink
    198   1.1       eeh 
    199   1.1       eeh SRCS=	${SPARC64}/sparc64/locore.s \
    200   1.1       eeh 	param.c ioconf.c ${CFILES} ${SFILES}
    201   1.1       eeh depend: .depend
    202   1.1       eeh .depend: ${SRCS} assym.h param.c
    203   1.1       eeh 	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s
    204   1.1       eeh 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    205   1.9       mrg .if (${SFILES} != "")
    206   1.1       eeh 	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
    207   1.9       mrg .endif
    208  1.25       eeh 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \
    209   1.1       eeh 	  ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf
    210   1.1       eeh 	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
    211   1.1       eeh 	@rm -f assym.dep
    212  1.17      tron 
    213  1.17      tron dependall: depend all
    214  1.17      tron 
    215   1.1       eeh 
    216   1.1       eeh # depend on root or device configuration
    217   1.1       eeh autoconf.o conf.o: Makefile
    218   1.2       mrg 
    219   1.1       eeh # depend on network or filesystem configuration 
    220   1.1       eeh uipc_proto.o vfs_conf.o: Makefile 
    221   1.1       eeh 
    222   1.1       eeh # depend on maxusers
    223   1.1       eeh machdep.o: Makefile
    224   1.1       eeh 
    225   1.1       eeh # depend on CPU configuration 
    226   1.1       eeh bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
    227   1.1       eeh ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
    228   1.1       eeh machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
    229   1.1       eeh 
    230   1.1       eeh 
    231   1.1       eeh locore.o: ${SPARC64}/sparc64/locore.s assym.h
    232   1.1       eeh 	${NORMAL_S}
    233  1.23   hubertf 
    234  1.23   hubertf # The install target can be redefined by putting a
    235  1.23   hubertf # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
    236  1.23   hubertf MACHINE_NAME!=  uname -n
    237  1.23   hubertf install: install-kernel-${MACHINE_NAME}
    238  1.23   hubertf .if !target(install-kernel-${MACHINE_NAME}})
    239  1.23   hubertf install-kernel-${MACHINE_NAME}:
    240  1.23   hubertf 	rm -f /onetbsd
    241  1.23   hubertf 	ln /netbsd /onetbsd
    242  1.23   hubertf 	cp netbsd /nnetbsd
    243  1.23   hubertf 	mv /nnetbsd /netbsd
    244  1.23   hubertf .endif
    245   1.1       eeh 
    246   1.1       eeh %RULES
    247