Home | History | Annotate | Line # | Download | only in tools
Makefile revision 1.214.2.2
      1  1.214.2.2    martin #	$NetBSD: Makefile,v 1.214.2.2 2025/04/14 09:58:17 martin Exp $
      2        1.1        tv 
      3        1.3        tv .include <bsd.own.mk>
      4      1.167      matt .include <bsd.endian.mk>
      5        1.3        tv 
      6      1.159     joerg # Make sure that the ordered build/install processing applies when using
      7      1.159     joerg # plain make.
      8      1.159     joerg .MAIN: build_install
      9      1.159     joerg 
     10      1.164       apb # TOOLDIR must be valid, unless MKTOOLS=no
     11      1.164       apb .if ${MKTOOLS:Uyes} != "no"
     12      1.164       apb .if "${TOOLDIR}" == ""
     13      1.164       apb .error "TOOLDIR is undefined or empty"
     14      1.164       apb .elif "${TOOLDIR:tW:M/*}" == ""
     15      1.164       apb .error "TOOLDIR is not an absolute path: ${TOOLDIR}"
     16      1.164       apb #.elif !exists(TOOLDIR) # XXX .exists fails for directories
     17      1.164       apb #.error "TOOLDIR does not exist: ${TOOLDIR}"
     18      1.164       apb .endif
     19      1.164       apb .endif # MKTOOLS != no
     20      1.164       apb 
     21      1.166     pooka # TOOLS_BUILDRUMP == yes builds only the subset of the tools required
     22      1.166     pooka # for building rump kernels and the hypervisor.  It is typically used
     23      1.166     pooka # when building rump kernels targeted for non-NetBSD systems (via
     24      1.166     pooka # buildrump.sh), and should not be set for a regular "make build".
     25      1.166     pooka TOOLS_BUILDRUMP?=no
     26      1.166     pooka 
     27      1.160     pooka .if ${TOOLCHAIN_MISSING} == "no"
     28      1.207       dbj . if (defined(HAVE_GCC) && ${HAVE_GCC} > 0) || \
     29      1.207       dbj      (defined(HAVE_GDB) && ${HAVE_GDB} > 0 && ${MKCROSSGDB:Uno} != "no")
     30      1.207       dbj TOOLCHAIN_BITS+= gmake .WAIT
     31      1.146       mrg TOOLCHAIN_BITS+= gmp .WAIT
     32      1.146       mrg TOOLCHAIN_BITS+= mpfr .WAIT
     33      1.146       mrg TOOLCHAIN_BITS+= mpc .WAIT
     34      1.174       mrg . endif
     35      1.156     joerg 
     36       1.94       jmc TOOLCHAIN_BITS+= binutils .WAIT
     37      1.156     joerg 
     38      1.207       dbj . if defined(HAVE_GCC) && ${HAVE_GCC} > 0
     39       1.77       mrg TOOLCHAIN_BITS+= gcc
     40      1.207       dbj . endif
     41      1.207       dbj 
     42      1.207       dbj . if defined(HAVE_GDB) && ${HAVE_GDB} > 0 && ${MKCROSSGDB:Uno} != "no"
     43       1.74        cl TOOLCHAIN_BITS+= gdb
     44      1.207       dbj . endif
     45      1.207       dbj 
     46      1.156     joerg TOOLCHAIN_BITS+= .WAIT
     47      1.118  gmcgarry .endif
     48      1.118  gmcgarry 
     49      1.118  gmcgarry .if defined(HAVE_PCC)
     50      1.174       mrg . if ${TOOLCHAIN_MISSING} == "no"
     51      1.118  gmcgarry TOOLCHAIN_BITS+= pcc
     52      1.174       mrg . endif
     53      1.118  gmcgarry .endif
     54       1.31        tv 
     55      1.192  christos .if ${TOOLCHAIN_MISSING} == "no" || defined(EXTERNAL_TOOLCHAIN)
     56      1.156     joerg TOOLCHAIN_BITS+= dbsym mdsetimage
     57      1.157     pooka .endif
     58      1.156     joerg 
     59      1.137    darran DTRACE_BITS=
     60      1.173  riastrad .if ${MKDTRACE} != "no" || ${MKCTF} != "no"
     61      1.213    jkoshy DTRACE_BITS+= .WAIT elftoolchain
     62      1.162       apb DTRACE_BITS+= .WAIT libctf
     63      1.172     ozaki .endif
     64      1.172     ozaki .if ${MKCTF} != "no"
     65  1.214.2.2    martin DTRACE_BITS+= .WAIT ctfconvert ctfdump ctfmerge
     66      1.137    darran .endif
     67      1.137    darran 
     68       1.99       mrg LINT_BITS=
     69       1.99       mrg .if ${MKLINT} != "no"
     70       1.99       mrg LINT_BITS= lint lint2
     71       1.99       mrg .endif
     72       1.99       mrg 
     73      1.165       apb # All of host-mkdep, compat, and binstall are needed before anything
     74      1.165       apb # else.  Within this group, they must be built in a specific order, and
     75      1.165       apb # all of them must be built before any of them is installed.  They may
     76      1.165       apb # be installed in any order.  This can't be expressed using the .WAIT
     77      1.165       apb # notation inside the SUBDIR list.
     78      1.165       apb #
     79      1.165       apb # XXX .ORDER does not work when multiple targets are passed on the
     80      1.165       apb # make command line without "-j", so use dependencies in addition to .ORDER.
     81      1.165       apb #
     82      1.211      cjep .ORDER: dependall-host-mkdep dependall-compat dependall-binstall \
     83      1.211      cjep 	dependall-date
     84      1.165       apb .if make(dependall-host-mkdep) && make(dependall-compat)
     85      1.165       apb dependall-compat: dependall-host-mkdep
     86      1.165       apb .endif
     87      1.165       apb .if make(dependall-compat) && make(dependall-binstall)
     88      1.165       apb dependall-binstall: dependall-compat
     89      1.165       apb .endif
     90      1.211      cjep .if make(dependall-date)
     91      1.211      cjep dependall-date: dependall-host-mkdep dependall-compat
     92      1.211      cjep .endif
     93      1.165       apb 
     94       1.16        tv # Dependencies in SUBDIR below ordered to maximize parallel ability.
     95      1.165       apb # See above for special treatment for host-mkdep, compat, and binstall.
     96      1.165       apb #
     97      1.210  christos SUBDIR=	host-mkdep compat binstall date \
     98      1.179     pooka 	.WAIT mktemp .WAIT sed .WAIT genassym
     99      1.166     pooka .if ${TOOLS_BUILDRUMP} == "no"
    100      1.179     pooka SUBDIR+= cap_mkdb crunchgen ctags gencat hexdump \
    101       1.99       mrg 		${LINT_BITS} \
    102      1.175     pooka 		makewhatis mtree nbperf .WAIT uudecode
    103      1.166     pooka .endif
    104      1.166     pooka 
    105  1.214.2.2    martin SUBDIR+= cat rpcgen join lorder m4 mkdep tsort what \
    106  1.214.2.2    martin 	.WAIT yacc .WAIT awk .WAIT lex
    107      1.204       bad .if ${TOOLS_BUILDRUMP} == "no"
    108      1.204       bad SUBDIR+= xz-include .WAIT grep xz-lib pax .WAIT libprop
    109      1.166     pooka 
    110      1.166     pooka SUBDIR += .WAIT texinfo \
    111      1.153  christos 	.WAIT tic \
    112      1.132       mrg 	.WAIT ${TOOLCHAIN_BITS} \
    113      1.137    darran 	${DTRACE_BITS} \
    114      1.175     pooka 		asn1_compile cksum compile_et db \
    115      1.145     elric 		file lint1 slc \
    116      1.184  christos 		makefs sortinfo \
    117      1.184  christos 		.WAIT menuc mkcsmapper mkesdb mklocale mknod msgc \
    118      1.178  christos 		.WAIT disklabel gpt \
    119      1.132       mrg 		.WAIT paxctl \
    120      1.132       mrg 		.WAIT fdisk \
    121      1.132       mrg 		.WAIT installboot \
    122      1.176  christos 		pwd_mkdb strfile sunlabel vgrind zic
    123      1.166     pooka .endif
    124      1.204       bad SUBDIR+= stat .WAIT config
    125      1.204       bad .if ${TOOLS_BUILDRUMP} == "no"
    126      1.204       bad SUBDIR+= xz-bin
    127      1.204       bad .endif
    128       1.39        tv 
    129      1.201     joerg .if ${MKLLVM} != "no" || ${MKLLVMRT} != "no"
    130      1.142     joerg SUBDIR+= \
    131      1.142     joerg 	llvm .WAIT \
    132      1.187     joerg 	llvm-lib/libLLVMDemangle llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \
    133      1.201     joerg 	llvm-tblgen
    134      1.201     joerg .endif
    135      1.201     joerg .if ${MKLLVM} != "no"
    136      1.201     joerg SUBDIR+= \
    137      1.201     joerg 	llvm-clang-tblgen
    138      1.194     joerg .endif
    139      1.194     joerg .if ${MKLLVM} != "no" && !defined(EXTERNAL_TOOLCHAIN)
    140      1.194     joerg SUBDIR+= \
    141      1.194     joerg 	.WAIT llvm-include .WAIT \
    142      1.200     joerg 	llvm-lib .WAIT \
    143      1.200     joerg 	llvm-clang
    144      1.142     joerg .endif
    145      1.142     joerg 
    146      1.121    dyoung .if ${MKMAN} != "no" || ${MKDOC} != "no" || ${MKHTML} != "no"
    147      1.174       mrg . if ${MKGROFF} != "no"
    148       1.39        tv SUBDIR+=	groff
    149      1.174       mrg . endif
    150      1.128     joerg SUBDIR+=	mandoc
    151       1.39        tv .endif
    152       1.22        tv 
    153      1.166     pooka .if ${TOOLS_BUILDRUMP} == "no"
    154      1.166     pooka 
    155       1.22        tv .if ${MKMAINTAINERTOOLS:Uno} != "no"
    156      1.103     lukem SUBDIR+=	autoconf .WAIT gettext
    157       1.72      matt .endif
    158       1.72      matt 
    159      1.140       mrg .if ${USE_PIGZGZIP} != "no"
    160      1.140       mrg SUBDIR+=	pigz
    161      1.140       mrg .endif
    162      1.140       mrg 
    163      1.171     skrll .if ${MACHINE} == "hppa"
    164      1.171     skrll SUBDIR+=	hppa-mkboot
    165       1.83     skrll .endif
    166       1.83     skrll 
    167       1.86       jmc .if ${MACHINE} == "ibmnws"
    168       1.72      matt SUBDIR+=	ibmnws-ncdcs
    169       1.79      matt .endif
    170       1.79      matt 
    171       1.86       jmc .if ${MACHINE} == "macppc"
    172       1.79      matt SUBDIR+=	macppc-fixcoff
    173  1.214.2.1    martin SUBDIR+=	macppc_installboot
    174       1.48    kleink .endif
    175       1.48    kleink 
    176      1.116   garbled .if (${MACHINE} == "prep" || ${MACHINE} == "rs6000" || ${MACHINE} == "bebox")
    177      1.115   garbled SUBDIR+=	powerpc-mkbootimage
    178       1.22        tv .endif
    179       1.37  gmcgarry 
    180      1.198  christos .if ${MACHINE_CPU} == "arm"
    181      1.197  christos SUBDIR+=	arm-elf2aout
    182      1.197  christos .endif
    183      1.197  christos 
    184      1.198  christos .if ${MACHINE_CPU} == "m68k"
    185      1.148   tsutsui SUBDIR+=	m68k-elf2aout
    186      1.148   tsutsui .endif
    187      1.148   tsutsui 
    188      1.208  christos .if !empty(MACHINE_ARCH:Mmips*)
    189       1.37  gmcgarry SUBDIR+=	mips-elf2ecoff
    190       1.76    sekiya .endif
    191       1.76    sekiya 
    192       1.76    sekiya .if (${MACHINE} == "sgimips")
    193       1.76    sekiya SUBDIR+=	sgivol
    194       1.51     bjh21 .endif
    195       1.51     bjh21 
    196       1.82       abs .if ${MACHINE} == "acorn32"
    197       1.82       abs SUBDIR+=	sparkcrc
    198       1.82       abs .endif
    199       1.82       abs 
    200      1.125       abs .if (${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64")
    201       1.51     bjh21 SUBDIR+=	fgen
    202       1.37  gmcgarry .endif
    203       1.37  gmcgarry 
    204       1.85       jmc .if ${MACHINE} == "amiga"
    205       1.85       jmc SUBDIR+=	amiga-elf2bb
    206       1.85       jmc SUBDIR+=	amiga-txlt
    207       1.85       jmc .endif
    208       1.85       jmc 
    209       1.86       jmc .if ${MACHINE} == "hp300"
    210       1.86       jmc SUBDIR+=	hp300-mkboot
    211       1.86       jmc .endif
    212       1.86       jmc 
    213      1.167      matt .if ${MACHINE} == "evbarm" \
    214      1.167      matt     && ${MACHINE_CPU} == "arm" \
    215      1.167      matt     && ${TARGET_ENDIANNESS} == "1234"
    216      1.158     jkunz SUBDIR+=	elftosb
    217      1.158     jkunz .endif
    218      1.158     jkunz 
    219      1.143       phx .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
    220      1.206       uwe     ${MACHINE} == "evbppc" || ${MACHINE} == "evbsh3" || \
    221      1.206       uwe     ${MACHINE} == "sandpoint"
    222      1.139  jmcneill SUBDIR+=	mkubootimage
    223      1.212     skrll .endif
    224      1.212     skrll 
    225      1.212     skrll .if ${MACHINE} == "evbarm" || ${MACHINE} == "evbmips" || \
    226      1.212     skrll     ${MACHINE} == "evbppc" || ${MACHINE} == "evbsh3" || \
    227      1.212     skrll     ${MACHINE} == "sandpoint" || \
    228      1.212     skrll     ${MACHINE_CPU} == "riscv"
    229      1.191     skrll SUBDIR+=	libfdt .WAIT
    230      1.191     skrll SUBDIR+=	dtc
    231      1.139  jmcneill .endif
    232      1.139  jmcneill 
    233      1.209       rin .if ${MACHINE} == "mvme68k"
    234      1.209       rin SUBDIR+=	mvme68k-wrtvid
    235      1.209       rin .endif
    236      1.209       rin 
    237  1.214.2.1    martin .if ${MACHINE} == "mac68k" || ${MACHINE} == "macppc"
    238  1.214.2.1    martin SUBDIR+=	mkhybrid
    239  1.214.2.1    martin .endif
    240  1.214.2.1    martin 
    241      1.182       mrg .if ${MKX11} != "no"
    242      1.181      matt SUBDIR+=	makestrs
    243      1.181      matt SUBDIR+=	makekeys
    244      1.180     joerg .endif
    245      1.180     joerg 
    246      1.186  christos SUBDIR+= cvslatest
    247      1.186  christos 
    248      1.193       uwe .endif # TOOLS_BUILDRUMP != no
    249      1.166     pooka 
    250       1.66     lukem check_MKTOOLS: .PHONY .NOTMAIN
    251       1.19       jmc .if ${MKTOOLS:Uyes} == "no"
    252       1.17        tv 	@echo '*** WARNING: "MKTOOLS" is set to "no"; this will prevent building and'
    253       1.17        tv 	@echo '*** updating your host toolchain.  This should be used only as a'
    254       1.17        tv 	@echo '*** temporary workaround for toolchain problems, as it will result'
    255       1.23       wiz 	@echo '*** in version skew and build errors over time!'
    256       1.18       jmc .endif
    257       1.17        tv 
    258       1.66     lukem .if ${MKTOOLS:Uyes} == "no" || ${USETOOLS} != "yes"	# {
    259      1.163       apb SUBDIR= # empty
    260       1.67     lukem realall realdepend install: check_MKTOOLS
    261       1.66     lukem .endif							# }
    262        1.1        tv 
    263        1.1        tv .include <bsd.subdir.mk>
    264      1.159     joerg .include <bsd.buildinstall.mk>
    265       1.11        tv .include <bsd.obj.mk>
    266       1.16        tv 
    267      1.102      tron .if !defined(PREVIOUSTOOLDIR)
    268      1.102      tron .  if exists(PREVIOUSTOOLDIR)
    269       1.66     lukem PREVIOUSTOOLDIR!=	cat PREVIOUSTOOLDIR
    270      1.102      tron .  else
    271      1.162       apb PREVIOUSTOOLDIR=
    272      1.102      tron .  endif
    273       1.66     lukem .endif
    274       1.66     lukem 
    275       1.66     lukem CLEANFILES+=	PREVIOUSTOOLDIR
    276       1.66     lukem 
    277      1.101      tron realall realdepend: .MAKE
    278      1.107       apb .if !empty(PREVIOUSTOOLDIR) && "${PREVIOUSTOOLDIR}" != "${TOOLDIR}"
    279       1.66     lukem 	@echo "*** WARNING: TOOLDIR has moved?"
    280       1.66     lukem 	@echo "*** PREVIOUSTOOLDIR '${PREVIOUSTOOLDIR}'"
    281       1.66     lukem 	@echo "***     !=  TOOLDIR '${TOOLDIR}'"
    282       1.66     lukem 	@echo "*** Cleaning mis-matched tools"
    283       1.66     lukem 	rm -f PREVIOUSTOOLDIR
    284      1.106     freza 	(cd ${.CURDIR} && ${MAKE} PREVIOUSTOOLDIR=${TOOLDIR} cleandir)
    285       1.66     lukem .endif
    286      1.102      tron 	echo ${TOOLDIR} >PREVIOUSTOOLDIR
    287       1.66     lukem 
    288       1.69      tron cleandir:
    289       1.69      tron 	rm -f ${CLEANFILES}
    290