Home | History | Annotate | Line # | Download | only in tools
Makefile revision 1.193
      1 #	$NetBSD: Makefile,v 1.193 2018/02/18 01:06:24 uwe Exp $
      2 
      3 .include <bsd.own.mk>
      4 .include <bsd.endian.mk>
      5 
      6 # Make sure that the ordered build/install processing applies when using
      7 # plain make.
      8 .MAIN: build_install
      9 
     10 # TOOLDIR must be valid, unless MKTOOLS=no
     11 .if ${MKTOOLS:Uyes} != "no"
     12 .if "${TOOLDIR}" == ""
     13 .error "TOOLDIR is undefined or empty"
     14 .elif "${TOOLDIR:tW:M/*}" == ""
     15 .error "TOOLDIR is not an absolute path: ${TOOLDIR}"
     16 #.elif !exists(TOOLDIR) # XXX .exists fails for directories
     17 #.error "TOOLDIR does not exist: ${TOOLDIR}"
     18 .endif
     19 .endif # MKTOOLS != no
     20 
     21 # TOOLS_BUILDRUMP == yes builds only the subset of the tools required
     22 # for building rump kernels and the hypervisor.  It is typically used
     23 # when building rump kernels targeted for non-NetBSD systems (via
     24 # buildrump.sh), and should not be set for a regular "make build".
     25 TOOLS_BUILDRUMP?=no
     26 
     27 .if ${TOOLCHAIN_MISSING} == "no"
     28 . if defined(HAVE_GCC) && ${HAVE_GCC} > 0
     29 TOOLCHAIN_BITS= gmake .WAIT
     30 TOOLCHAIN_BITS+= gmp .WAIT
     31 TOOLCHAIN_BITS+= mpfr .WAIT
     32 TOOLCHAIN_BITS+= mpc .WAIT
     33 . endif
     34 .endif
     35 
     36 .if ${TOOLCHAIN_MISSING} == "no"
     37 TOOLCHAIN_BITS+= binutils .WAIT
     38 .endif
     39 
     40 .if defined(HAVE_GCC) && ${HAVE_GCC} > 0
     41 . if ${TOOLCHAIN_MISSING} == "no"
     42 TOOLCHAIN_BITS+= gcc
     43 .  if ${MKCROSSGDB:Uno} != "no" || make(obj)
     44 TOOLCHAIN_BITS+= gdb
     45 .  endif
     46 TOOLCHAIN_BITS+= .WAIT
     47 . endif
     48 .endif
     49 
     50 .if defined(HAVE_PCC)
     51 . if ${TOOLCHAIN_MISSING} == "no"
     52 TOOLCHAIN_BITS+= pcc
     53 . endif
     54 .endif
     55 
     56 .if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)
     57 TOOLCHAIN_BITS+= dbsym mdsetimage
     58 .endif
     59 
     60 DTRACE_BITS=
     61 .if ${MKDTRACE} != "no" || ${MKCTF} != "no"
     62 DTRACE_BITS+= .WAIT libelf
     63 DTRACE_BITS+= .WAIT libdwarf
     64 DTRACE_BITS+= .WAIT libctf
     65 .endif
     66 .if ${MKCTF} != "no"
     67 DTRACE_BITS+= .WAIT ctfconvert ctfmerge
     68 .endif
     69 
     70 LINT_BITS=
     71 .if ${MKLINT} != "no"
     72 LINT_BITS= lint lint2
     73 .endif
     74 
     75 # All of host-mkdep, compat, and binstall are needed before anything
     76 # else.  Within this group, they must be built in a specific order, and
     77 # all of them must be built before any of them is installed.  They may
     78 # be installed in any order.  This can't be expressed using the .WAIT
     79 # notation inside the SUBDIR list.
     80 #
     81 # XXX .ORDER does not work when multiple targets are passed on the
     82 # make command line without "-j", so use dependencies in addition to .ORDER.
     83 #
     84 .ORDER: dependall-host-mkdep dependall-compat dependall-binstall
     85 .if make(dependall-host-mkdep) && make(dependall-compat)
     86 dependall-compat: dependall-host-mkdep
     87 .endif
     88 .if make(dependall-compat) && make(dependall-binstall)
     89 dependall-binstall: dependall-compat
     90 .endif
     91 
     92 # Dependencies in SUBDIR below ordered to maximize parallel ability.
     93 # See above for special treatment for host-mkdep, compat, and binstall.
     94 #
     95 SUBDIR=	host-mkdep compat binstall \
     96 	.WAIT mktemp .WAIT sed .WAIT genassym
     97 .if ${TOOLS_BUILDRUMP} == "no"
     98 SUBDIR+= cap_mkdb crunchgen ctags gencat hexdump \
     99 		${LINT_BITS} \
    100 		makewhatis mtree nbperf .WAIT uudecode
    101 .endif
    102 
    103 SUBDIR+= cat rpcgen join lorder m4 mkdep tsort .WAIT yacc .WAIT awk .WAIT lex
    104 
    105 .if ${TOOLS_BUILDRUMP} == "no"
    106 SUBDIR += .WAIT texinfo \
    107 	.WAIT tic \
    108 	.WAIT pax \
    109 	.WAIT ${TOOLCHAIN_BITS} \
    110 	${DTRACE_BITS} \
    111 		asn1_compile cksum compile_et db \
    112 		file lint1 slc \
    113 		makefs sortinfo \
    114 		.WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \
    115 		.WAIT disklabel gpt \
    116 		.WAIT paxctl \
    117 		.WAIT fdisk \
    118 		.WAIT installboot \
    119 		pwd_mkdb strfile sunlabel vgrind zic
    120 .endif
    121 SUBDIR+= stat .WAIT config
    122 
    123 .if ${MKLLVM} != "no"
    124 SUBDIR+= \
    125 	llvm .WAIT \
    126 	llvm-lib/libLLVMDemangle llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \
    127 	llvm-tblgen llvm-clang-tblgen .WAIT \
    128 	llvm-include .WAIT \
    129 	llvm-lib .WAIT \
    130 	llvm-clang
    131 . if ${MKLLD} != "no"
    132 SUBDIR+=	llvm-lld
    133 . endif
    134 . if ${MKMCLINKER} != "no"
    135 SUBDIR+=	llvm-mcld
    136 . endif
    137 .endif
    138 
    139 .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
    140 . if ${MKGROFF} != "no"
    141 SUBDIR+=	groff
    142 . endif
    143 SUBDIR+=	mandoc
    144 .endif
    145 
    146 .if ${TOOLS_BUILDRUMP} == "no"
    147 
    148 .if ${MKMAINTAINERTOOLS:Uno} != "no"
    149 SUBDIR+=	autoconf .WAIT gettext
    150 .endif
    151 
    152 .if ${USE_PIGZGZIP} != "no"
    153 SUBDIR+=	pigz
    154 .endif
    155 
    156 .if ${MACHINE} == "hppa"
    157 SUBDIR+=	hppa-mkboot
    158 .endif
    159 
    160 .if ${MACHINE} == "ibmnws"
    161 SUBDIR+=	ibmnws-ncdcs
    162 .endif
    163 
    164 .if ${MACHINE} == "macppc"
    165 SUBDIR+=	macppc-fixcoff
    166 .endif
    167 
    168 .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
    169 SUBDIR+=	powerpc-mkbootimage
    170 .endif
    171 
    172 .if ${MACHINE_ARCH} == "m68k"
    173 SUBDIR+=	m68k-elf2aout
    174 .endif
    175 
    176 .if (${MACHINE_ARCH} == "mipsel" || ${MACHINE_ARCH} == "mipseb" || \
    177      ${MACHINE_ARCH} == "mips64el" || ${MACHINE_ARCH} == "mips64eb")
    178 SUBDIR+=	mips-elf2ecoff
    179 .endif
    180 
    181 .if (${MACHINE} == "sgimips")
    182 SUBDIR+=	sgivol
    183 .endif
    184 
    185 .if ${MACHINE} == "acorn32"
    186 SUBDIR+=	sparkcrc
    187 .endif
    188 
    189 .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")
    190 SUBDIR+=	fgen
    191 .endif
    192 
    193 .if ${MACHINE} == "amiga"
    194 SUBDIR+=	amiga-elf2bb
    195 SUBDIR+=	amiga-txlt
    196 .endif
    197 
    198 .if ${MACHINE} == "hp300"
    199 SUBDIR+=	hp300-mkboot
    200 .endif
    201 
    202 .if ${MACHINE} == "evbarm" \
    203     && ${MACHINE_CPU} == "arm" \
    204     && ${TARGET_ENDIANNESS} == "1234"
    205 SUBDIR+=	elftosb
    206 .endif
    207 
    208 .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
    209     ${MACHINE} == "evbppc" || ${MACHINE} == "sandpoint"
    210 SUBDIR+=	mkubootimage
    211 SUBDIR+=	libfdt .WAIT
    212 SUBDIR+=	dtc
    213 .endif
    214 
    215 .if ${MKX11} != "no"
    216 SUBDIR+=	makestrs
    217 SUBDIR+=	makekeys
    218 .endif
    219 
    220 SUBDIR+= cvslatest
    221 
    222 .endif # TOOLS_BUILDRUMP != no
    223 
    224 check_MKTOOLS: .PHONY .NOTMAIN
    225 .if ${MKTOOLS:Uyes} == "no"
    226 	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
    227 	@echo '*** updating your host toolchain.  This should be used only as a'
    228 	@echo '*** temporary workaround for toolchain problems, as it will result'
    229 	@echo '*** in version skew and build errors over time!'
    230 .endif
    231 
    232 .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"	# {
    233 SUBDIR= # empty
    234 realall realdepend install: check_MKTOOLS
    235 .endif							# }
    236 
    237 .include <bsd.subdir.mk>
    238 .include <bsd.buildinstall.mk>
    239 .include <bsd.obj.mk>
    240 
    241 .if !defined(PREVIOUSTOOLDIR)
    242 .  if exists(PREVIOUSTOOLDIR)
    243 PREVIOUSTOOLDIR!=	cat PREVIOUSTOOLDIR
    244 .  else
    245 PREVIOUSTOOLDIR=
    246 .  endif
    247 .endif
    248 
    249 CLEANFILES+=	PREVIOUSTOOLDIR
    250 
    251 realall realdepend: .MAKE
    252 .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
    253 	@echo "*** WARNING: TOOLDIR has moved?"
    254 	@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
    255 	@echo "***     !=  TOOLDIR '${TOOLDIR}'"
    256 	@echo "*** Cleaning mis-matched tools"
    257 	rm -f PREVIOUSTOOLDIR
    258 	(cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
    259 .endif
    260 	echo ${TOOLDIR} >PREVIOUSTOOLDIR
    261 
    262 cleandir:
    263 	rm -f ${CLEANFILES}
    264