Home | History | Annotate | Line # | Download | only in conf
Makefile.mac68k revision 1.73
      1 #	$NetBSD: Makefile.mac68k,v 1.73 2000/01/24 20:36:13 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/mac68k/conf/``machineid''
      9 # after which you should do
     10 #	config machineid
     11 # Machine generic makefile changes should be made in
     12 #	/sys/arch/mac68k/conf/Makefile.mac68k
     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 AR?=	ar
     25 AS?=	as
     26 CC?=	cc
     27 CPP?=	cpp
     28 LD?=	ld
     29 LORDER?=lorder
     30 MKDEP?=	mkdep
     31 NM?=	nm
     32 RANLIB?=ranlib
     33 SIZE?=	size
     34 STRIPPROG?=strip
     35 TSORT?=	tsort -q
     36 
     37 COPTS?= -O2
     38 
     39 # source tree is located via $S relative to the compilation directory
     40 .ifndef S
     41 S!=	cd ../../../..; pwd
     42 .endif
     43 MAC68K=	$S/arch/mac68k
     44 
     45 HAVE_GCC28!=	${CC} --version | egrep "^(2\.8|egcs)" ; echo 
     46 INCLUDES=	-I. -I$S/arch -I$S -nostdinc
     47 CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -Dmac68k
     48 CWARNFLAGS?=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
     49 		-Wpointer-arith
     50 .if (${HAVE_GCC28} != "")
     51 CWARNFLAGS+=	-Wno-main
     52 .endif
     53 CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
     54 AFLAGS=		-traditional -D_LOCORE
     55 LINKFLAGS=	-n -Ttext 0 -e start
     56 STRIPFLAGS=	-g
     57 
     58 %INCLUDES
     59 
     60 ### Find out what to use for libkern.
     61 KERN_AS=	obj
     62 .include "$S/lib/libkern/Makefile.inc"
     63 .ifndef PROF
     64 LIBKERN=${KERNLIB}
     65 .else
     66 LIBKERN=${KERNLIB_PROF}
     67 .endif
     68 
     69 ### Find out what to use for libcompat.
     70 .include "$S/compat/common/Makefile.inc"
     71 .ifndef PROF
     72 LIBCOMPAT=${COMPATLIB}
     73 .else
     74 LIBCOMPAT=${COMPATLIB_PROF}
     75 .endif
     76 
     77 ### for the Motorola 68040 Floating Point Software Product
     78 .include "$S/arch/m68k/fpsp/Makefile.inc"
     79 
     80 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
     81 # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
     82 
     83 NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
     84 NOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
     85 NORMAL_S=	${CPP} ${AFLAGS} ${CPPFLAGS} $< | sed -e 's/^\#.*//' | ${AS} -o ${.TARGET}
     86 
     87 %OBJS
     88 
     89 %CFILES
     90 
     91 %SFILES
     92 
     93 # load lines for config "xxx" will be emitted as:
     94 # xxx: ${SYSTEM_DEP} swapxxx.o
     95 #	${SYSTEM_LD_HEAD}
     96 #	${SYSTEM_LD} swapxxx.o
     97 #	${SYSTEM_LD_TAIL}
     98 SYSTEM_OBJ=	locore.o ${FPSP} \
     99 		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
    100 SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
    101 SYSTEM_LD_HEAD=	@rm -f $@
    102 SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
    103 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
    104 SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
    105 
    106 DEBUG?=
    107 .if ${DEBUG} == "-g"
    108 LINKFLAGS+=	-X
    109 SYSTEM_LD_TAIL+=; \
    110 		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
    111 		echo ${STRIPPROG} ${STRIPFLAGS} -o $@ $@.gdb; \
    112 		${STRIPPROG} ${STRIPFLAGS} -o $@ $@.gdb
    113 .else
    114 LINKFLAGS+=	-S
    115 .endif
    116 
    117 %LOAD
    118 
    119 assym.h: $S/kern/genassym.sh ${MAC68K}/mac68k/genassym.cf
    120 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    121 	    < ${MAC68K}/mac68k/genassym.cf > assym.h.tmp && \
    122 	mv -f assym.h.tmp assym.h
    123 
    124 param.c: $S/conf/param.c
    125 	rm -f param.c
    126 	cp $S/conf/param.c .
    127 
    128 param.o: param.c Makefile
    129 	${NORMAL_C}
    130 
    131 ioconf.o: ioconf.c
    132 	${NORMAL_C}
    133 
    134 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    135 	sh $S/conf/newvers.sh
    136 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    137 
    138 __CLEANKERNEL: .USE
    139 	@echo "${.TARGET}ing the kernel objects"
    140 	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
    141 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    142 
    143 __CLEANDEPEND: .USE
    144 	rm -f .depend
    145 
    146 clean: __CLEANKERNEL
    147 
    148 cleandir distclean: __CLEANKERNEL __CLEANDEPEND
    149 
    150 lint:
    151 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    152 	    ${CFILES} ioconf.c param.c | \
    153 	    grep -v 'static function .* unused'
    154 
    155 tags:
    156 	@echo "see $S/kern/Makefile for tags"
    157 
    158 links:
    159 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    160 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    161 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    162 	  sort -u | comm -23 - dontlink | \
    163 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    164 	sh makelinks && rm -f dontlink
    165 
    166 SRCS=	${MAC68K}/mac68k/locore.s \
    167 	param.c ioconf.c ${CFILES} ${SFILES}
    168 depend: .depend
    169 .depend: ${SRCS} assym.h param.c
    170 	${MKDEP} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \
    171 	    ${MAC68K}/mac68k/locore.s
    172 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    173 	${MKDEP} -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${SFILES}
    174 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
    175 	  ${CPPFLAGS} < ${MAC68K}/mac68k/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 genassym.o machdep.o: Makefile
    190 
    191 # depends on KGDBDEV, KGDBRATE
    192 kgdb_stub.o: Makefile
    193 
    194 # depend on CPU configuration 
    195 locore.o pmap.o trap.o: Makefile
    196 
    197 
    198 locore.o: ${MAC68K}/mac68k/locore.s assym.h
    199 	${NORMAL_S}
    200 
    201 %RULES
    202