Home | History | Annotate | Line # | Download | only in conf
Makefile.mips revision 1.22
      1  1.22   thorpej #	$NetBSD: Makefile.mips,v 1.22 2001/10/23 20:40:02 thorpej Exp $
      2   1.1      matt 
      3   1.1      matt # Makefile for NetBSD
      4   1.1      matt #
      5   1.1      matt # This makefile is constructed from a machine description:
      6   1.1      matt #	config machineid
      7   1.1      matt # Most changes should be made in the machine description
      8   1.1      matt #	/sys/arch/<machine>/conf/``machineid''
      9   1.1      matt # after which you should do
     10   1.1      matt #	config machineid
     11   1.1      matt # Machine generic makefile changes should be made in
     12   1.1      matt #	/sys/arch/mips/conf/Makefile.mips
     13   1.1      matt # after which config should be rerun for all machines of that type.
     14  1.13   hubertf 
     15  1.13   hubertf .include <bsd.own.mk>
     16  1.22   thorpej 
     17  1.22   thorpej .if ${MACHINE_ARCH} == "mipsel"
     18  1.22   thorpej ENDIAN="-EL"
     19  1.22   thorpej .elif ${MACHINE_ARCH} == "mipseb"
     20  1.22   thorpej ENDIAN="-EB"
     21  1.22   thorpej .else
     22  1.22   thorpej .BEGIN:
     23  1.22   thorpej 	@echo "MACHINE_ARCH ${MACHINE_ARCH} is invalid"
     24  1.22   thorpej 	@false
     25  1.22   thorpej .endif
     26   1.1      matt 
     27   1.1      matt # DEBUG is set to -g if debugging.
     28   1.1      matt # PROF is set to -pg if profiling.
     29   1.1      matt 
     30   1.8      matt AR?=		${CROSSDIR}ar
     31   1.8      matt AS?=		${CROSSDIR}as
     32   1.8      matt CC?=		${CROSSDIR}cc
     33   1.9      matt CPP?=		cpp
     34   1.8      matt LD?=		${CROSSDIR}ld
     35   1.9      matt LORDER?=	lorder
     36   1.9      matt MKDEP?=		mkdep
     37   1.8      matt NM?=		${CROSSDIR}nm
     38   1.8      matt RANLIB?=	${CROSSDIR}ranlib
     39   1.8      matt SIZE?=		${CROSSDIR}size
     40   1.8      matt STRIP?=		${CROSSDIR}strip
     41   1.8      matt TSORT?=		${CROSSDIR}tsort -q
     42  1.12   tsutsui OBJCOPY?=	${CROSSDIR}objcopy
     43   1.1      matt 
     44  1.11      shin DEFCOPTS?=	-O2
     45  1.11      shin COPTS?=		${DEFCOPTS}
     46   1.1      matt 
     47   1.8      matt DEFGP?=		-G 0
     48   1.1      matt TEXTADDR?=	${DEFTEXTADDR}
     49   1.1      matt 
     50   1.1      matt # source tree is located via $S relative to the compilation directory
     51   1.1      matt .ifndef S
     52   1.1      matt S=	../../../..
     53   1.1      matt .endif
     54  1.21   thorpej THISMIPS=	$S/arch/${MACHINE}
     55   1.1      matt MIPS=		$S/arch/mips
     56   1.1      matt 
     57   1.1      matt HAVE_EGCS!=	${CC} --version | egrep "^(2\.[89]|egcs)" ; echo
     58   1.1      matt INCLUDES=	-I. -I$S/arch -I$S -nostdinc
     59  1.17    simonb CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT \
     60  1.21   thorpej 		-D${MACHINE}
     61   1.1      matt CWARNFLAGS?=	-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes \
     62   1.1      matt 		-Wpointer-arith
     63   1.1      matt # XXX Delete -Wuninitialized for now, since the compiler doesn't
     64   1.1      matt # XXX always get it right.  --thorpej
     65   1.1      matt CWARNFLAGS+=	-Wno-uninitialized
     66   1.1      matt .if (${HAVE_EGCS} != "")
     67   1.1      matt CWARNFLAGS+=	-Wno-main
     68   1.1      matt .endif
     69   1.8      matt GP?=		${DEFGP}
     70  1.17    simonb CFLAGS=		${ENDIAN} ${DEBUG} ${COPTS} ${CWARNFLAGS} ${GP} \
     71   1.3      matt 		-mno-abicalls -mno-half-pic
     72  1.17    simonb AFLAGS=		${ENDIAN} -x assembler-with-cpp -traditional-cpp -D_LOCORE
     73  1.17    simonb LD+=		${ENDIAN}
     74  1.19    simonb KERNLDSCRIPT?=	${MIPS}/conf/kern.ldscript
     75  1.19    simonb LINKFLAGS+=	-Ttext ${TEXTADDR} -e start ${GP} -T ${KERNLDSCRIPT}
     76   1.5      matt .if (${ENDIAN} == "-EB")
     77  1.17    simonb LINKFLAGS+=	--oformat elf32-bigmips
     78   1.1      matt .else
     79  1.17    simonb LINKFLAGS+=	--oformat elf32-littlemips
     80   1.1      matt .endif
     81   1.1      matt STRIPFLAGS=	-g -X -x
     82   1.1      matt 
     83  1.21   thorpej .-include "${THISMIPS}/conf/Makefile.${MACHINE}.inc"
     84   1.1      matt 
     85   1.1      matt %INCLUDES
     86   1.1      matt 
     87   1.1      matt ### find out what to use for libkern
     88   1.1      matt .include "$S/lib/libkern/Makefile.inc"
     89   1.1      matt .ifndef PROF
     90   1.1      matt LIBKERN=	${KERNLIB}
     91   1.1      matt .else
     92   1.1      matt LIBKERN=	${KERNLIB_PROF}
     93   1.1      matt .endif
     94   1.1      matt 
     95   1.1      matt ### find out what to use for libcompat
     96   1.1      matt .include "$S/compat/common/Makefile.inc"
     97   1.1      matt .ifndef PROF
     98   1.1      matt LIBCOMPAT=	${COMPATLIB}
     99   1.1      matt .else
    100   1.1      matt LIBCOMPAT=	${COMPATLIB_PROF}
    101   1.1      matt .endif
    102   1.1      matt 
    103   1.1      matt # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
    104   1.1      matt # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
    105   1.1      matt 
    106   1.1      matt NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
    107   1.1      matt NOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
    108   1.1      matt NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
    109   1.1      matt 
    110   1.1      matt %OBJS
    111   1.1      matt 
    112   1.1      matt %CFILES
    113   1.1      matt 
    114   1.1      matt %SFILES
    115   1.1      matt 
    116   1.1      matt # load lines for config "xxx" will be emitted as:
    117   1.1      matt # xxx: ${SYSTEM_DEP} swapxxx.o
    118   1.1      matt #	${SYSTEM_LD_HEAD}
    119   1.1      matt #	${SYSTEM_LD} swapxxx.o
    120   1.1      matt #	${SYSTEM_LD_TAIL}
    121   1.1      matt SYSTEM_OBJ=	locore.o locore_machdep.o
    122   1.1      matt .if !empty(IDENT:M-DMIPS1)
    123   1.1      matt SYSTEM_OBJ+=	locore_mips1.o
    124   1.1      matt .endif
    125   1.1      matt .if !empty(IDENT:M-DMIPS3)
    126   1.1      matt SYSTEM_OBJ+=	locore_mips3.o
    127   1.1      matt .endif
    128  1.20       uch .if !empty(IDENT:M-DMIPS3_5900)
    129  1.20       uch SYSTEM_OBJ+=	locore_r5900.o r5900_machdep.o
    130  1.20       uch .endif
    131   1.6      matt .if empty(IDENT:M-DNOFPU)
    132   1.4      matt SYSTEM_OBJ+=	fp.o
    133   1.4      matt .endif
    134   1.4      matt SYSTEM_OBJ+=	param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
    135   1.1      matt SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
    136   1.1      matt SYSTEM_LD_HEAD?=@rm -f $@
    137   1.1      matt SYSTEM_LD?=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o ; \
    138   1.1      matt 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
    139   1.1      matt SYSTEM_LD_TAIL?= \
    140   1.1      matt 		@${SIZE} $@; chmod 755 $@
    141   1.1      matt 
    142   1.1      matt DEBUG?=
    143   1.1      matt .if ${DEBUG} == "-g"
    144   1.1      matt LINKFLAGS+=	-X
    145   1.1      matt .ifdef DEBUG_SYSTEM_LD_TAIL
    146   1.1      matt SYSTEM_LD_TAIL+=${DEBUG_SYSTEM_LD_TAIL}
    147   1.1      matt .else
    148   1.1      matt SYSTEM_LD_TAIL+=; \
    149   1.1      matt 		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
    150   1.1      matt 		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
    151   1.1      matt 		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
    152   1.1      matt .endif
    153   1.1      matt .else
    154   1.1      matt LINKFLAGS+=	-x
    155   1.2      matt .endif
    156   1.2      matt 
    157   1.2      matt .ifdef POST_STRIP_SYSTEM_LD_TAIL
    158   1.2      matt SYSTEM_LD_TAIL+=${POST_STRIP_SYSTEM_LD_TAIL}
    159   1.1      matt .endif
    160   1.1      matt 
    161   1.1      matt %LOAD
    162   1.1      matt 
    163   1.1      matt assym.h: $S/kern/genassym.sh ${MIPS}/mips/genassym.cf
    164   1.1      matt 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    165   1.1      matt 	  < ${MIPS}/mips/genassym.cf > assym.h.tmp && \
    166   1.1      matt 	mv -f assym.h.tmp assym.h
    167   1.1      matt 
    168   1.1      matt 
    169   1.1      matt param.c: $S/conf/param.c
    170   1.1      matt 	rm -f param.c
    171   1.1      matt 	cp $S/conf/param.c .
    172   1.1      matt 
    173   1.1      matt param.o: param.c Makefile
    174   1.1      matt 	${NORMAL_C}
    175   1.1      matt 
    176   1.1      matt ioconf.o: ioconf.c
    177   1.1      matt 	${NORMAL_C}
    178   1.1      matt 
    179   1.1      matt newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    180   1.1      matt 	sh $S/conf/newvers.sh
    181   1.1      matt 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    182   1.1      matt 
    183   1.1      matt __CLEANKERNEL: .USE
    184   1.1      matt 	@echo "${.TARGET}ing the kernel objects"
    185   1.1      matt 	rm -f eddep *netbsd netbsd.ecoff netbsd.gdb tags *.[io] \
    186   1.1      matt 	  [a-z]*.s [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    187   1.1      matt 
    188   1.1      matt __CLEANDEPEND: .USE
    189   1.1      matt 	rm -f .depend
    190   1.1      matt 
    191   1.1      matt clean: __CLEANKERNEL
    192   1.1      matt 
    193   1.1      matt cleandir distclean: __CLEANKERNEL __CLEANDEPEND
    194   1.1      matt 
    195   1.1      matt lint:
    196   1.1      matt 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    197   1.1      matt 	  ${MIPS}/mips/Locore.c ${CFILES} \
    198   1.1      matt 	  ioconf.c param.c | \
    199   1.1      matt 	  grep -v 'static function .* unused'
    200   1.1      matt 
    201   1.1      matt tags:
    202   1.1      matt 	@echo "see $S/kern/Makefile for tags"
    203   1.1      matt 
    204   1.1      matt links:
    205   1.1      matt 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    206   1.1      matt 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    207   1.1      matt 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    208   1.1      matt 	  sort -u | comm -23 - dontlink | \
    209   1.1      matt 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    210   1.1      matt 	sh makelinks && rm -f dontlink
    211   1.1      matt 
    212   1.4      matt .if !empty(IDENT:M-DMIPS1)
    213  1.15  takemura SFILES+=${MIPS}/mips/locore_mips1.S
    214   1.4      matt .endif
    215   1.4      matt .if !empty(IDENT:M-DMIPS3)
    216  1.15  takemura SFILES+=${MIPS}/mips/locore_mips3.S
    217   1.4      matt .endif
    218  1.20       uch .if !empty(IDENT:M-DMIPS3_5900)
    219  1.20       uch SRCS+=	${MIPS}/mips/r5900/locore_r5900.S ${MIPS}/mips/r5900/r5900_machdep.c
    220  1.20       uch .endif
    221   1.6      matt .if empty(IDENT:M-DNOFPU)
    222  1.15  takemura SFILES+=${MIPS}/mips/fp.S
    223   1.4      matt .endif
    224  1.15  takemura SFILES+=${MIPS}/mips/locore.S \
    225  1.21   thorpej 	${THISMIPS}/${MACHINE}/locore_machdep.S
    226  1.15  takemura SRCS=	param.c ioconf.c ${CFILES} ${SFILES}
    227   1.4      matt 
    228   1.1      matt depend: .depend
    229   1.1      matt .depend: ${SRCS} assym.h param.c
    230   1.1      matt 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    231   1.1      matt 	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
    232   1.1      matt 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
    233   1.1      matt 	  ${CPPFLAGS} < ${MIPS}/mips/genassym.cf
    234  1.16     oster 	@sed -e 's/.*\.o:.*\.c /assym.h: /' < assym.dep >> .depend
    235   1.1      matt 	@rm -f assym.dep
    236   1.1      matt 
    237   1.1      matt dependall: depend all
    238   1.1      matt 
    239   1.1      matt 
    240   1.1      matt # depend on root or device configuration
    241   1.1      matt autoconf.o conf.o: Makefile
    242   1.1      matt 
    243   1.1      matt # depend on network or filesystem configuration
    244   1.1      matt uipc_proto.o vfs_conf.o: Makefile
    245   1.1      matt 
    246   1.1      matt # depend on maxusers
    247   1.1      matt machdep.o: Makefile
    248   1.1      matt 
    249   1.1      matt # depend on CPU configuration
    250   1.1      matt machdep.o mainbus.o trap.o: Makefile
    251   1.1      matt 
    252   1.1      matt # depend on System V IPC/shmem options
    253   1.1      matt mips_machdep.o pmap.o: Makefile
    254   1.1      matt 
    255   1.1      matt locore.o: ${MIPS}/mips/locore.S assym.h
    256   1.1      matt 	${NORMAL_S}
    257   1.1      matt 
    258   1.1      matt locore_mips1.o: ${MIPS}/mips/locore_mips1.S assym.h
    259   1.1      matt 	${NORMAL_S}
    260   1.1      matt 
    261   1.1      matt locore_mips3.o: ${MIPS}/mips/locore_mips3.S assym.h
    262   1.1      matt 	${NORMAL_S}
    263  1.20       uch 
    264  1.20       uch locore_r5900.o: ${MIPS}/mips/r5900/locore_r5900.S assym.h
    265  1.20       uch 	${NORMAL_S}
    266  1.20       uch 
    267  1.20       uch r5900_machdep.o: ${MIPS}/mips/r5900/r5900_machdep.c
    268  1.20       uch 	${NORMAL_C}
    269   1.1      matt 
    270  1.15  takemura .if empty(IDENT:M-DNOFPU)
    271   1.1      matt fp.o: ${MIPS}/mips/fp.S assym.h
    272   1.1      matt 	${NORMAL_S}
    273  1.15  takemura .endif
    274   1.1      matt 
    275  1.21   thorpej locore_machdep.o: ${THISMIPS}/${MACHINE}/locore_machdep.S assym.h
    276   1.1      matt 	${NORMAL_S}
    277   1.1      matt 
    278   1.1      matt # The install target can be redefined by putting a
    279   1.1      matt # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
    280   1.1      matt MACHINE_NAME!=  uname -n
    281   1.1      matt install: install-kernel-${MACHINE_NAME}
    282   1.1      matt .if !target(install-kernel-${MACHINE_NAME}})
    283   1.1      matt install-kernel-${MACHINE_NAME}:
    284   1.1      matt 	rm -f /onetbsd
    285   1.1      matt 	ln /netbsd /onetbsd
    286   1.1      matt 	cp netbsd /nnetbsd
    287   1.1      matt 	mv /nnetbsd /netbsd
    288   1.1      matt .endif
    289   1.1      matt 
    290   1.1      matt %RULES
    291