Home | History | Annotate | Line # | Download | only in conf
Makefile.powerpc revision 1.10
      1 #	$NetBSD: Makefile.powerpc,v 1.10 1997/11/12 22:26:27 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/powerpc/conf/``machineid''
      9 # after which you should do
     10 #	config machineid
     11 # Machine generic makefile changes should be made in
     12 #	/sys/arch/powerpc/conf/Makefile.powerpc
     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 .SUFFIXES:	.S .c .o
     22 
     23 # DEBUG is set to -g if debugging.
     24 # PROF is set to -pg if profiling.
     25 
     26 CC?=	cc
     27 LD?=	ld
     28 LORDER?=lorder
     29 MKDEP?=	mkdep
     30 NM?=	nm
     31 SIZE?=	size
     32 STRIP?=	strip
     33 TSORT?=	tsort -q
     34 COPTS?= 	-O2
     35 
     36 # source tree is located via $S relative to the compilation directory
     37 .ifndef	S
     38 S!=	cd ../../../..; pwd
     39 .endif
     40 PPC=	$S/arch/powerpc
     41 
     42 INCLUDES=	-I. -I$S/arch -I$S -nostdinc
     43 CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
     44 		-Dpowerpc
     45 CWARNFLAGS=	-Werror -Wreturn-type
     46 CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
     47 AFLAGS=		-D_LOCORE
     48 LINKFLAGS=	-N -Ttext 100000 -e __start
     49 STRIPFLAGS=	--strip-debug
     50 
     51 ### find out what to use for libkern
     52 .include "$S/lib/libkern/Makefile.inc"
     53 .ifndef PROF
     54 LIBKERN=	${KERNLIB}
     55 .else
     56 LIBKERN=	${KERNLIB_PROF}
     57 .endif
     58 
     59 ### find out what to use for libcompat
     60 .include "$S/compat/common/Makefile.inc"
     61 .ifndef PROF
     62 LIBCOMPAT=	${COMPATLIB}
     63 .else
     64 LIBCOMPAT=	${COMPATLIB_PROF}
     65 .endif
     66 
     67 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
     68 # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
     69 
     70 NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
     71 
     72 NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
     73 
     74 #.c.o:
     75 #	${NORMAL_C}
     76 #
     77 #.S.o:
     78 #	${NORMAL_S}
     79 
     80 %OBJS
     81 
     82 %CFILES
     83 
     84 %SFILES
     85 
     86 # load lines for config "xxx" will be emitted as:
     87 # xxx: ${SYSTEM_DEP} swapxxx.o
     88 #	${SYSTEM_LD_HEAD}
     89 #	${SYSTEM_LD} swapxxx.o
     90 #	${SYSTEM_LD_TAIL}
     91 SYSTEM_OBJ=	locore.o \
     92 		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
     93 SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
     94 SYSTEM_LD_HEAD=	rm -f $@
     95 SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
     96 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
     97 SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
     98 
     99 DEBUG?=
    100 .if ${DEBUG} == "-g"
    101 LINKFLAGS+=	-X
    102 SYSTEM_LD_TAIL+=; \
    103 		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
    104 		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
    105 .else
    106 LINKFLAGS+=	-S
    107 .endif
    108 
    109 %LOAD
    110 
    111 assym.h: $S/kern/genassym.sh ${PPC}/powerpc/genassym.cf
    112 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    113 	    < ${PPC}/powerpc/genassym.cf > assym.h.tmp && \
    114 	mv -f assym.h.tmp assym.h
    115 
    116 param.c: $S/conf/param.c
    117 	rm -f param.c
    118 	cp $S/conf/param.c .
    119 
    120 param.o: param.c Makefile
    121 	${NORMAL_C}
    122 
    123 ioconf.o: ioconf.c
    124 	${NORMAL_C}
    125 
    126 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    127 	sh $S/conf/newvers.sh
    128 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    129 
    130 __CLEANKERNEL: .USE
    131 	@echo "${.TARGET}ing the kernel objects"
    132 	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
    133 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    134 
    135 __CLEANDEPEND: .USE
    136 	rm -f .depend
    137 
    138 clean: __CLEANKERNEL
    139 
    140 cleandir: __CLEANKERNEL __CLEANDEPEND
    141 
    142 lint:
    143 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    144 		${PPC}/powerpc/Locore.c ${CFILES} \
    145 		ioconf.c param.c | \
    146 		grep -v 'static function .* unused'
    147 
    148 tags:
    149 	@echo "see $S/kern/Makefile for tags"
    150 
    151 links:
    152 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    153 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    154 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    155 	  sort -u | comm -23 - dontlink | \
    156 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    157 	sh makelinks && rm -f dontlink
    158 
    159 SRCS=	${PPC}/powerpc/locore.S \
    160 	param.c ioconf.c ${CFILES} ${SFILES}
    161 depend: .depend
    162 .depend: ${SRCS} assym.h param.c
    163 	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${PPC}/powerpc/locore.S
    164 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    165 .if ${SFILES} != ""
    166 	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
    167 .endif
    168 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
    169 	  ${CPPFLAGS} < ${PPC}/powerpc/genassym.cf
    170 	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
    171 	@rm -f assym.dep
    172 
    173 # depend on root or device configuration
    174 autoconf.o conf.o: Makefile
    175 
    176 # depend on network or filesystem configuration
    177 uipc_proto.o vfs_conf.o: Makefile
    178 
    179 # depend on maxusers
    180 machdep.o: Makefile
    181 
    182 # depend on CPU configuration
    183 locore.o machdep.o: Makefile
    184 
    185 
    186 locore.o: ${PPC}/powerpc/locore.S assym.h
    187 	${NORMAL_S}
    188 
    189 %RULES
    190