Home | History | Annotate | Line # | Download | only in conf
Makefile.mvme68k revision 1.23
      1 #	$NetBSD: Makefile.mvme68k,v 1.23 1997/03/17 22:16:03 gwr 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 # 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 # DEBUG is set to -g if debugging.
     22 # PROF is set to -pg if profiling.
     23 
     24 # Simplify cross-build...
     25 MACHINE_ARCH=m68k
     26 MACHINE=mvme68k
     27 
     28 CC?=	cc
     29 LD?=	ld
     30 MKDEP?=	mkdep
     31 STRIP?=	strip
     32 COPTS?= 	-O2
     33 
     34 # source tree is located via $S relative to the compilation directory
     35 .ifndef S
     36 S!=	cd ../../../..; pwd
     37 .endif
     38 MVME68K=$S/arch/mvme68k
     39 
     40 # Override CPP defaults entirely, so cross-compilation works.
     41 # Keep -nostdinc before all -I flags, similar for -undef ...
     42 INCLUDES=	-nostdinc -I. -I$S/arch -I$S
     43 XDEFS=		-undef -D__NetBSD__ -Dm68k -Dmc68000
     44 DEFINES=	-D_KERNEL -Dmc68020 -Dmvme68k
     45 CPPFLAGS=	${INCLUDES} ${XDEFS} ${DEFINES} ${IDENT} ${PARAM}
     46 CWARNFLAGS=	-Werror
     47 CFLAGS= 	${DEBUG} ${COPTS} -msoft-float ${CWARNFLAGS}
     48 APPFLAGS=	-P -traditional ${CPPFLAGS} -D_LOCORE
     49 AFLAGS= 	-m68030
     50 LINKFLAGS=	-n -Ttext 8000 -e start
     51 STRIPFLAGS=	-d
     52 
     53 ### find out what to use for libkern
     54 .include "$S/lib/libkern/Makefile.inc"
     55 .ifndef PROF
     56 LIBKERN=	${KERNLIB}
     57 .else
     58 LIBKERN=	${KERNLIB_PROF}
     59 .endif
     60 
     61 ### find out what to use for libcompat
     62 .include "$S/compat/common/Makefile.inc"
     63 .ifndef PROF
     64 LIBCOMPAT=	${COMPATLIB}
     65 .else
     66 LIBCOMPAT=	${COMPATLIB_PROF}
     67 .endif
     68 
     69 ### for the Motorola 68040 Floating Point Software Product
     70 .include "$S/arch/m68k/fpsp/Makefile.inc"
     71 
     72 # compile rules: rules are named NORMAL_${SUFFIX} where SUFFIX is
     73 # the file suffix, capitalized (e.g. C for a .c file).
     74 
     75 NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
     76 
     77 # Please do not assume the compiler does "-x ..." (gcc-only).
     78 # This needs an intermediate file.  The original file is always
     79 # safe in some far away directory, so just use the base name.
     80 NORMAL_S=	${CPP} ${APPFLAGS} $< > $*.s ;\
     81 		${AS} ${AFLAGS} -o $@ $*.s ; rm $*.s
     82 
     83 %OBJS
     84 
     85 %CFILES
     86 
     87 %SFILES
     88 
     89 # load lines for config "xxx" will be emitted as:
     90 # xxx: ${SYSTEM_DEP} swapxxx.o
     91 #	${SYSTEM_LD_HEAD}
     92 #	${SYSTEM_LD} swapxxx.o
     93 #	${SYSTEM_LD_TAIL}
     94 SYSTEM_OBJ=	locore.o ${FPSP} \
     95 		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
     96 SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
     97 SYSTEM_LD_HEAD=	@rm -f $@
     98 SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
     99 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
    100 SYSTEM_LD_TAIL=	@size $@; chmod 755 $@
    101 
    102 DEBUG?=
    103 .if ${DEBUG} == "-g"
    104 LINKFLAGS+=	-X
    105 SYSTEM_LD_TAIL+=; \
    106 		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
    107 		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
    108 .else
    109 LINKFLAGS+=	-S
    110 .endif
    111 
    112 %LOAD
    113 
    114 assym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf
    115 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    116 	    < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \
    117 	mv -f assym.h.tmp assym.h
    118 
    119 param.c: $S/conf/param.c
    120 	rm -f param.c
    121 	cp $S/conf/param.c .
    122 
    123 param.o: param.c Makefile
    124 	${NORMAL_C}
    125 
    126 ioconf.o: ioconf.c
    127 	${NORMAL_C}
    128 
    129 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    130 	sh $S/conf/newvers.sh
    131 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    132 
    133 
    134 clean: cleankernel
    135 cleankernel:
    136 	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
    137 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    138 
    139 lint:
    140 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    141 	    ${MVME68K}/mvme68k/Locore.c ${CFILES} \
    142 	    ioconf.c param.c | \
    143 	    grep -v 'static function .* unused'
    144 
    145 tags:
    146 	@echo "see $S/kern/Makefile for tags"
    147 
    148 links:
    149 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    150 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    151 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    152 	  sort -u | comm -23 - dontlink | \
    153 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    154 	sh makelinks && rm -f dontlink
    155 
    156 SRCS=	${MVME68K}/mvme68k/locore.s \
    157 	param.c ioconf.c ${CFILES} ${SFILES}
    158 depend: .depend
    159 .depend: ${SRCS} assym.h param.c
    160 	${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    161 
    162 # XXX - see below
    163 #	${MKDEP} -a ${APPFLAGS} ${MVME68K}/mvme68k/locore.s
    164 #	${MKDEP} -a ${APPFLAGS} ${SFILES}
    165 #
    166 # For cross-compilation, the "gcc -M" mkdep script is convenient,
    167 # but that does not correctly make rules from *.s files.  The
    168 # easiest work-around is to just list those dependencies here.
    169 locore.o:   assym.h m68k/asm.h m68k/trap.h
    170 copy.o:     assym.h m68k/asm.h $S/sys/errno.h
    171 bcopy.o:    assym.h m68k/asm.h
    172 copypage.o: assym.h m68k/asm.h
    173 
    174 
    175 # depend on root or device configuration
    176 autoconf.o conf.o: Makefile
    177  
    178 # depend on network or filesystem configuration 
    179 uipc_proto.o vfs_conf.o: Makefile 
    180 
    181 # depend on maxusers
    182 machdep.o: Makefile
    183 
    184 # depend on CPU configuration 
    185 locore.o pmap.o sys_machdep.o trap.o: Makefile
    186 
    187 
    188 locore.o: ${MVME68K}/mvme68k/locore.s assym.h
    189 	${NORMAL_S}
    190 
    191 %RULES
    192