Home | History | Annotate | Line # | Download | only in conf
Makefile.sh3 revision 1.4
      1  1.4  tsutsui #	$NetBSD: Makefile.sh3,v 1.4 2000/02/01 05:25:46 tsutsui Exp $
      2  1.1   itojun 
      3  1.1   itojun # Makefile for NetBSD
      4  1.1   itojun #
      5  1.1   itojun # This makefile is constructed from a machine description:
      6  1.1   itojun #	config machineid
      7  1.1   itojun # Most changes should be made in the machine description
      8  1.1   itojun #	/sys/arch/sh3/conf/``machineid''
      9  1.1   itojun # after which you should do
     10  1.1   itojun #	config machineid
     11  1.1   itojun # Machine generic makefile changes should be made in
     12  1.1   itojun #	/sys/arch/sh3/conf/Makefile.sh3
     13  1.1   itojun # after which config should be rerun for all machines of that type.
     14  1.1   itojun #
     15  1.1   itojun # N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
     16  1.1   itojun #	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
     17  1.1   itojun #
     18  1.1   itojun # -DTRACE	compile in kernel tracing hooks
     19  1.1   itojun # -DQUOTA	compile in file system quotas
     20  1.1   itojun 
     21  1.1   itojun .include <bsd.own.mk>
     22  1.1   itojun 
     23  1.1   itojun # DEBUG is set to -g if debugging.
     24  1.1   itojun # PROF is set to -pg if profiling.
     25  1.1   itojun 
     26  1.1   itojun AR?=	ar
     27  1.1   itojun AS?=	as
     28  1.1   itojun CC?=	cc
     29  1.1   itojun CPP?=	cpp
     30  1.1   itojun LD?=	ld
     31  1.1   itojun LORDER?=lorder
     32  1.1   itojun MKDEP?=	mkdep
     33  1.1   itojun NM?=	nm
     34  1.1   itojun RANLIB?=ranlib
     35  1.1   itojun SIZE?=	size
     36  1.4  tsutsui STRIP?=	strip
     37  1.1   itojun TSORT?=	tsort -q
     38  1.1   itojun 
     39  1.1   itojun COPTS?=	-O2
     40  1.1   itojun 
     41  1.1   itojun # source tree is located via $S relative to the compilation directory
     42  1.1   itojun .ifndef S
     43  1.1   itojun S!=	cd ../../../..; pwd
     44  1.1   itojun .endif
     45  1.1   itojun SH3=	$S/arch/sh3
     46  1.1   itojun 
     47  1.1   itojun HAVE_GCC28!=	${CC} --version | egrep "^(2\.8|egcs)" ; echo
     48  1.1   itojun INCLUDES=	-I. -I$S/arch -I$S -nostdinc
     49  1.1   itojun CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -Dsh3
     50  1.1   itojun CWARNFLAGS=	-Werror -Wall -Wmissing-prototypes -Wstrict-prototypes
     51  1.1   itojun CWARNFLAGS+=	-Wpointer-arith -Wno-parentheses
     52  1.1   itojun .if (${HAVE_GCC28} != "")
     53  1.1   itojun CWARNFLAGS+=	-Wno-main
     54  1.1   itojun .endif
     55  1.1   itojun CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS}
     56  1.1   itojun AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
     57  1.1   itojun LINKFLAGS=	-e start -T ../../conf/sh.x
     58  1.1   itojun STRIPFLAGS=	--strip-debug
     59  1.1   itojun MACHINE=sh3
     60  1.1   itojun MACHINE_ARCH=sh3
     61  1.1   itojun 
     62  1.1   itojun ### find out what to use for libkern
     63  1.1   itojun .include "$S/lib/libkern/Makefile.inc"
     64  1.1   itojun .ifndef PROF
     65  1.1   itojun LIBKERN=	${KERNLIB}
     66  1.1   itojun .else
     67  1.1   itojun LIBKERN=	${KERNLIB_PROF}
     68  1.1   itojun .endif
     69  1.1   itojun 
     70  1.1   itojun ### find out what to use for libcompat
     71  1.1   itojun .include "$S/compat/common/Makefile.inc"
     72  1.1   itojun .ifndef PROF
     73  1.1   itojun LIBCOMPAT=	${COMPATLIB}
     74  1.1   itojun .else
     75  1.1   itojun LIBCOMPAT=	${COMPATLIB_PROF}
     76  1.1   itojun .endif
     77  1.1   itojun 
     78  1.1   itojun # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
     79  1.1   itojun # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
     80  1.1   itojun 
     81  1.1   itojun NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
     82  1.1   itojun NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
     83  1.1   itojun 
     84  1.1   itojun %OBJS
     85  1.1   itojun 
     86  1.1   itojun %CFILES
     87  1.1   itojun 
     88  1.1   itojun %SFILES
     89  1.1   itojun 
     90  1.1   itojun # load lines for config "xxx" will be emitted as:
     91  1.1   itojun # xxx: ${SYSTEM_DEP} swapxxx.o
     92  1.1   itojun #	${SYSTEM_LD_HEAD}
     93  1.1   itojun #	${SYSTEM_LD} swapxxx.o
     94  1.1   itojun #	${SYSTEM_LD_TAIL}
     95  1.1   itojun SYSTEM_OBJ=	locore.o \
     96  1.1   itojun 		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
     97  1.1   itojun SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
     98  1.1   itojun SYSTEM_LD_HEAD=	rm -f $@
     99  1.1   itojun SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
    100  1.1   itojun 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
    101  1.1   itojun SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
    102  1.1   itojun 
    103  1.1   itojun DEBUG?=
    104  1.1   itojun .if ${DEBUG} == "-g"
    105  1.1   itojun LINKFLAGS+=	-X
    106  1.1   itojun SYSTEM_LD_TAIL+=; \
    107  1.2  tsutsui 		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
    108  1.4  tsutsui 		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
    109  1.4  tsutsui 		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
    110  1.1   itojun .else
    111  1.1   itojun LINKFLAGS+=
    112  1.1   itojun .endif
    113  1.1   itojun 
    114  1.1   itojun %LOAD
    115  1.1   itojun 
    116  1.1   itojun assym.h: $S/kern/genassym.sh ${SH3}/sh3/genassym.cf
    117  1.1   itojun 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    118  1.1   itojun 	    < ${SH3}/sh3/genassym.cf > assym.h.tmp && \
    119  1.1   itojun 	mv -f assym.h.tmp assym.h
    120  1.1   itojun 
    121  1.1   itojun param.c: $S/conf/param.c
    122  1.1   itojun 	rm -f param.c
    123  1.1   itojun 	cp $S/conf/param.c .
    124  1.1   itojun 
    125  1.1   itojun param.o: param.c Makefile
    126  1.1   itojun 	${NORMAL_C}
    127  1.1   itojun 
    128  1.1   itojun ioconf.o: ioconf.c
    129  1.1   itojun 	${NORMAL_C}
    130  1.1   itojun 
    131  1.1   itojun newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    132  1.1   itojun 	sh $S/conf/newvers.sh
    133  1.1   itojun 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    134  1.1   itojun 
    135  1.1   itojun 
    136  1.1   itojun __CLEANKERNEL: .USE
    137  1.1   itojun 	@echo "${.TARGET}ing the kernel objects"
    138  1.1   itojun 	rm -f eddep *netbsd netbsd netbsd.gdb tags *.[io] [a-z]*.s \
    139  1.1   itojun 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    140  1.1   itojun 
    141  1.1   itojun __CLEANDEPEND: .USE
    142  1.1   itojun 	rm -f .depend
    143  1.1   itojun 
    144  1.1   itojun clean: __CLEANKERNEL
    145  1.1   itojun 
    146  1.1   itojun cleandir: __CLEANKERNEL __CLEANDEPEND
    147  1.1   itojun 
    148  1.1   itojun lint:
    149  1.1   itojun 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    150  1.1   itojun 	    ${SH3}/sh3/Locore.c ${CFILES} \
    151  1.1   itojun 	    ioconf.c param.c | \
    152  1.1   itojun 	    grep -v 'static function .* unused'
    153  1.1   itojun 
    154  1.1   itojun tags:
    155  1.1   itojun 	@echo "see $S/kern/Makefile for tags"
    156  1.1   itojun 
    157  1.1   itojun links:
    158  1.1   itojun 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    159  1.1   itojun 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    160  1.1   itojun 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    161  1.1   itojun 	  sort -u | comm -23 - dontlink | \
    162  1.1   itojun 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    163  1.1   itojun 	sh makelinks && rm -f dontlink
    164  1.1   itojun 
    165  1.1   itojun SRCS=	${SH3}/sh3/locore.s \
    166  1.1   itojun 	param.c ioconf.c ${CFILES} ${SFILES}
    167  1.1   itojun depend: .depend
    168  1.1   itojun .depend: ${SRCS} assym.h param.c
    169  1.1   itojun 	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SH3}/sh3/locore.s
    170  1.1   itojun 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    171  1.1   itojun .if ${SFILES} != ""
    172  1.1   itojun 	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
    173  1.1   itojun .endif
    174  1.1   itojun 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
    175  1.1   itojun 	  ${CPPFLAGS} < ${SH3}/sh3/genassym.cf
    176  1.1   itojun 	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
    177  1.1   itojun 	@rm -f assym.dep
    178  1.3     tron 
    179  1.3     tron dependall: depend all
    180  1.1   itojun 
    181  1.1   itojun 
    182  1.1   itojun # depend on root or device configuration
    183  1.1   itojun autoconf.o conf.o: Makefile
    184  1.1   itojun 
    185  1.1   itojun # depend on network or filesystem configuration
    186  1.1   itojun uipc_proto.o vfs_conf.o: Makefile
    187  1.1   itojun 
    188  1.1   itojun # depend on maxusers
    189  1.1   itojun machdep.o: Makefile
    190  1.1   itojun 
    191  1.1   itojun # depend on CPU configuration
    192  1.1   itojun locore.o machdep.o: Makefile
    193  1.1   itojun 
    194  1.1   itojun locore.o: ${SH3}/sh3/locore.s assym.h
    195  1.1   itojun 	${NORMAL_S}
    196  1.1   itojun 
    197  1.1   itojun # XXX compile ffs_inode.c always with -O0 to avoid egcs-1.1.2 bug.
    198  1.1   itojun #ffs_inode.o: $S/ufs/ffs/ffs_inode.c
    199  1.1   itojun #	${CC} ${CFLAGS} -O0 ${CPPFLAGS} ${PROF} -c $<
    200  1.1   itojun 
    201  1.1   itojun %RULES
    202