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