Home | History | Annotate | Line # | Download | only in conf
Makefile.sparc revision 1.75
      1  1.75       jmc # 	$NetBSD: Makefile.sparc,v 1.75 2001/10/26 06:45:39 jmc Exp $
      2  1.15   deraadt 
      3  1.25   mycroft # Makefile for NetBSD
      4   1.1   deraadt #
      5   1.1   deraadt # This makefile is constructed from a machine description:
      6   1.1   deraadt #	config machineid
      7   1.1   deraadt # Most changes should be made in the machine description
      8  1.25   mycroft #	/sys/arch/sparc/conf/``machineid''
      9   1.1   deraadt # after which you should do
     10  1.25   mycroft #	config machineid
     11   1.1   deraadt # Machine generic makefile changes should be made in
     12  1.25   mycroft #	/sys/arch/sparc/conf/Makefile.sparc
     13   1.1   deraadt # after which config should be rerun for all machines of that type.
     14  1.74   thorpej 
     15  1.74   thorpej MACHINE_ARCH=sparc
     16  1.75       jmc USETOOLS?=	no
     17   1.1   deraadt 
     18  1.56  christos .include <bsd.own.mk>
     19  1.56  christos 
     20   1.1   deraadt # DEBUG is set to -g if debugging.
     21   1.1   deraadt # PROF is set to -pg if profiling.
     22   1.1   deraadt 
     23  1.50   thorpej AR?=	ar
     24  1.50   thorpej AS?=	as
     25  1.28   mycroft CC?=	cc
     26  1.50   thorpej CPP?=	cpp
     27  1.28   mycroft LD?=	ld
     28  1.49   thorpej LORDER?=lorder
     29  1.33   mycroft MKDEP?=	mkdep
     30  1.49   thorpej NM?=	nm
     31  1.50   thorpej RANLIB?=ranlib
     32  1.48     lukem SIZE?=	size
     33  1.67   tsutsui STRIP?=	strip
     34  1.49   thorpej TSORT?=	tsort -q
     35  1.50   thorpej 
     36  1.48     lukem COPTS?=	-O2
     37   1.1   deraadt 
     38   1.1   deraadt # source tree is located via $S relative to the compilation directory
     39  1.36   mycroft .ifndef S
     40  1.33   mycroft S!=	cd ../../../..; pwd
     41  1.36   mycroft .endif
     42  1.33   mycroft SPARC=	$S/arch/sparc
     43   1.1   deraadt 
     44  1.68   thorpej HAVE_EGCS!=	${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 
     45  1.34   mycroft INCLUDES=	-I. -I$S/arch -I$S -nostdinc
     46  1.73       mrg CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT
     47  1.55  augustss CWARNFLAGS?=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
     48  1.55  augustss 		-Wpointer-arith
     49  1.68   thorpej # XXX Delete -Wuninitialized for now, since the compiler doesn't
     50  1.68   thorpej # XXX always get it right.  --thorpej 
     51  1.68   thorpej CWARNFLAGS+=	-Wno-uninitialized
     52  1.68   thorpej .if (${HAVE_EGCS} != "")
     53  1.51        tv CWARNFLAGS+=	-Wno-main
     54  1.51        tv .endif
     55  1.38  jonathan CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS}
     56  1.71        pk # work around GCC (egcs-2.91.66) bug which is liable
     57  1.71        pk # to use FPU registers as temporaries:
     58  1.71        pk CFLAGS+=	-mno-fpu
     59  1.27   mycroft AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
     60  1.56  christos LINKFLAGS=	-Ttext F0004000 -e start
     61  1.56  christos .if ${OBJECT_FMT} != "ELF"
     62  1.56  christos LINKFLAGS+=	-N -p
     63  1.58  christos .else
     64  1.72        pk KERN_LDSCRIPT?= kern.ldscript
     65  1.72        pk LINKFLAGS+=	-n -T ${SPARC}/conf/${KERN_LDSCRIPT}
     66  1.56  christos .endif
     67  1.64   tsutsui STRIPFLAGS=	-g
     68  1.61       mrg 
     69  1.61       mrg %INCLUDES
     70  1.37   mycroft 
     71   1.5   deraadt ### find out what to use for libkern
     72  1.54  drochner KERN_AS=	obj
     73   1.5   deraadt .include "$S/lib/libkern/Makefile.inc"
     74   1.5   deraadt .ifndef PROF
     75   1.5   deraadt LIBKERN=	${KERNLIB}
     76   1.5   deraadt .else
     77   1.5   deraadt LIBKERN=	${KERNLIB_PROF}
     78   1.5   deraadt .endif
     79   1.5   deraadt 
     80  1.21  christos ### find out what to use for libcompat
     81  1.21  christos .include "$S/compat/common/Makefile.inc"
     82  1.21  christos .ifndef PROF
     83  1.21  christos LIBCOMPAT=	${COMPATLIB}
     84  1.21  christos .else
     85  1.21  christos LIBCOMPAT=	${COMPATLIB_PROF}
     86  1.21  christos .endif
     87  1.21  christos 
     88  1.35   mycroft # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
     89  1.43  christos # HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
     90   1.1   deraadt 
     91  1.25   mycroft NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
     92  1.52   thorpej NOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
     93  1.27   mycroft NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
     94   1.1   deraadt 
     95   1.1   deraadt %OBJS
     96   1.1   deraadt 
     97   1.1   deraadt %CFILES
     98   1.1   deraadt 
     99  1.25   mycroft %SFILES
    100  1.25   mycroft 
    101   1.1   deraadt # load lines for config "xxx" will be emitted as:
    102   1.1   deraadt # xxx: ${SYSTEM_DEP} swapxxx.o
    103   1.1   deraadt #	${SYSTEM_LD_HEAD}
    104   1.1   deraadt #	${SYSTEM_LD} swapxxx.o
    105   1.1   deraadt #	${SYSTEM_LD_TAIL}
    106  1.25   mycroft SYSTEM_OBJ=	locore.o \
    107  1.54  drochner 		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
    108  1.25   mycroft SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
    109  1.25   mycroft SYSTEM_LD_HEAD=	@rm -f $@
    110  1.25   mycroft SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
    111  1.25   mycroft 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
    112  1.48     lukem SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
    113  1.25   mycroft 
    114   1.1   deraadt DEBUG?=
    115   1.1   deraadt .if ${DEBUG} == "-g"
    116  1.25   mycroft LINKFLAGS+=	-X
    117  1.25   mycroft SYSTEM_LD_TAIL+=; \
    118  1.63       cgd 		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
    119  1.67   tsutsui 		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
    120  1.67   tsutsui 		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
    121   1.1   deraadt .else
    122  1.57       mrg LINKFLAGS+=	-X
    123   1.1   deraadt .endif
    124   1.1   deraadt 
    125   1.1   deraadt %LOAD
    126   1.1   deraadt 
    127  1.44   mycroft assym.h: $S/kern/genassym.sh ${SPARC}/sparc/genassym.cf
    128  1.44   mycroft 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    129  1.44   mycroft 	    < ${SPARC}/sparc/genassym.cf > assym.h.tmp && \
    130  1.44   mycroft 	mv -f assym.h.tmp assym.h
    131  1.25   mycroft 
    132  1.25   mycroft param.c: $S/conf/param.c
    133  1.25   mycroft 	rm -f param.c
    134  1.25   mycroft 	cp $S/conf/param.c .
    135   1.1   deraadt 
    136  1.25   mycroft param.o: param.c Makefile
    137  1.35   mycroft 	${NORMAL_C}
    138   1.1   deraadt 
    139  1.25   mycroft ioconf.o: ioconf.c
    140  1.25   mycroft 	${NORMAL_C}
    141   1.1   deraadt 
    142  1.25   mycroft newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    143  1.25   mycroft 	sh $S/conf/newvers.sh
    144  1.25   mycroft 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    145   1.1   deraadt 
    146  1.47  christos __CLEANKERNEL: .USE
    147  1.47  christos 	@echo "${.TARGET}ing the kernel objects"
    148  1.29       cgd 	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
    149  1.44   mycroft 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    150  1.47  christos 
    151  1.47  christos __CLEANDEPEND: .USE
    152  1.47  christos 	rm -f .depend
    153  1.47  christos 
    154  1.47  christos clean: __CLEANKERNEL
    155  1.47  christos 
    156  1.53     lukem cleandir distclean: __CLEANKERNEL __CLEANDEPEND
    157   1.1   deraadt 
    158  1.25   mycroft lint:
    159  1.40     perry 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    160  1.41     perry 	    ${SPARC}/sparc/Locore.c ${CFILES} \
    161  1.25   mycroft 	    ioconf.c param.c | \
    162  1.25   mycroft 	    grep -v 'static function .* unused'
    163   1.1   deraadt 
    164  1.25   mycroft tags:
    165  1.25   mycroft 	@echo "see $S/kern/Makefile for tags"
    166   1.1   deraadt 
    167   1.1   deraadt links:
    168   1.1   deraadt 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    169   1.1   deraadt 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    170   1.1   deraadt 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    171   1.1   deraadt 	  sort -u | comm -23 - dontlink | \
    172  1.25   mycroft 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    173   1.1   deraadt 	sh makelinks && rm -f dontlink
    174   1.1   deraadt 
    175  1.25   mycroft SRCS=	${SPARC}/sparc/locore.s \
    176  1.29       cgd 	param.c ioconf.c ${CFILES} ${SFILES}
    177  1.39        pk depend: .depend
    178  1.29       cgd .depend: ${SRCS} assym.h param.c
    179  1.33   mycroft 	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC}/sparc/locore.s
    180  1.33   mycroft 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    181  1.60        pk .if !empty(SFILES)
    182  1.33   mycroft 	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
    183  1.60        pk .endif
    184  1.45       leo 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
    185  1.45       leo 	  ${CPPFLAGS} < ${SPARC}/sparc/genassym.cf
    186  1.45       leo 	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
    187  1.45       leo 	@rm -f assym.dep
    188  1.66      tron 
    189  1.66      tron dependall: depend all
    190  1.66      tron 
    191   1.1   deraadt 
    192  1.25   mycroft # depend on root or device configuration
    193  1.25   mycroft autoconf.o conf.o: Makefile
    194  1.25   mycroft  
    195  1.25   mycroft # depend on network or filesystem configuration 
    196  1.25   mycroft uipc_proto.o vfs_conf.o: Makefile 
    197   1.1   deraadt 
    198  1.25   mycroft # depend on maxusers
    199  1.43  christos machdep.o: Makefile
    200  1.11        pk 
    201  1.25   mycroft # depend on CPU configuration 
    202  1.25   mycroft bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
    203  1.25   mycroft ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
    204  1.25   mycroft machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
    205   1.1   deraadt 
    206   1.5   deraadt 
    207  1.25   mycroft locore.o: ${SPARC}/sparc/locore.s assym.h
    208  1.25   mycroft 	${NORMAL_S}
    209  1.69   hubertf 
    210  1.69   hubertf # The install target can be redefined by putting a
    211  1.69   hubertf # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
    212  1.69   hubertf MACHINE_NAME!=  uname -n
    213  1.69   hubertf install: install-kernel-${MACHINE_NAME}
    214  1.69   hubertf .if !target(install-kernel-${MACHINE_NAME}})
    215  1.69   hubertf install-kernel-${MACHINE_NAME}:
    216  1.69   hubertf 	rm -f /onetbsd
    217  1.69   hubertf 	ln /netbsd /onetbsd
    218  1.69   hubertf 	cp netbsd /nnetbsd
    219  1.69   hubertf 	mv /nnetbsd /netbsd
    220  1.69   hubertf .endif
    221   1.5   deraadt 
    222  1.25   mycroft %RULES
    223