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