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