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