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