Home | History | Annotate | Line # | Download | only in conf
Makefile.mips revision 1.1
      1  1.1  matt #	$NetBSD: Makefile.mips,v 1.1 2000/12/03 02:07:05 matt 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.1  matt #
     15  1.1  matt # N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
     16  1.1  matt #	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
     17  1.1  matt #
     18  1.1  matt # -DTRACE	compile in kernel tracing hooks
     19  1.1  matt # -DQUOTA	compile in file system quotas
     20  1.1  matt 
     21  1.1  matt # DEBUG is set to -g if debugging.
     22  1.1  matt # PROF is set to -pg if profiling.
     23  1.1  matt 
     24  1.1  matt AR?=		ar
     25  1.1  matt AS?=		as
     26  1.1  matt CC?=		cc
     27  1.1  matt CPP?=		cpp
     28  1.1  matt LD?=		ld
     29  1.1  matt LORDER?=	lorder
     30  1.1  matt MKDEP?=		mkdep
     31  1.1  matt NM?=		nm
     32  1.1  matt RANLIB?=	ranlib
     33  1.1  matt SIZE?=		size
     34  1.1  matt STRIP?=		strip
     35  1.1  matt TSORT?=		tsort -q
     36  1.1  matt 
     37  1.1  matt COPTS?=		-O2
     38  1.1  matt 
     39  1.1  matt TEXTADDR?=	${DEFTEXTADDR}
     40  1.1  matt 
     41  1.1  matt # source tree is located via $S relative to the compilation directory
     42  1.1  matt .ifndef S
     43  1.1  matt S=	../../../..
     44  1.1  matt .endif
     45  1.1  matt THISMIPS=	$S/arch/${MACHINE}
     46  1.1  matt MIPS=		$S/arch/mips
     47  1.1  matt 
     48  1.1  matt HAVE_EGCS!=	${CC} --version | egrep "^(2\.[89]|egcs)" ; echo
     49  1.1  matt INCLUDES=	-I. -I$S/arch -I$S -nostdinc
     50  1.1  matt CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D${MACHINE}
     51  1.1  matt CWARNFLAGS?=	-Wall -Werror -Wstrict-prototypes -Wmissing-prototypes \
     52  1.1  matt 		-Wpointer-arith
     53  1.1  matt # XXX Delete -Wuninitialized for now, since the compiler doesn't
     54  1.1  matt # XXX always get it right.  --thorpej
     55  1.1  matt CWARNFLAGS+=	-Wno-uninitialized
     56  1.1  matt .if (${HAVE_EGCS} != "")
     57  1.1  matt CWARNFLAGS+=	-Wno-main
     58  1.1  matt .endif
     59  1.1  matt GP?=		-G 0
     60  1.1  matt CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} ${GP} \
     61  1.1  matt 		-mno-abicalls -mno-half-pic ${ENDIAN}
     62  1.1  matt AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE ${ENDIAN}
     63  1.1  matt LINKFLAGS+=	-Ttext ${TEXTADDR} -e start ${GP}
     64  1.1  matt .if (${ENDIAN} == "-EB")
     65  1.1  matt LINKFLAGS+=	-T ${MIPS}/conf/kern.ldscript.be
     66  1.1  matt .else
     67  1.1  matt LINKFLAGS+=	-T ${MIPS}/conf/kern.ldscript.le
     68  1.1  matt .endif
     69  1.1  matt LD+=		${ENDIAN}
     70  1.1  matt STRIPFLAGS=	-g -X -x
     71  1.1  matt 
     72  1.1  matt .if exists(${THISMIPS}/conf/Makefile.${MACHINE}.inc)
     73  1.1  matt .include "${THISMIPS}/conf/Makefile.${MACHINE}.inc"
     74  1.1  matt .endif
     75  1.1  matt 
     76  1.1  matt %INCLUDES
     77  1.1  matt 
     78  1.1  matt ### find out what to use for libkern
     79  1.1  matt .include "$S/lib/libkern/Makefile.inc"
     80  1.1  matt .ifndef PROF
     81  1.1  matt LIBKERN=	${KERNLIB}
     82  1.1  matt .else
     83  1.1  matt LIBKERN=	${KERNLIB_PROF}
     84  1.1  matt .endif
     85  1.1  matt 
     86  1.1  matt ### find out what to use for libcompat
     87  1.1  matt .include "$S/compat/common/Makefile.inc"
     88  1.1  matt .ifndef PROF
     89  1.1  matt LIBCOMPAT=	${COMPATLIB}
     90  1.1  matt .else
     91  1.1  matt LIBCOMPAT=	${COMPATLIB_PROF}
     92  1.1  matt .endif
     93  1.1  matt 
     94  1.1  matt # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
     95  1.1  matt # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
     96  1.1  matt 
     97  1.1  matt NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
     98  1.1  matt NOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
     99  1.1  matt NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
    100  1.1  matt 
    101  1.1  matt %OBJS
    102  1.1  matt 
    103  1.1  matt %CFILES
    104  1.1  matt 
    105  1.1  matt %SFILES
    106  1.1  matt 
    107  1.1  matt # load lines for config "xxx" will be emitted as:
    108  1.1  matt # xxx: ${SYSTEM_DEP} swapxxx.o
    109  1.1  matt #	${SYSTEM_LD_HEAD}
    110  1.1  matt #	${SYSTEM_LD} swapxxx.o
    111  1.1  matt #	${SYSTEM_LD_TAIL}
    112  1.1  matt SYSTEM_OBJ=	locore.o locore_machdep.o
    113  1.1  matt .if !empty(IDENT:M-DMIPS1)
    114  1.1  matt SYSTEM_OBJ+=	locore_mips1.o
    115  1.1  matt .endif
    116  1.1  matt .if !empty(IDENT:M-DMIPS3)
    117  1.1  matt SYSTEM_OBJ+=	locore_mips3.o
    118  1.1  matt .endif
    119  1.1  matt SYSTEM_OBJ+=	fp.o param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
    120  1.1  matt SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
    121  1.1  matt SYSTEM_LD_HEAD?=@rm -f $@
    122  1.1  matt SYSTEM_LD?=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o ; \
    123  1.1  matt 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
    124  1.1  matt SYSTEM_LD_TAIL?= \
    125  1.1  matt 		@${SIZE} $@; chmod 755 $@
    126  1.1  matt 
    127  1.1  matt DEBUG?=
    128  1.1  matt .if ${DEBUG} == "-g"
    129  1.1  matt LINKFLAGS+=	-X
    130  1.1  matt .ifdef DEBUG_SYSTEM_LD_TAIL
    131  1.1  matt SYSTEM_LD_TAIL+=${DEBUG_SYSTEM_LD_TAIL}
    132  1.1  matt .else
    133  1.1  matt SYSTEM_LD_TAIL+=; \
    134  1.1  matt 		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
    135  1.1  matt 		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
    136  1.1  matt 		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
    137  1.1  matt .endif
    138  1.1  matt .else
    139  1.1  matt LINKFLAGS+=	-x
    140  1.1  matt .endif
    141  1.1  matt 
    142  1.1  matt %LOAD
    143  1.1  matt 
    144  1.1  matt assym.h: $S/kern/genassym.sh ${MIPS}/mips/genassym.cf
    145  1.1  matt 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    146  1.1  matt 	  < ${MIPS}/mips/genassym.cf > assym.h.tmp && \
    147  1.1  matt 	mv -f assym.h.tmp assym.h
    148  1.1  matt 
    149  1.1  matt 
    150  1.1  matt param.c: $S/conf/param.c
    151  1.1  matt 	rm -f param.c
    152  1.1  matt 	cp $S/conf/param.c .
    153  1.1  matt 
    154  1.1  matt param.o: param.c Makefile
    155  1.1  matt 	${NORMAL_C}
    156  1.1  matt 
    157  1.1  matt ioconf.o: ioconf.c
    158  1.1  matt 	${NORMAL_C}
    159  1.1  matt 
    160  1.1  matt newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    161  1.1  matt 	sh $S/conf/newvers.sh
    162  1.1  matt 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    163  1.1  matt 
    164  1.1  matt __CLEANKERNEL: .USE
    165  1.1  matt 	@echo "${.TARGET}ing the kernel objects"
    166  1.1  matt 	rm -f eddep *netbsd netbsd.ecoff netbsd.gdb tags *.[io] \
    167  1.1  matt 	  [a-z]*.s [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    168  1.1  matt 
    169  1.1  matt __CLEANDEPEND: .USE
    170  1.1  matt 	rm -f .depend
    171  1.1  matt 
    172  1.1  matt clean: __CLEANKERNEL
    173  1.1  matt 
    174  1.1  matt cleandir distclean: __CLEANKERNEL __CLEANDEPEND
    175  1.1  matt 
    176  1.1  matt lint:
    177  1.1  matt 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    178  1.1  matt 	  ${MIPS}/mips/Locore.c ${CFILES} \
    179  1.1  matt 	  ioconf.c param.c | \
    180  1.1  matt 	  grep -v 'static function .* unused'
    181  1.1  matt 
    182  1.1  matt tags:
    183  1.1  matt 	@echo "see $S/kern/Makefile for tags"
    184  1.1  matt 
    185  1.1  matt links:
    186  1.1  matt 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    187  1.1  matt 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    188  1.1  matt 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    189  1.1  matt 	  sort -u | comm -23 - dontlink | \
    190  1.1  matt 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    191  1.1  matt 	sh makelinks && rm -f dontlink
    192  1.1  matt 
    193  1.1  matt SRCS=	${MIPS}/mips/locore.S ${MIPS}/mips/fp.S \
    194  1.1  matt 	${THISMIPS}/${MACHINE}/locore_machdep.S \
    195  1.1  matt 	param.c ioconf.c ${CFILES} ${SFILES}
    196  1.1  matt depend: .depend
    197  1.1  matt .depend: ${SRCS} assym.h param.c
    198  1.1  matt 	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MIPS}/mips/locore.S ${MIPS}/mips/fp.S
    199  1.1  matt 	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${THISMIPS}/${MACHINE}/locore_machdep.S
    200  1.1  matt 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    201  1.1  matt .if (${SFILES} != "")
    202  1.1  matt 	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
    203  1.1  matt .endif
    204  1.1  matt 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
    205  1.1  matt 	  ${CPPFLAGS} < ${MIPS}/mips/genassym.cf
    206  1.1  matt 	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
    207  1.1  matt 	@rm -f assym.dep
    208  1.1  matt 
    209  1.1  matt dependall: depend all
    210  1.1  matt 
    211  1.1  matt 
    212  1.1  matt # depend on root or device configuration
    213  1.1  matt autoconf.o conf.o: Makefile
    214  1.1  matt 
    215  1.1  matt # depend on network or filesystem configuration
    216  1.1  matt uipc_proto.o vfs_conf.o: Makefile
    217  1.1  matt 
    218  1.1  matt # depend on maxusers
    219  1.1  matt machdep.o: Makefile
    220  1.1  matt 
    221  1.1  matt # depend on CPU configuration
    222  1.1  matt machdep.o mainbus.o trap.o: Makefile
    223  1.1  matt 
    224  1.1  matt # depend on System V IPC/shmem options
    225  1.1  matt mips_machdep.o pmap.o: Makefile
    226  1.1  matt 
    227  1.1  matt locore.o: ${MIPS}/mips/locore.S assym.h
    228  1.1  matt 	${NORMAL_S}
    229  1.1  matt 
    230  1.1  matt locore_mips1.o: ${MIPS}/mips/locore_mips1.S assym.h
    231  1.1  matt 	${NORMAL_S}
    232  1.1  matt 
    233  1.1  matt locore_mips3.o: ${MIPS}/mips/locore_mips3.S assym.h
    234  1.1  matt 	${NORMAL_S}
    235  1.1  matt 
    236  1.1  matt fp.o: ${MIPS}/mips/fp.S assym.h
    237  1.1  matt 	${NORMAL_S}
    238  1.1  matt 
    239  1.1  matt locore_machdep.o: ${THISMIPS}/${MACHINE}/locore_machdep.S assym.h
    240  1.1  matt 	${NORMAL_S}
    241  1.1  matt 
    242  1.1  matt # The install target can be redefined by putting a
    243  1.1  matt # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
    244  1.1  matt MACHINE_NAME!=  uname -n
    245  1.1  matt install: install-kernel-${MACHINE_NAME}
    246  1.1  matt .if !target(install-kernel-${MACHINE_NAME}})
    247  1.1  matt install-kernel-${MACHINE_NAME}:
    248  1.1  matt 	rm -f /onetbsd
    249  1.1  matt 	ln /netbsd /onetbsd
    250  1.1  matt 	cp netbsd /nnetbsd
    251  1.1  matt 	mv /nnetbsd /netbsd
    252  1.1  matt .endif
    253  1.1  matt 
    254  1.1  matt %RULES
    255