Home | History | Annotate | Line # | Download | only in mtree
      1  1.48     lukem #	$NetBSD: Makefile,v 1.48 2022/08/21 07:10:03 lukem Exp $
      2   1.6       mrg 
      3   1.6       mrg .include <bsd.own.mk>
      4   1.6       mrg 
      5  1.41       mrg EXTRA_DIST_FILES=	NetBSD.dist.machine	# autogenerated
      6  1.41       mrg 
      7   1.6       mrg .if ${MKX11} != "no"
      8  1.41       mrg EXTRA_DIST_FILES+=	NetBSD.dist.Xorg
      9   1.6       mrg .endif
     10   1.6       mrg 
     11  1.40       mrg # Derived from MACHINE_CPU, but keeping 32/64bit for most.
     12  1.45  christos MTREE_MACHINE_ARCH=${MACHINE_ARCH:C/mipse[bl]/mips/:C/mipsn?64e[bl]/mips64/:C/sh3e[bl]/sh3/:S/coldfire/m68k/:S/m68000/m68k/:C/e?arm.*/arm/:S/aarch64eb/aarch64/:S/or1knd/or1k/}
     13  1.40       mrg 
     14  1.40       mrg # The compat specific files
     15  1.40       mrg 
     16  1.28    martin .if defined(MKCOMPAT) && ${MKCOMPAT} != "no"
     17  1.25      matt .include "${NETBSDSRCDIR}/compat/archdirs.mk"
     18  1.40       mrg .if exists(NetBSD.compat.${MTREE_MACHINE_ARCH})
     19  1.40       mrg EXTRA_DIST_FILES+=	NetBSD.compat.${MTREE_MACHINE_ARCH}
     20  1.13       mrg .endif
     21  1.25      matt EXTRA_DIST_FILES+=	NetBSD.dist.compat	# autogenerated
     22  1.29       mrg .if defined(MKCOMPATX11) && ${MKCOMPATX11} != "no" && ${MKX11} != "no"
     23  1.26      matt EXTRA_DIST_FILES+=	NetBSD.dist.xcompat	# autogenerated
     24  1.26      matt .endif
     25  1.19       mrg .endif
     26  1.13       mrg 
     27  1.40       mrg 
     28  1.40       mrg # Platform specific files.
     29  1.40       mrg # First we grab the mtree-specific, then either the MACHINE_ARCH or
     30  1.40       mrg # MACHINE_CPU files, and finally the MACHINE files, as long as they
     31  1.40       mrg # aren't the same files.
     32  1.40       mrg 
     33  1.40       mrg .if exists(NetBSD.dist.${MTREE_MACHINE_ARCH})
     34  1.40       mrg EXTRA_DIST_FILES+=	NetBSD.dist.${MTREE_MACHINE_ARCH}
     35  1.40       mrg .endif
     36  1.40       mrg 
     37  1.40       mrg .if empty(MTREE_MACHINE_ARCH:M${MACHINE_ARCH}) && \
     38  1.40       mrg     exists(NetBSD.dist.${MACHINE_ARCH})
     39  1.39       mrg EXTRA_DIST_FILES+=	NetBSD.dist.${MACHINE_ARCH}
     40  1.40       mrg .elif empty(MTREE_MACHINE_ARCH:M${MACHINE_CPU}) && \
     41  1.40       mrg     exists(NetBSD.dist.${MACHINE_CPU})
     42  1.40       mrg EXTRA_DIST_FILES+=	NetBSD.dist.${MACHINE_CPU}
     43  1.39       mrg .endif
     44  1.39       mrg 
     45  1.40       mrg .if empty(MTREE_MACHINE_ARCH:M${MACHINE}) && \
     46  1.40       mrg     exists(NetBSD.dist.${MACHINE})
     47  1.37       mrg EXTRA_DIST_FILES+=	NetBSD.dist.${MACHINE}
     48  1.37       mrg .endif
     49  1.37       mrg 
     50  1.40       mrg 
     51  1.40       mrg # The build specific files.
     52  1.40       mrg 
     53  1.18     njoly .if ${MKATF} != "no"
     54  1.33  christos EXTRA_DIST_FILES+=	NetBSD.dist.tests
     55  1.28    martin .if defined(MKCOMPATTESTS) && ${MKCOMPATTESTS} != "no"
     56  1.25      matt EXTRA_DIST_FILES+=	NetBSD.dist.tests.compat
     57  1.25      matt .endif
     58  1.18     njoly .endif
     59  1.18     njoly 
     60  1.44       roy .if ${MKDTB} != "no"
     61  1.44       roy EXTRA_DIST_FILES+=	NetBSD.dist.dtb
     62  1.44       roy .endif
     63  1.42  jmcneill 
     64  1.30       riz .if ${MKDTRACE} != "no"
     65  1.33  christos EXTRA_DIST_FILES+=	NetBSD.dist.dtrace
     66  1.30       riz .endif
     67  1.30       riz 
     68  1.38       mrg .if ${MKISCSI} != "no"
     69  1.38       mrg EXTRA_DIST_FILES+=	NetBSD.dist.iscsi
     70  1.38       mrg .endif
     71  1.38       mrg 
     72  1.22       apb NetBSD.dist:	NetBSD.dist.tmp
     73  1.22       apb 	cmp -s NetBSD.dist.tmp NetBSD.dist || { \
     74  1.14  uebayasi 		echo "Updating NetBSD.dist"; \
     75  1.22       apb 		mv NetBSD.dist.tmp NetBSD.dist; \
     76  1.14  uebayasi 	}
     77  1.35  christos # Rebuild every time
     78  1.35  christos .PHONY: NetBSD.dist.tmp
     79  1.33  christos NetBSD.dist.tmp: NetBSD.dist.base ${EXTRA_DIST_FILES}
     80  1.33  christos 	${TOOL_CAT} ${.ALLSRC} > ${.TARGET}
     81   1.1       mrg 
     82  1.41       mrg NetBSD.dist.machine:
     83  1.41       mrg 	${MKCREATE}
     84  1.41       mrg 	echo ./usr/include/${MACHINE} > ${.TARGET}
     85  1.41       mrg 
     86  1.33  christos NetBSD.dist.compat: NetBSD.dist.compat.in mkcompat.awk
     87  1.25      matt 	${MKCREATE}
     88  1.33  christos 	${TOOL_AWK} -f ${.ALLSRC:M*.awk} -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \
     89  1.33  christos 	    ${.ALLSRC:M*.in} > ${.TARGET}
     90  1.25      matt 
     91  1.33  christos NetBSD.dist.xcompat: NetBSD.dist.xcompat.in mkcompat.awk
     92  1.26      matt 	${MKCREATE}
     93  1.33  christos 	${TOOL_AWK} -f ${.ALLSRC:M*.awk} -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \
     94  1.33  christos 	    ${.ALLSRC:M*.in} > ${.TARGET}
     95  1.26      matt 
     96  1.33  christos NetBSD.dist.tests.compat: NetBSD.dist.tests mkcompattree.awk 
     97  1.25      matt 	${MKCREATE}
     98  1.36      matt 	${TOOL_AWK} -f ${.ALLSRC:M*.awk} \
     99  1.25      matt 	    -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} -v S="usr/tests" \
    100  1.33  christos 		${.ALLSRC:M*.tests} > ${.TARGET}
    101  1.25      matt 
    102   1.5     lukem CONFIGFILES=	NetBSD.dist special
    103   1.1       mrg FILESDIR=	/etc/mtree
    104   1.1       mrg 
    105   1.6       mrg # distrib-dirs --
    106   1.6       mrg #	Populate $DESTDIR with directories needed by NetBSD
    107   1.6       mrg #
    108   1.6       mrg .if ${MKUNPRIVED} == "no"
    109   1.6       mrg TOOL_MTREE.unpriv=
    110   1.6       mrg .else
    111   1.6       mrg TOOL_MTREE.unpriv=	-W
    112   1.6       mrg .endif
    113   1.6       mrg 
    114  1.17    dyoung # postinstall(8) invokes this target to produce the right
    115  1.17    dyoung # /etc/mtree/NetBSD.dist content without duplicating logic from
    116  1.17    dyoung # the Makefile.
    117  1.17    dyoung #
    118  1.33  christos emit_dist_file:	NetBSD.dist.base ${EXTRA_DIST_FILES}
    119  1.33  christos 	@cat ${.ALLSRC}
    120  1.16    dyoung 
    121  1.10  drochner distrib-dirs: .PHONY check_DESTDIR NetBSD.dist
    122   1.6       mrg .if !defined(DISTRIBUTION_DONE)						# {
    123   1.6       mrg # Create DESTDIR using HOST_INSTALL_DIR, not INSTALL_DIR, because
    124   1.6       mrg # INSTALL_DIR would want to write to the metalog, and it can't do that
    125   1.6       mrg # if the metalog is inside DESTDIR but DESTDIR doesn't yet exist.
    126   1.6       mrg 	${HOST_INSTALL_DIR} -m 755 ${DESTDIR}
    127  1.20       jym # Invoke mtree to create the directories listed in NetBSD.dist;
    128   1.6       mrg # then invoke mtree again to register those directories in the metalog.
    129   1.6       mrg 	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
    130   1.6       mrg 	    -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv}
    131   1.6       mrg .if ${MKUNPRIVED} != "no"						# {
    132   1.6       mrg 	${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \
    133   1.6       mrg 	    -p ${DESTDIR}/ -C -k all | \
    134   1.6       mrg 	    ${TOOL_AWK} '/ optional/ {next} // {print}' | ${METALOG.add}
    135   1.6       mrg .endif	# MKUNPRIVED							# }
    136   1.6       mrg .endif	# DISTRIBUTION_DONE						# }
    137   1.6       mrg 
    138  1.22       apb CLEANFILES+=	NetBSD.dist NetBSD.dist.tmp
    139  1.41       mrg CLEANFILES+=	NetBSD.dist.machine
    140  1.25      matt CLEANFILES+=	NetBSD.dist.compat
    141  1.25      matt CLEANFILES+=	NetBSD.dist.tests.compat
    142  1.10  drochner 
    143   1.1       mrg .include <bsd.prog.mk>
    144