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