Home | History | Annotate | Line # | Download | only in conf
Makefile.hp300 revision 1.64
      1 #	$NetBSD: Makefile.hp300,v 1.64 1998/09/05 15:15:15 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/hp300/conf/``machineid''
      9 # after which you should do
     10 #	config machineid
     11 # Machine generic makefile changes should be made in
     12 #	/sys/arch/hp300/conf/Makefile.hp300
     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 AR?=	ar
     25 AS?=	as
     26 CC?=	cc
     27 CPP?=	cpp
     28 LD?=	ld
     29 LORDER?=lorder
     30 MKDEP?=	mkdep
     31 NM?=	nm
     32 RANLIB?=ranlib
     33 SIZE?=	size
     34 STRIP?=	strip
     35 TSORT?=	tsort -q
     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 HP300=	$S/arch/hp300
     44 
     45 HAVE_GCC28!=	${CC} --version | egrep "^(2\.8|egcs)" ; echo 
     46 INCLUDES=	-I. -I$S/arch -I$S -nostdinc
     47 CPPFLAGS=	${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \
     48 		-Dmc68020 -Dhp300
     49 CWARNFLAGS?=	-Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
     50 .if (${HAVE_GCC28} != "")
     51 CWARNFLAGS+=	-Wno-main
     52 .endif
     53 CFLAGS=		${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float
     54 AFLAGS=		-x assembler-with-cpp -traditional-cpp -D_LOCORE
     55 LINKFLAGS=	-n -Ttext 0 -e start
     56 STRIPFLAGS=	-d
     57 
     58 HOSTED_CC=	${CC}
     59 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//}
     60 HOSTED_CFLAGS=	${CFLAGS}
     61 
     62 ### find out what to use for libkern
     63 .include "$S/lib/libkern/Makefile.inc"
     64 .ifndef PROF
     65 LIBKERN=	${KERNLIB}
     66 .else
     67 LIBKERN=	${KERNLIB_PROF}
     68 .endif
     69 
     70 ### find out what to use for libcompat
     71 .include "$S/compat/common/Makefile.inc"
     72 .ifndef PROF
     73 LIBCOMPAT=	${COMPATLIB}
     74 .else
     75 LIBCOMPAT=	${COMPATLIB_PROF}
     76 .endif
     77 
     78 ### for the Motorola 68040 Floating Point Software Product
     79 .include "$S/arch/m68k/fpsp/Makefile.inc"
     80 
     81 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
     82 # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
     83 
     84 NORMAL_C=	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
     85 NOPROF_C=	${CC} ${CFLAGS} ${CPPFLAGS} -c $<
     86 NORMAL_S=	${CC} ${AFLAGS} ${CPPFLAGS} -c $<
     87 
     88 HOSTED_C=	${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $<
     89 
     90 %OBJS
     91 
     92 %CFILES
     93 
     94 #%SFILES
     95 
     96 # load lines for config "xxx" will be emitted as:
     97 # xxx: ${SYSTEM_DEP} swapxxx.o
     98 #	${SYSTEM_LD_HEAD}
     99 #	${SYSTEM_LD} swapxxx.o
    100 #	${SYSTEM_LD_TAIL}
    101 SYSTEM_OBJ=	locore.o ${FPSP} \
    102 		param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT}
    103 SYSTEM_DEP=	Makefile ${SYSTEM_OBJ}
    104 SYSTEM_LD_HEAD=	@rm -f $@
    105 SYSTEM_LD=	@echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
    106 		${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
    107 SYSTEM_LD_TAIL=	@${SIZE} $@; chmod 755 $@
    108 
    109 DEBUG?=
    110 .if ${DEBUG} == "-g"
    111 LINKFLAGS+=	-X
    112 SYSTEM_LD_TAIL+=; \
    113 		echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \
    114 		echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@
    115 .else
    116 LINKFLAGS+=	-S
    117 .endif
    118 
    119 %LOAD
    120 
    121 assym.h: $S/kern/genassym.sh ${HP300}/hp300/genassym.cf
    122 	sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
    123 	    < ${HP300}/hp300/genassym.cf > assym.h.tmp && \
    124 	mv -f assym.h.tmp assym.h
    125 
    126 param.c: $S/conf/param.c
    127 	rm -f param.c
    128 	cp $S/conf/param.c .
    129 
    130 param.o: param.c Makefile
    131 	${NORMAL_C}
    132 
    133 ioconf.o: ioconf.c
    134 	${NORMAL_C}
    135 
    136 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
    137 	sh $S/conf/newvers.sh
    138 	${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
    139 
    140 __CLEANKERNEL: .USE
    141 	@echo "${.TARGET}ing the kernel objects"
    142 	rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
    143 	    [Ee]rrs linterrs makelinks assym.h.tmp assym.h
    144 
    145 __CLEANDEPEND: .USE
    146 	rm -f .depend
    147 
    148 clean: __CLEANKERNEL
    149 
    150 cleandir distclean: __CLEANKERNEL __CLEANDEPEND
    151 
    152 lint:
    153 	@lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
    154 	    ${CFILES} ioconf.c param.c | \
    155 	    grep -v 'static function .* unused'
    156 
    157 tags:
    158 	@echo "see $S/kern/Makefile for tags"
    159 
    160 links:
    161 	egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
    162 	  sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
    163 	echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
    164 	  sort -u | comm -23 - dontlink | \
    165 	  sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
    166 	sh makelinks && rm -f dontlink
    167 
    168 SRCS=	${HP300}/hp300/locore.s \
    169 	param.c ioconf.c ${CFILES} ${SFILES}
    170 depend: .depend
    171 .depend: ${SRCS} assym.h param.c
    172 	${MKDEP} ${AFLAGS} ${CPPFLAGS} ${HP300}/hp300/locore.s
    173 	${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
    174 	-if test -n "${SFILES}"; then \
    175 		${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \
    176 	fi
    177 	sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
    178 	  ${CPPFLAGS} < ${HP300}/hp300/genassym.cf
    179 	@sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
    180 	@rm -f assym.dep
    181 
    182 
    183 # depend on root or device configuration
    184 autoconf.o conf.o: Makefile
    185  
    186 # depend on network or filesystem configuration 
    187 uipc_proto.o vfs_conf.o: Makefile 
    188 
    189 # depend on maxusers
    190 machdep.o: Makefile
    191 
    192 # depend on CPU configuration 
    193 dma.o hpux_machdep.o locore.o machdep.o pmap.o pmap_boostrap.o sys_machdep.o trap.o: Makefile
    194 
    195 
    196 locore.o: ${HP300}/hp300/locore.s assym.h
    197 	${NORMAL_S}
    198 
    199 %RULES
    200