Home | History | Annotate | Line # | Download | only in tools
Makefile revision 1.164
      1 #	$NetBSD: Makefile,v 1.164 2012/12/02 12:10:43 apb Exp $
      2 
      3 .include <bsd.own.mk>
      4 
      5 # Make sure that the ordered build/install processing applies when using
      6 # plain make.
      7 .MAIN: build_install
      8 
      9 # TOOLDIR must be valid, unless MKTOOLS=no
     10 .if ${MKTOOLS:Uyes} != "no"
     11 .if "${TOOLDIR}" == ""
     12 .error "TOOLDIR is undefined or empty"
     13 .elif "${TOOLDIR:tW:M/*}" == ""
     14 .error "TOOLDIR is not an absolute path: ${TOOLDIR}"
     15 #.elif !exists(TOOLDIR) # XXX .exists fails for directories
     16 #.error "TOOLDIR does not exist: ${TOOLDIR}"
     17 .endif
     18 .endif # MKTOOLS != no
     19 
     20 .if ${TOOLCHAIN_MISSING} == "no"
     21 .if defined(HAVE_GCC)
     22 TOOLCHAIN_BITS= gmake .WAIT
     23 .endif
     24 
     25 .if defined(HAVE_GCC)
     26 .if ${HAVE_GCC} >= 45
     27 TOOLCHAIN_BITS+= gmp .WAIT
     28 TOOLCHAIN_BITS+= mpfr .WAIT
     29 TOOLCHAIN_BITS+= mpc .WAIT
     30 .endif
     31 .endif
     32 .endif
     33 
     34 .if ${TOOLCHAIN_MISSING} == "no"
     35 TOOLCHAIN_BITS+= binutils .WAIT
     36 .endif
     37 
     38 .if defined(HAVE_GCC)
     39 .if ${TOOLCHAIN_MISSING} == "no"
     40 TOOLCHAIN_BITS+= gcc
     41 .  if ${MKCROSSGDB:Uno} != "no"
     42 TOOLCHAIN_BITS+= gdb
     43 .  endif
     44 TOOLCHAIN_BITS+= .WAIT
     45 .endif
     46 .endif
     47 
     48 .if defined(HAVE_PCC)
     49 .if ${TOOLCHAIN_MISSING} == "no"
     50 TOOLCHAIN_BITS+= pcc
     51 .endif
     52 .endif
     53 
     54 .if ${TOOLCHAIN_MISSING} == "no"
     55 # XXX Eventually, we want to be able to build dbsym and mdsetimage
     56 # XXX if EXTERNAL_TOOLCHAIN is set.
     57 TOOLCHAIN_BITS+= dbsym mdsetimage
     58 .endif
     59 
     60 DTRACE_BITS=
     61 .if ${MKDTRACE} != "no"
     62 DTRACE_BITS+= .WAIT libelf
     63 DTRACE_BITS+= .WAIT libdwarf
     64 DTRACE_BITS+= .WAIT libctf
     65 DTRACE_BITS+= .WAIT ctfconvert ctfmerge
     66 .endif
     67 
     68 LINT_BITS=
     69 .if ${MKLINT} != "no"
     70 LINT_BITS= lint lint2
     71 .endif
     72 
     73 # Dependencies in SUBDIR below ordered to maximize parallel ability.
     74 SUBDIR=	host-mkdep .WAIT compat .WAIT \
     75 	binstall .WAIT mktemp .WAIT sed .WAIT \
     76 		cap_mkdb crunchgen ctags genassym gencat hexdump join \
     77 		${LINT_BITS} \
     78 		lorder makewhatis mkdep mtree nbperf .WAIT rpcgen tsort \
     79 		uudecode m4 \
     80 	.WAIT texinfo \
     81 	.WAIT yacc \
     82 	.WAIT awk \
     83 	.WAIT tic \
     84 	.WAIT lex \
     85 	.WAIT pax \
     86 	.WAIT ${TOOLCHAIN_BITS} \
     87 	${DTRACE_BITS} \
     88 		asn1_compile cat cksum compile_et config db \
     89 		file lint1 slc \
     90 		makefs .WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \
     91 		.WAIT disklabel \
     92 		.WAIT paxctl \
     93 		.WAIT fdisk \
     94 		.WAIT installboot \
     95 		pwd_mkdb stat strfile sunlabel zic
     96 
     97 .if ${MKLLVM} != "no"
     98 SUBDIR+= \
     99 	llvm .WAIT \
    100 	llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \
    101 	llvm-tblgen llvm-clang-tblgen .WAIT \
    102 	llvm-include .WAIT \
    103 	llvm-lib .WAIT \
    104 	llvm-clang
    105 .endif
    106 
    107 .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
    108 .  if ${MKGROFF} != "no"
    109 SUBDIR+=	groff
    110 .  endif
    111 SUBDIR+=	mandoc
    112 .endif
    113 
    114 .if ${MKMAINTAINERTOOLS:Uno} != "no"
    115 SUBDIR+=	autoconf .WAIT gettext
    116 .endif
    117 
    118 .if ${USE_PIGZGZIP} != "no"
    119 SUBDIR+=	pigz
    120 .endif
    121 
    122 .if ${MACHINE} == "hp700"
    123 SUBDIR+=	hp700-mkboot
    124 .endif
    125 
    126 .if ${MACHINE} == "ibmnws"
    127 SUBDIR+=	ibmnws-ncdcs
    128 .endif
    129 
    130 .if ${MACHINE} == "macppc"
    131 SUBDIR+=	macppc-fixcoff
    132 .endif
    133 
    134 .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
    135 SUBDIR+=	powerpc-mkbootimage
    136 .endif
    137 
    138 .if ${MACHINE_ARCH} == "m68k"
    139 SUBDIR+=	m68k-elf2aout
    140 .endif
    141 
    142 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
    143      ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb")
    144 SUBDIR+=	mips-elf2ecoff
    145 .endif
    146 
    147 .if (${MACHINE} == "sgimips")
    148 SUBDIR+=	sgivol
    149 .endif
    150 
    151 .if ${MACHINE} == "acorn32"
    152 SUBDIR+=	sparkcrc
    153 .endif
    154 
    155 .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")
    156 SUBDIR+=	fgen
    157 .endif
    158 
    159 .if ${MACHINE} == "amiga"
    160 SUBDIR+=	amiga-elf2bb
    161 SUBDIR+=	amiga-txlt
    162 .endif
    163 
    164 .if ${MACHINE} == "hp300"
    165 SUBDIR+=	hp300-mkboot
    166 .endif
    167 
    168 .if ${MACHINE} == "evbarm" && ${MACHINE_ARCH} == "arm"
    169 SUBDIR+=	elftosb
    170 .endif
    171 
    172 .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
    173     ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint"
    174 SUBDIR+=	mkubootimage
    175 .endif
    176 
    177 check_MKTOOLS: .PHONY .NOTMAIN
    178 .if ${MKTOOLS:Uyes} == "no"
    179 	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
    180 	@echo '*** updating your host toolchain.  This should be used only as a'
    181 	@echo '*** temporary workaround for toolchain problems, as it will result'
    182 	@echo '*** in version skew and build errors over time!'
    183 .endif
    184 
    185 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"	# {
    186 SUBDIR= # empty
    187 realall realdepend install: check_MKTOOLS
    188 .endif							# }
    189 
    190 .include <bsd.subdir.mk>
    191 .include <bsd.buildinstall.mk>
    192 .include <bsd.obj.mk>
    193 
    194 .if !defined(PREVIOUSTOOLDIR)
    195 .  if exists(PREVIOUSTOOLDIR)
    196 PREVIOUSTOOLDIR!=	cat PREVIOUSTOOLDIR
    197 .  else
    198 PREVIOUSTOOLDIR=
    199 .  endif
    200 .endif
    201 
    202 CLEANFILES+=	PREVIOUSTOOLDIR
    203 
    204 realall realdepend: .MAKE
    205 .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
    206 	@echo "*** WARNING: TOOLDIR has moved?"
    207 	@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
    208 	@echo "***     !=  TOOLDIR '${TOOLDIR}'"
    209 	@echo "*** Cleaning mis-matched tools"
    210 	rm -f PREVIOUSTOOLDIR
    211 	(cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
    212 .endif
    213 	echo ${TOOLDIR} >PREVIOUSTOOLDIR
    214 
    215 cleandir:
    216 	rm -f ${CLEANFILES}
    217