Home | History | Annotate | Line # | Download | only in conf
Makefile.x68k revision 1.45
      1 #	$NetBSD: Makefile.x68k,v 1.45 2000/05/09 00:56:28 hubertf 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/x68k/conf/``machineid''
      9 # after which you should do
     10 #	config machineid
     11 # Machine generic makefile changes should be made in
     12 #	/sys/arch/x68k/conf/Makefile.x68k
     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 STRIP?=	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 X68K=	$S/arch/x68k
     46 
     47 HAVE_EGCS!=	${CC} --version | egrep "^(2\.8|egcs)" ; echo
     48 INCLUDES=	-I. -I$S/arch -I$S -nostdinc
     49 CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -Dx68k
     50 .if empty(IDENT:M-DM68060)
     51 CMACHFLAGS=	-m68030
     52 .else
     53 CMACHFLAGS=	-m68060 -Wa,-m68030 -Wa,-m68851
     54 .endif
     55 CWARNFLAGS?=	-Werror -Wstrict-prototypes -Wmissing-prototypes \
     56 		-Wpointer-arith
     57 # XXX Delete -Wuninitialized for now, since the compiler doesn't
     58 # XXX always get it right.  --thorpej 
     59 CWARNFLAGS+=	-Wno-uninitialized
     60 .if (${HAVE_EGCS} != "")
     61 CWARNFLAGS+=	-Wno-main
     62 .endif
     63 CFLAGS=		${DEBUG} ${COPTS} ${CMACHFLAGS} ${CWARNFLAGS} -msoft-float
     64 AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
     65 LINKFLAGS=	-n -Ttext 0 -e start
     66 STRIPFLAGS=	-g
     67 
     68 %INCLUDES
     69 
     70 HOSTED_CC=	${CC}
     71 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
     72 HOSTED_CFLAGS=	${CFLAGS}
     73 
     74 ### find out what to use for libkern
     75 KERN_AS=	obj
     76 .include "$S/lib/libkern/Makefile.inc"
     77 .ifndef PROF
     78 LIBKERN=	${KERNLIB}
     79 .else
     80 LIBKERN=	${KERNLIB_PROF}
     81 .endif
     82 
     83 ### find out what to use for libcompat
     84 .include "$S/compat/common/Makefile.inc"
     85 .ifndef PROF
     86 LIBCOMPAT=	${COMPATLIB}
     87 .else
     88 LIBCOMPAT=	${COMPATLIB_PROF}
     89 .endif
     90 
     91 ### for the Motorola 68040 Floating Point Software Product
     92 .include "$S/arch/m68k/fpsp/Makefile.inc"
     93 
     94 ### for the Motorola 68060 Software Support Package
     95 .include "$S/arch/m68k/060sp/Makefile.inc"
     96 
     97 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
     98 # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
     99 
    100 NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
    101 NOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
    102 NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
    103 
    104 HOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
    105 
    106 %OBJS
    107 
    108 %CFILES
    109 
    110 #%SFILES
    111 
    112 # load lines for config "xxx" will be emitted as:
    113 # xxx: ${SYSTEM_DEP} swapxxx.o
    114 #	${SYSTEM_LD_HEAD}
    115 #	${SYSTEM_LD} swapxxx.o
    116 #	${SYSTEM_LD_TAIL}
    117 SYSTEM_OBJ=	locore.o ${FPSP} \
    118 		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
    119 SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
    120 SYSTEM_LD_HEAD=	@rm -f $@
    121 SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
    122 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
    123 SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
    124 
    125 DEBUG?=
    126 .if ${DEBUG} == "-g"
    127 LINKFLAGS+=	-X
    128 SYSTEM_LD_TAIL+=; \
    129 		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
    130 		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
    131 		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
    132 .else
    133 LINKFLAGS+=	-S
    134 .endif
    135 
    136 %LOAD
    137 
    138 assym.h: $S/kern/genassym.sh ${X68K}/x68k/genassym.cf
    139 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    140 	    < ${X68K}/x68k/genassym.cf > assym.h.tmp && \
    141 	mv -f assym.h.tmp assym.h
    142 
    143 param.c: $S/conf/param.c
    144 	rm -f param.c
    145 	cp $S/conf/param.c .
    146 
    147 param.o: param.c Makefile
    148 	${NORMAL_C}
    149 
    150 ioconf.o: ioconf.c
    151 	${NORMAL_C}
    152 
    153 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    154 	sh $S/conf/newvers.sh
    155 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    156 
    157 __CLEANKERNEL: .USE
    158 	@echo "${.TARGET}ing the kernel objects"
    159 	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
    160 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    161 
    162 __CLEANDEPEND: .USE
    163 	rm -f .depend
    164 
    165 clean: __CLEANKERNEL
    166 
    167 cleandir distclean: __CLEANKERNEL __CLEANDEPEND
    168 
    169 lint:
    170 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    171 	    ${CFILES} ioconf.c param.c | \
    172 	    grep -v 'static function .* unused'
    173 
    174 tags:
    175 	@echo "see $S/kern/Makefile for tags"
    176 
    177 links:
    178 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    179 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    180 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    181 	  sort -u | comm -23 - dontlink | \
    182 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    183 	sh makelinks && rm -f dontlink
    184 
    185 SRCS=	${X68K}/x68k/locore.s \
    186 	param.c ioconf.c ${CFILES} ${SFILES}
    187 depend: .depend
    188 .depend: ${SRCS} assym.h param.c
    189 	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${X68K}/x68k/locore.s
    190 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    191 	-if test -n "${SFILES}"; then \
    192 		${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
    193 	fi
    194 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
    195 	  ${CPPFLAGS} < ${X68K}/x68k/genassym.cf
    196 	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
    197 	@rm -f assym.dep
    198 
    199 dependall: depend all
    200 
    201 
    202 # depend on root or device configuration
    203 autoconf.o conf.o: Makefile
    204  
    205 # depend on network or filesystem configuration 
    206 uipc_proto.o vfs_conf.o: Makefile 
    207 
    208 # depend on maxusers
    209 machdep.o: Makefile
    210 
    211 # depend on CPU configuration 
    212 locore.o: Makefile
    213 
    214 # depend on DEBUG and/or DIAGNOSTIC options
    215 grf.o par.o sram.o: Makefile
    216 intio_dmac.o mfp.o neptune.o opm.o scsirom.o xel.o zs.o bus.o: Makefile
    217 intio.o vm_machdep.o: Makefile
    218 
    219 
    220 locore.o: ${X68K}/x68k/locore.s assym.h
    221 	${NORMAL_S}
    222 
    223 # The install target can be redefined by putting a
    224 # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
    225 MACHINE_NAME!=  uname -n
    226 install: install-kernel-${MACHINE_NAME}
    227 .if !target(install-kernel-${MACHINE_NAME}})
    228 install-kernel-${MACHINE_NAME}:
    229 	rm -f /onetbsd
    230 	ln /netbsd /onetbsd
    231 	cp netbsd /nnetbsd
    232 	mv /nnetbsd /netbsd
    233 .endif
    234 
    235 %RULES
    236