Home | History | Annotate | Line # | Download | only in conf
Makefile.mvme68k revision 1.53
      1 #	$NetBSD: Makefile.mvme68k,v 1.53 2001/10/26 06:45:38 jmc 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/mvme68k/conf/``machineid''
      9 # after which you should do
     10 #	config machineid
     11 # Machine generic makefile changes should be made in
     12 #	/sys/arch/mvme68k/conf/Makefile.mvme68k
     13 # after which config should be rerun for all machines of that type.
     14 
     15 MACHINE_ARCH=m68k
     16 USETOOLS?=	no
     17 
     18 .include <bsd.own.mk>
     19 
     20 # DEBUG is set to -g if debugging.
     21 # PROF is set to -pg if profiling.
     22 
     23 AR?=	ar
     24 AS?=	as
     25 CC?=	cc
     26 CPP?=	cpp
     27 LD?=	ld
     28 LORDER?=lorder
     29 MKDEP?=	mkdep
     30 NM?=	nm
     31 RANLIB?=ranlib
     32 SIZE?=	size
     33 STRIP?=	strip
     34 TSORT?=	tsort -q
     35 
     36 COPTS?=	-O2
     37 
     38 # source tree is located via $S relative to the compilation directory
     39 .ifndef S
     40 S!=	cd ../../../..; pwd
     41 .endif
     42 MVME68K=$S/arch/mvme68k
     43 
     44 # Override CPP defaults entirely, so cross-compilation works.
     45 # Keep -nostdinc before all -I flags, similar for -undef ...
     46 HAVE_EGCS!=	${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 
     47 INCLUDES=	-nostdinc -I. -I$S/arch -I$S
     48 CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dmvme68k
     49 .if empty(IDENT:M-DMVME172) && empty(IDENT:M-DMVME177)
     50 .if empty(IDENT:M-DMVME147)
     51 CMACHFLAGS=	-m68040
     52 .else
     53 CMACHFLAGS=	-m68030
     54 .endif
     55 .else
     56 .if empty(IDENT:M-DMVME147) && empty(IDENT:M-DMVME162) && empty(IDENT:M-DMVME167)
     57 CMACHFLAGS=	-m68060 -Wa,-m68030 -Wa,-m68851
     58 .else
     59 CMACHFLAGS=	-m68020-60 -Wa,-m68030 -Wa,-m68851
     60 .endif
     61 .endif
     62 CWARNFLAGS?=	-Werror -Wall -Wmissing-prototypes -Wstrict-prototypes \
     63 		-Wpointer-arith
     64 # XXX Delete -Wuninitialized for now, since the compiler doesn't
     65 # XXX always get it right.  --thorpej 
     66 CWARNFLAGS+=	-Wno-uninitialized
     67 .if (${HAVE_EGCS} != "")
     68 CWARNFLAGS+=	-Wno-main
     69 .endif
     70 CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} ${CMACHFLAGS} -msoft-float
     71 AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
     72 LINKFLAGS=	-n -Ttext 8000 -e start
     73 STRIPFLAGS=	-g
     74 
     75 %INCLUDES
     76 
     77 HOSTED_CC=	${CC}
     78 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
     79 HOSTED_CFLAGS=	${CFLAGS}
     80 
     81 ### find out what to use for libkern
     82 KERN_AS=	obj
     83 .include "$S/lib/libkern/Makefile.inc"
     84 .ifndef PROF
     85 LIBKERN=	${KERNLIB}
     86 .else
     87 LIBKERN=	${KERNLIB_PROF}
     88 .endif
     89 
     90 ### find out what to use for libcompat
     91 .include "$S/compat/common/Makefile.inc"
     92 .ifndef PROF
     93 LIBCOMPAT=	${COMPATLIB}
     94 .else
     95 LIBCOMPAT=	${COMPATLIB_PROF}
     96 .endif
     97 
     98 ### for the Motorola 68040 Floating Point Software Product
     99 .include "$S/arch/m68k/fpsp/Makefile.inc"
    100 
    101 ### for the Motorola 68060 Software Support Package
    102 .include "$S/arch/m68k/060sp/Makefile.inc"
    103 
    104 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
    105 # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
    106 
    107 NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
    108 NOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
    109 NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
    110 
    111 HOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
    112 
    113 %OBJS
    114 
    115 %CFILES
    116 
    117 %SFILES
    118 
    119 # load lines for config "xxx" will be emitted as:
    120 # xxx: ${SYSTEM_DEP} swapxxx.o
    121 #	${SYSTEM_LD_HEAD}
    122 #	${SYSTEM_LD} swapxxx.o
    123 #	${SYSTEM_LD_TAIL}
    124 SYSTEM_OBJ=	locore.o ${FPSP} \
    125 		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
    126 SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
    127 SYSTEM_LD_HEAD=	@rm -f $@
    128 SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
    129 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
    130 SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
    131 
    132 DEBUG?=
    133 .if ${DEBUG} == "-g"
    134 LINKFLAGS+=	-X
    135 SYSTEM_LD_TAIL+=; \
    136 		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
    137 		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
    138 		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
    139 .else
    140 LINKFLAGS+=	-S
    141 .endif
    142 
    143 %LOAD
    144 
    145 assym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
    146 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    147 	    < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
    148 	mv -f assym.h.tmp assym.h
    149 
    150 param.c: $S/conf/param.c
    151 	rm -f param.c
    152 	cp $S/conf/param.c .
    153 
    154 param.o: param.c Makefile
    155 	${NORMAL_C}
    156 
    157 ioconf.o: ioconf.c
    158 	${NORMAL_C}
    159 
    160 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    161 	sh $S/conf/newvers.sh
    162 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    163 
    164 __CLEANKERNEL: .USE
    165 	@echo "${.TARGET}ing the kernel objects"
    166 	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
    167 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    168 
    169 __CLEANDEPEND: .USE
    170 	rm -f .depend
    171 
    172 clean: __CLEANKERNEL
    173 
    174 cleandir distclean: __CLEANKERNEL __CLEANDEPEND
    175 
    176 lint:
    177 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    178 	    ${CFILES} ioconf.c param.c | \
    179 	    grep -v 'static function .* unused'
    180 
    181 tags:
    182 	@echo "see $S/kern/Makefile for tags"
    183 
    184 links:
    185 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    186 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    187 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    188 	  sort -u | comm -23 - dontlink | \
    189 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    190 	sh makelinks && rm -f dontlink
    191 
    192 SRCS=	${MVME68K}/mvme68k/locore.s \
    193 	param.c ioconf.c ${CFILES} ${SFILES}
    194 depend: .depend
    195 .depend: ${SRCS} assym.h param.c
    196 	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s
    197 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    198 	-if test -n "${SFILES}"; then \
    199 		${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
    200 	fi
    201 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
    202 	  ${CPPFLAGS} < ${MVME68K}/mvme68k/genassym.cf
    203 	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
    204 	@rm -f assym.dep
    205 
    206 dependall: depend all
    207 
    208 
    209 # depend on root or device configuration
    210 autoconf.o conf.o: Makefile
    211  
    212 # depend on network or filesystem configuration 
    213 uipc_proto.o vfs_conf.o: Makefile 
    214 
    215 # depend on maxusers
    216 machdep.o: Makefile
    217 
    218 # depend on CPU configuration 
    219 locore.o pmap.o sys_machdep.o trap.o: Makefile
    220 
    221 
    222 locore.o: ${MVME68K}/mvme68k/locore.s assym.h
    223 	${NORMAL_S}
    224 
    225 # The install target can be redefined by putting a
    226 # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
    227 MACHINE_NAME!=  uname -n
    228 install: install-kernel-${MACHINE_NAME}
    229 .if !target(install-kernel-${MACHINE_NAME}})
    230 install-kernel-${MACHINE_NAME}:
    231 	rm -f /onetbsd
    232 	ln /netbsd /onetbsd
    233 	cp netbsd /nnetbsd
    234 	mv /nnetbsd /netbsd
    235 .endif
    236 
    237 %RULES
    238