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