Home | History | Annotate | Line # | Download | only in conf
Makefile.powerpc revision 1.13.4.1
      1  1.13.4.1   thorpej #	$NetBSD: Makefile.powerpc,v 1.13.4.1 2001/09/13 01:14:22 thorpej Exp $
      2       1.1        ws #
      3       1.1        ws # Makefile for NetBSD
      4       1.1        ws #
      5       1.1        ws # This makefile is constructed from a machine description:
      6       1.1        ws #	config machineid
      7       1.1        ws # Most changes should be made in the machine description
      8       1.1        ws #	/sys/arch/powerpc/conf/``machineid''
      9       1.1        ws # after which you should do
     10       1.1        ws #	config machineid
     11       1.1        ws # Machine generic makefile changes should be made in
     12       1.1        ws #	/sys/arch/powerpc/conf/Makefile.powerpc
     13       1.1        ws # after which config should be rerun for all machines of that type.
     14       1.1        ws #
     15       1.1        ws # N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE
     16       1.1        ws #	IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING
     17       1.1        ws #
     18       1.1        ws # -DTRACE	compile in kernel tracing hooks
     19       1.1        ws # -DQUOTA	compile in file system quotas
     20  1.13.4.1   thorpej 
     21       1.1        ws .SUFFIXES:	.S .c .o
     22       1.1        ws 
     23       1.1        ws # DEBUG is set to -g if debugging.
     24       1.1        ws # PROF is set to -pg if profiling.
     25       1.1        ws 
     26  1.13.4.1   thorpej AR?=		ar
     27  1.13.4.1   thorpej AS?=		as
     28  1.13.4.1   thorpej CC?=		cc
     29  1.13.4.1   thorpej CPP?=		cpp
     30  1.13.4.1   thorpej LD?=		ld
     31  1.13.4.1   thorpej LORDER?=	lorder
     32  1.13.4.1   thorpej MKDEP?=		mkdep
     33  1.13.4.1   thorpej NM?=		nm
     34  1.13.4.1   thorpej OBJCOPY?=	objcopy
     35  1.13.4.1   thorpej OBJDUMP?=	objdump
     36  1.13.4.1   thorpej RANLIB?=	ranlib
     37  1.13.4.1   thorpej SIZE?=		size
     38  1.13.4.1   thorpej STRIP?=		strip
     39  1.13.4.1   thorpej TSORT?=		tsort -q
     40      1.11   thorpej 
     41  1.13.4.1   thorpej COPTS?=		-O2
     42  1.13.4.1   thorpej TEXTADDR?=	0x100000
     43       1.1        ws 
     44       1.1        ws # source tree is located via $S relative to the compilation directory
     45  1.13.4.1   thorpej .ifndef S
     46  1.13.4.1   thorpej S!=		cd ../../../..; pwd
     47       1.1        ws .endif
     48  1.13.4.1   thorpej THISPPC=	$S/arch/${TARGET_MACHINE}
     49  1.13.4.1   thorpej POWERPC=	$S/arch/powerpc
     50       1.1        ws 
     51       1.1        ws INCLUDES=	-I. -I$S/arch -I$S -nostdinc
     52  1.13.4.1   thorpej CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} \
     53  1.13.4.1   thorpej 		-D_KERNEL -D_KERNEL_OPT -D${TARGET_MACHINE}
     54  1.13.4.1   thorpej CWARNFLAGS?=	-Werror -Wall -Wreturn-type -Wpointer-arith -Wno-main \
     55  1.13.4.1   thorpej 		-Wmissing-prototypes -Wstrict-prototypes
     56  1.13.4.1   thorpej # XXX Delete -Wuninitialized for now, since the compiler doesn't
     57  1.13.4.1   thorpej # XXX always get it right.  --thorpej
     58  1.13.4.1   thorpej CWARNFLAGS+=	-Wno-uninitialized
     59  1.13.4.1   thorpej CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float ${CCPUOPTS}
     60  1.13.4.1   thorpej AFLAGS=		-D_LOCORE ${AOPTS}
     61  1.13.4.1   thorpej LINKFLAGS=	-N -Ttext ${TEXTADDR} -e __start
     62       1.6   thorpej STRIPFLAGS=	--strip-debug
     63       1.1        ws 
     64  1.13.4.1   thorpej .if exists(${THISPPC}/conf/Makefile.${TARGET_MACHINE}.inc)
     65  1.13.4.1   thorpej .include "${THISPPC}/conf/Makefile.${TARGET_MACHINE}.inc"
     66  1.13.4.1   thorpej .endif
     67  1.13.4.1   thorpej 
     68  1.13.4.1   thorpej %INCLUDES
     69  1.13.4.1   thorpej 
     70       1.1        ws ### find out what to use for libkern
     71       1.1        ws .include "$S/lib/libkern/Makefile.inc"
     72       1.1        ws .ifndef PROF
     73       1.1        ws LIBKERN=	${KERNLIB}
     74       1.1        ws .else
     75       1.1        ws LIBKERN=	${KERNLIB_PROF}
     76       1.1        ws .endif
     77       1.1        ws 
     78       1.1        ws ### find out what to use for libcompat
     79       1.1        ws .include "$S/compat/common/Makefile.inc"
     80       1.1        ws .ifndef PROF
     81       1.1        ws LIBCOMPAT=	${COMPATLIB}
     82       1.1        ws .else
     83       1.1        ws LIBCOMPAT=	${COMPATLIB_PROF}
     84       1.1        ws .endif
     85       1.1        ws 
     86       1.1        ws # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
     87       1.1        ws # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
     88       1.1        ws 
     89       1.1        ws NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
     90  1.13.4.1   thorpej NOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
     91       1.1        ws NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
     92       1.1        ws 
     93       1.1        ws %OBJS
     94       1.1        ws 
     95       1.1        ws %CFILES
     96       1.1        ws 
     97       1.1        ws %SFILES
     98       1.1        ws 
     99       1.1        ws # load lines for config "xxx" will be emitted as:
    100       1.1        ws # xxx: ${SYSTEM_DEP} swapxxx.o
    101       1.1        ws #	${SYSTEM_LD_HEAD}
    102       1.1        ws #	${SYSTEM_LD} swapxxx.o
    103       1.1        ws #	${SYSTEM_LD_TAIL}
    104       1.1        ws SYSTEM_OBJ=	locore.o \
    105  1.13.4.1   thorpej 		param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
    106       1.1        ws SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
    107       1.1        ws SYSTEM_LD_HEAD=	rm -f $@
    108       1.1        ws SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
    109       1.1        ws 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
    110       1.1        ws SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
    111       1.1        ws 
    112       1.1        ws DEBUG?=
    113       1.1        ws .if ${DEBUG} == "-g"
    114       1.1        ws LINKFLAGS+=	-X
    115       1.1        ws SYSTEM_LD_TAIL+=; \
    116  1.13.4.1   thorpej 		echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
    117  1.13.4.1   thorpej 		echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
    118  1.13.4.1   thorpej 		${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
    119       1.1        ws .else
    120       1.1        ws LINKFLAGS+=	-S
    121       1.1        ws .endif
    122  1.13.4.1   thorpej .if defined(NEED_SREC)
    123  1.13.4.1   thorpej SYSTEM_LD_TAIL+=; \
    124  1.13.4.1   thorpej 		${OBJCOPY} -v -O srec $@ $@.srec
    125  1.13.4.1   thorpej .endif
    126       1.1        ws 
    127       1.1        ws %LOAD
    128       1.1        ws 
    129  1.13.4.1   thorpej assym.h: $S/kern/genassym.sh ${THISPPC}/${TARGET_MACHINE}/genassym.cf
    130       1.6   thorpej 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    131  1.13.4.1   thorpej 	    < ${THISPPC}/${TARGET_MACHINE}/genassym.cf > assym.h.tmp && \
    132       1.6   thorpej 	mv -f assym.h.tmp assym.h
    133       1.1        ws 
    134       1.1        ws param.c: $S/conf/param.c
    135       1.1        ws 	rm -f param.c
    136       1.1        ws 	cp $S/conf/param.c .
    137       1.1        ws 
    138       1.1        ws param.o: param.c Makefile
    139       1.1        ws 	${NORMAL_C}
    140       1.1        ws 
    141       1.1        ws ioconf.o: ioconf.c
    142       1.1        ws 	${NORMAL_C}
    143       1.1        ws 
    144       1.1        ws newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    145       1.1        ws 	sh $S/conf/newvers.sh
    146       1.1        ws 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    147       1.1        ws 
    148       1.9  christos __CLEANKERNEL: .USE
    149       1.9  christos 	@echo "${.TARGET}ing the kernel objects"
    150       1.1        ws 	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
    151       1.9  christos 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    152       1.9  christos 
    153       1.9  christos __CLEANDEPEND: .USE
    154       1.9  christos 	rm -f .depend
    155       1.9  christos 
    156       1.9  christos clean: __CLEANKERNEL
    157       1.9  christos 
    158  1.13.4.1   thorpej cleandir distclean: __CLEANKERNEL __CLEANDEPEND
    159       1.1        ws 
    160       1.1        ws lint:
    161       1.3     perry 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    162  1.13.4.1   thorpej 	    ${THISPPC}/${TARGET_MACHINE}/Locore.c ${CFILES} \
    163  1.13.4.1   thorpej 	    ioconf.c param.c | \
    164  1.13.4.1   thorpej 	    grep -v 'static function .* unused'
    165       1.1        ws 
    166       1.1        ws tags:
    167       1.1        ws 	@echo "see $S/kern/Makefile for tags"
    168       1.1        ws 
    169       1.1        ws links:
    170       1.1        ws 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    171       1.1        ws 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    172       1.1        ws 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    173       1.1        ws 	  sort -u | comm -23 - dontlink | \
    174       1.1        ws 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    175       1.1        ws 	sh makelinks && rm -f dontlink
    176       1.1        ws 
    177  1.13.4.1   thorpej SRCS=	${THISPPC}/${TARGET_MACHINE}/locore.S \
    178       1.1        ws 	param.c ioconf.c ${CFILES} ${SFILES}
    179       1.6   thorpej depend: .depend
    180       1.1        ws .depend: ${SRCS} assym.h param.c
    181  1.13.4.1   thorpej 	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${THISPPC}/${TARGET_MACHINE}/locore.S
    182       1.1        ws 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    183       1.1        ws .if ${SFILES} != ""
    184       1.1        ws 	${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}
    185       1.1        ws .endif
    186       1.8       leo 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
    187  1.13.4.1   thorpej 	  ${CPPFLAGS} < ${THISPPC}/${TARGET_MACHINE}/genassym.cf
    188       1.8       leo 	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
    189       1.8       leo 	@rm -f assym.dep
    190       1.1        ws 
    191  1.13.4.1   thorpej dependall: depend all
    192  1.13.4.1   thorpej 
    193       1.1        ws # depend on root or device configuration
    194       1.1        ws autoconf.o conf.o: Makefile
    195       1.1        ws 
    196       1.1        ws # depend on network or filesystem configuration
    197       1.1        ws uipc_proto.o vfs_conf.o: Makefile
    198       1.1        ws 
    199       1.1        ws # depend on maxusers
    200       1.6   thorpej machdep.o: Makefile
    201       1.1        ws 
    202       1.1        ws # depend on CPU configuration
    203       1.1        ws locore.o machdep.o: Makefile
    204       1.1        ws 
    205  1.13.4.1   thorpej locore.o: ${THISPPC}/${TARGET_MACHINE}/locore.S assym.h
    206       1.1        ws 	${NORMAL_S}
    207  1.13.4.1   thorpej 
    208  1.13.4.1   thorpej # The install target can be redefined by putting a
    209  1.13.4.1   thorpej # install-kernel-${MACHINE_NAME} target into /etc/mk.conf
    210  1.13.4.1   thorpej MACHINE_NAME!=  uname -n
    211  1.13.4.1   thorpej install: install-kernel-${MACHINE_NAME}
    212  1.13.4.1   thorpej .if !target(install-kernel-${MACHINE_NAME}})
    213  1.13.4.1   thorpej install-kernel-${MACHINE_NAME}:
    214  1.13.4.1   thorpej 	rm -f /onetbsd
    215  1.13.4.1   thorpej 	ln /netbsd /onetbsd
    216  1.13.4.1   thorpej 	cp netbsd /nnetbsd
    217  1.13.4.1   thorpej 	mv /nnetbsd /netbsd
    218  1.13.4.1   thorpej .endif
    219       1.1        ws 
    220       1.1        ws %RULES
    221