Home | History | Annotate | Line # | Download | only in sets
Makefile revision 1.84.8.1
      1  1.84.8.1       tls #	$NetBSD: Makefile,v 1.84.8.1 2013/02/25 00:24:29 tls Exp $
      2      1.81  uebayasi 
      3      1.81  uebayasi # Experimental RCS METALOG versioning
      4      1.81  uebayasi # (Needs host's rcs(1) commands)
      5      1.83  uebayasi #
      6      1.83  uebayasi # TODO:
      7      1.83  uebayasi # - In 'build.sh distribution', print diff to previous
      8      1.81  uebayasi #RCSMETALOG=1
      9       1.1   thorpej 
     10       1.1   thorpej # The `all' target must appear before bsd.own.mk is pulled in.
     11       1.1   thorpej all:
     12       1.1   thorpej 	@echo "Please understand what you are doing, first."
     13       1.1   thorpej 	@false
     14       1.1   thorpej 
     15       1.1   thorpej .include <bsd.own.mk>
     16      1.15     lukem .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
     17       1.1   thorpej 
     18      1.80       mrg .if ${USE_PIGZGZIP} != "no"
     19      1.80       mrg COMPRESS_PROGRAM=${TOOL_PIGZ:Q}
     20      1.80       mrg .else
     21      1.80       mrg COMPRESS_PROGRAM=gzip
     22      1.80       mrg .endif
     23      1.80       mrg 
     24      1.78  uebayasi SETSENV=	DESTDIR=${DESTDIR:Q} \
     25      1.76  uebayasi 		MACHINE=${MACHINE:Q} \
     26      1.76  uebayasi 		MACHINE_ARCH=${MACHINE_ARCH:Q} \
     27      1.62       apb 		AWK=${TOOL_AWK:Q} \
     28      1.49       apb 		CKSUM=${TOOL_CKSUM:Q} \
     29      1.49       apb 		DB=${TOOL_DB:Q} \
     30      1.49       apb 		HOST_SH=${HOST_SH:Q} \
     31      1.49       apb 		MAKE=${MAKE:Q} \
     32      1.49       apb 		MKTEMP=${TOOL_MKTEMP:Q} \
     33      1.49       apb 		MTREE=${TOOL_MTREE:Q} \
     34      1.49       apb 		PAX=${TOOL_PAX:Q} \
     35      1.80       mrg 		COMPRESS_PROGRAM=${COMPRESS_PROGRAM:Q} \
     36      1.72  uebayasi 		PKG_CREATE=${TOOL_PKG_CREATE:Q} \
     37      1.63       apb 		SED=${TOOL_SED:Q} \
     38      1.78  uebayasi 		TSORT=${TSORT:Q}
     39      1.78  uebayasi SETSCMD=	cd ${.CURDIR} && \
     40      1.78  uebayasi 		${SETSENV} \
     41      1.43     lukem 		${HOST_SH}
     42      1.30      tron 
     43      1.57     lukem MAKETARS_FLAGS=
     44      1.64       mrg .if ${MKX11} != "no"
     45      1.71  uebayasi MAKESRCTARS_X11_FLAGS=	-x ${X11SRCDIR}
     46      1.71  uebayasi .endif
     47      1.71  uebayasi .if ${MKEXTSRC} != "no"
     48      1.71  uebayasi MAKESRCTARS_EXTSRC_FLAGS=	-y ${EXTSRCSRCDIR}
     49      1.71  uebayasi .endif
     50      1.71  uebayasi .if ${MKX11} != "no"
     51      1.71  uebayasi MAKEFLIST_X11_FLAGS=	,x
     52      1.71  uebayasi .endif
     53      1.71  uebayasi .if ${MKEXTSRC} != "no"
     54      1.71  uebayasi MAKEFLIST_EXTSRC_FLAGS=	,ext
     55      1.71  uebayasi .endif
     56      1.71  uebayasi MAKEFLIST_FLAGS=	-L base${MAKEFLIST_X11_FLAGS}${MAKEFLIST_EXTSRC_FLAGS}
     57      1.48       jmc MAKESRCTARS_FLAGS= 	-N ${NETBSDSRCDIR}/etc
     58      1.40     lukem 
     59      1.65       apb .if ${MAKEVERBOSE} < 2
     60      1.57     lukem MAKETARS_FLAGS+=	-q
     61      1.57     lukem MAKESRCTARS_FLAGS+= 	-q
     62      1.57     lukem .endif
     63      1.57     lukem 
     64      1.33       jmc .if !defined(MAKETARSETS)
     65      1.43     lukem MAKETARSETS!= ${SETSCMD} ./makeflist -l ${MAKEFLIST_FLAGS}
     66      1.33       jmc .endif
     67      1.33       jmc 
     68      1.52       mrg print_have_gcc: .PHONY
     69      1.52       mrg 	@echo ${HAVE_GCC}
     70       1.6     lukem 
     71       1.3   thorpej print_machine: .PHONY
     72       1.3   thorpej 	@echo ${MACHINE}
     73       1.3   thorpej 
     74       1.3   thorpej print_machine_arch: .PHONY
     75       1.3   thorpej 	@echo ${MACHINE_ARCH}
     76       1.3   thorpej 
     77       1.3   thorpej print_machine_cpu: .PHONY
     78       1.3   thorpej 	@echo ${MACHINE_CPU}
     79       1.3   thorpej 
     80       1.3   thorpej print_object_fmt: .PHONY
     81       1.3   thorpej 	@echo ${OBJECT_FMT}
     82       1.3   thorpej 
     83      1.17     lukem print_toolchain_missing: .PHONY
     84      1.17     lukem 	@echo "${TOOLCHAIN_MISSING}"
     85      1.29       mrg 
     86      1.78  uebayasi print_mkvars \
     87      1.78  uebayasi print_set_lists_base print_set_lists_x print_set_lists_ext \
     88      1.78  uebayasi list_set_lists_base list_set_lists_x list_set_lists_ext \
     89      1.78  uebayasi list_set_files_base list_set_files_x list_set_files_ext \
     90      1.78  uebayasi 		: .PHONY
     91      1.78  uebayasi 	@${SETSENV}; rundir="${.CURDIR}"; . ./sets.subr; ${.TARGET}
     92      1.74  uebayasi 
     93       1.1   thorpej #
     94      1.67       apb # METALOG MANIPULATION TARGETS
     95      1.67       apb #
     96      1.67       apb # METALOG is the name of a metadata log file, and is set in <bsd.own.mk>
     97      1.67       apb # if MKUNPRIVED is not "no".
     98      1.67       apb #
     99      1.67       apb # METALOG.unpriv is a command line option passed to various scripts;
    100      1.67       apb # it is either blank or "-M ${METALOG}.sanitised", depending on the
    101      1.67       apb # MKUNPRIVED flag.
    102      1.67       apb #
    103      1.67       apb # The sanitise_METALOG target creates METALOG.sanitised from METALOG,
    104      1.67       apb # without modifying METALOG itself.  METALOG.sanitised is sorted, and
    105      1.67       apb # has duplicates merged.  This is used near the end of a build, after
    106      1.67       apb # build products have been installed in DESTDIR and corresponding lines
    107      1.67       apb # have been added to METALOG, but before METALOG.sanitised is used in
    108      1.67       apb # the creation of sets in RELEASEDIR.
    109      1.67       apb #
    110      1.67       apb # The clean_METALOG either deletes METALOG or replaces METALOG with
    111      1.67       apb # a sanitised version of itself, depending on the MKUPDATE flag, and
    112      1.67       apb # deletes old METALOG.* files.  This is intended to be used at the start
    113      1.67       apb # of a build, to ensure that repeated MKUPDATE builds do not cause
    114      1.67       apb # unbounded growth of METALOG.
    115       1.1   thorpej #
    116       1.1   thorpej 
    117      1.27     lukem .if ${MKUNPRIVED} == "no"
    118      1.27     lukem METALOG.unpriv=
    119      1.49       apb sanitise_METALOG: .PHONY
    120      1.49       apb 	@true
    121      1.67       apb clean_METALOG: .PHONY
    122      1.67       apb 	@true
    123      1.67       apb .else	# MKUNPRIVED
    124      1.67       apb METALOG.unpriv= -M ${METALOG}.sanitised
    125      1.67       apb sanitise_METALOG: .PHONY ${METALOG}.sanitised
    126      1.67       apb ${METALOG}.sanitised: ${METALOG}
    127  1.84.8.1       tls # We keep only the last entry for update builds, but for clean builds we
    128  1.84.8.1       tls # want to make sure we install files only once.
    129  1.84.8.1       tls .if ${MKUPDATE} != "no"
    130  1.84.8.1       tls 	${TOOL_AWK} \
    131  1.84.8.1       tls 	    '{ a[$$1] = $$0; } END { for (f in a) print a[f]; }' ${METALOG} | \
    132  1.84.8.1       tls 	    sort | ${TOOL_MTREE} -CSM -k all -N ${NETBSDSRCDIR}/etc \
    133      1.67       apb 	    >${METALOG}.new
    134  1.84.8.1       tls .else
    135  1.84.8.1       tls 	    sort ${METALOG} | ${TOOL_MTREE} -CSM -k all -N ${NETBSDSRCDIR}/etc \
    136  1.84.8.1       tls 	    >${METALOG}.new
    137  1.84.8.1       tls .endif
    138      1.67       apb 	mv ${METALOG}.new ${METALOG}.sanitised
    139      1.81  uebayasi .if defined(RCSMETALOG)
    140      1.81  uebayasi 	. ./metalog.subr; \
    141      1.81  uebayasi 	xrcs_descr="build distribution METALOG"; \
    142      1.81  uebayasi 	xrcs_msg="$$(date)"; \
    143      1.81  uebayasi 	xrcs_cur=${METALOG}.sanitised; \
    144      1.81  uebayasi 	xrcs update
    145      1.81  uebayasi .endif
    146      1.67       apb .if ${MKUPDATE} == "no" || !exists(${METALOG})
    147      1.67       apb clean_METALOG: .PHONY
    148      1.67       apb 	rm -f ${METALOG} ${METALOG}.*
    149      1.67       apb .else	# MKUPDATE
    150      1.67       apb clean_METALOG: .PHONY ${METALOG}.sanitised
    151      1.67       apb 	mv ${METALOG}.sanitised ${METALOG}
    152      1.81  uebayasi .if defined(RCSMETALOG)
    153      1.82  uebayasi 	[ -f ${METALOG}.sanitised,v ] && mv ${METALOG}.sanitised,v ${METALOG},v
    154      1.81  uebayasi .endif
    155      1.67       apb 	rm -f ${METALOG}.*
    156      1.81  uebayasi .if defined(RCSMETALOG)
    157      1.82  uebayasi 	[ -f ${METALOG},v ] && mv ${METALOG},v ${METALOG}.sanitised,v
    158      1.81  uebayasi .endif
    159      1.67       apb .endif	# MKUPDATE
    160      1.67       apb .endif	# MKUNPRIVED
    161      1.67       apb 
    162      1.67       apb #
    163      1.67       apb # FILE LIST TARGETS
    164      1.67       apb #
    165      1.67       apb 
    166      1.67       apb # This target has debugging value only, really.
    167      1.67       apb makeflist: .PHONY .PRECIOUS check_DESTDIR
    168      1.67       apb 	${SETSCMD} ./makeflist ${MAKEFLIST_FLAGS}
    169      1.67       apb 
    170      1.67       apb checkflist: .PRECIOUS .PHONY check_DESTDIR sanitise_METALOG
    171      1.67       apb 	${SETSCMD} ${.CURDIR}/checkflist \
    172      1.67       apb 	    ${MAKEFLIST_FLAGS} ${CHECKFLIST_FLAGS} ${METALOG.unpriv}
    173      1.67       apb 
    174      1.67       apb checkflist-x11: .PHONY check_DESTDIR
    175      1.67       apb 	${SETSCMD} ./checkflist -x ${CHECKFLIST_FLAGS}
    176      1.49       apb 
    177      1.71  uebayasi checkflist-extsrc: .PHONY check_DESTDIR
    178      1.71  uebayasi 	${SETSCMD} ./checkflist -y ${CHECKFLIST_FLAGS}
    179      1.71  uebayasi 
    180      1.49       apb .if defined(DESTDIR) && ${DESTDIR} != ""
    181      1.49       apb checkflist_if_DESTDIR: checkflist
    182      1.49       apb .else
    183      1.49       apb checkflist_if_DESTDIR:
    184      1.49       apb .endif
    185      1.43     lukem 
    186      1.67       apb #
    187      1.67       apb # SET BUILDING TARGETS
    188      1.67       apb #
    189      1.43     lukem 
    190      1.67       apb TARDIR=		${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets
    191      1.67       apb SOURCETARDIR=	${RELEASEDIR}/source/sets
    192       1.1   thorpej 
    193      1.58       apb # If MAKETARS_SERIAL is set to "YES" or "yes", then the tar sets will be
    194      1.58       apb # made in series, even if make's "-j" flag requests multiple parallel
    195      1.58       apb # jobs.  This is useful on systems that exhibit poor performance when
    196      1.58       apb # running multiple parallel disk-intensive operations.  The default is
    197      1.58       apb # MAKETARS_SERIAL=NO, which will obey the "-j" flag passed to the make
    198      1.58       apb # command.
    199      1.58       apb #
    200      1.58       apb MAKETARS_SERIAL?= NO
    201      1.58       apb .if empty(MAKETARS_SERIAL:M[Yy][Ee][Ss])
    202      1.58       apb _MAKETARS_WAIT= # empty
    203      1.58       apb .else
    204      1.58       apb _MAKETARS_WAIT= .WAIT
    205      1.58       apb .endif
    206      1.58       apb 
    207      1.49       apb maketars: .PRECIOUS .PHONY check_DESTDIR check_RELEASEDIR \
    208      1.49       apb 		sanitise_METALOG checkflist_if_DESTDIR .WAIT \
    209      1.58       apb 		maketarsetup .WAIT \
    210      1.58       apb 		${MAKETARSETS:@.TARS.@${_MAKETARS_WAIT} do-${.TARS.}@}
    211      1.33       jmc 	@true
    212      1.33       jmc 
    213      1.43     lukem maketarsetup: .EXEC
    214      1.23     veego .if defined(DESTDIR) && ${DESTDIR} != ""
    215      1.43     lukem 	${_MKMSG} "execute  checkflist"
    216      1.32     lukem 	${MAKE} checkflist
    217      1.16     lukem .endif
    218      1.43     lukem 	mkdir -p ${TARDIR}
    219      1.70       snj 	for i in MD5 SHA512; do \
    220      1.43     lukem 		rm -f ${TARDIR}/$$i ${TARDIR}/$$i.tmp; \
    221      1.43     lukem 	done
    222      1.43     lukem 
    223      1.67       apb makesetfiles: .PHONY sanitise_METALOG
    224      1.43     lukem 	${_MKMSG_CREATE} "set lists"
    225      1.67       apb 	${SETSCMD} ./maketars -S -d ${DESTDIR:S,^$,/,} ${MAKETARS_FLAGS} \
    226      1.67       apb 	    ${METALOG.unpriv} \
    227      1.43     lukem 	    -N ${NETBSDSRCDIR}/etc ${MAKEFLIST_FLAGS} -t ${TARDIR}
    228      1.43     lukem 
    229      1.33       jmc .for tar in ${MAKETARSETS}
    230      1.55       apb do-${tar}: .PHONY sanitise_METALOG
    231      1.57     lukem 	${_MKMSG_CREATE} "${tar}.tgz"
    232      1.57     lukem 	${SETSCMD} ./maketars -d ${DESTDIR:S,^$,/,} ${MAKETARS_FLAGS} \
    233      1.67       apb 	    ${METALOG.unpriv} \
    234      1.43     lukem 	    -N ${NETBSDSRCDIR}/etc -t ${TARDIR} ${tar} \
    235      1.69       apb 	|| { rm -f ${TARDIR}/${tar}.tgz; false; }
    236      1.33       jmc .endfor
    237       1.1   thorpej 
    238      1.43     lukem 
    239      1.41     lukem makesrctars: .PRECIOUS .PHONY check_RELEASEDIR
    240      1.57     lukem 	${_MKMSG_CREATE} "source tar files"
    241      1.43     lukem 	mkdir -p ${SOURCETARDIR}
    242      1.45     lukem 	${SETSCMD} ./makesrctars ${MAKESRCTARS_FLAGS} \
    243      1.71  uebayasi 	    ${MAKESRCTARS_X11_FLAGS} ${MAKESRCTARS_EXTSRC_FLAGS} \
    244      1.45     lukem 	    ${NETBSDSRCDIR} ${SOURCETARDIR}
    245      1.43     lukem 
    246      1.25     lukem 
    247      1.41     lukem makesums: .PRECIOUS .PHONY check_RELEASEDIR .WAIT \
    248      1.41     lukem 		${MAKETARSETS:@.TARS.@do-sum-${.TARS.}@}
    249      1.70       snj 	for i in MD5 SHA512; do \
    250      1.43     lukem 		mv ${TARDIR}/$$i.tmp ${TARDIR}/$$i; \
    251      1.43     lukem 	done
    252      1.33       jmc 
    253      1.33       jmc .for tar in ${MAKETARSETS}
    254      1.39       jmc do-sum-${tar}: .PHONY do-${tar}
    255      1.57     lukem 	${_MKMSG_CREATE} "${tar} checksums"
    256      1.43     lukem 	${MAKESUMS} -t ${TARDIR} ${tar}.tgz
    257      1.70       snj 	for i in MD5 SHA512; do \
    258      1.43     lukem 		${TOOL_CAT} ${TARDIR}/$$i >> ${TARDIR}/$$i.tmp; \
    259      1.35       jmc 	done
    260      1.33       jmc .endfor
    261      1.37       jmc .ORDER: ${MAKETARSETS:@.TARS.@do-sum-${.TARS.}@}
    262      1.18     lukem 
    263      1.43     lukem 
    264      1.49       apb installsets: .PHONY check_DESTDIR sanitise_METALOG
    265      1.18     lukem .if !defined(INSTALLDIR)
    266      1.18     lukem 	@echo "setenv INSTALLDIR before doing that!"
    267      1.18     lukem 	@false
    268      1.18     lukem .endif
    269      1.57     lukem 	${SETSCMD} ./maketars -d ${DESTDIR:S,^$,/,} ${MAKETARS_FLAGS} \
    270      1.67       apb 	    ${METALOG.unpriv} -N ${NETBSDSRCDIR}/etc \
    271      1.49       apb 	    ${MAKEFLIST_FLAGS} -i ${INSTALLDIR} ${INSTALLSETS}
    272      1.49       apb 
    273      1.49       apb # Should we ignore errors like extra or missing files in the flists?
    274      1.49       apb SLOPPY_FLIST?= NO
    275      1.49       apb .if !empty(SLOPPY_FLIST:M[Yy][Ee][Ss])
    276      1.49       apb CHECKFLIST_FLAGS+=	-e -m
    277      1.49       apb REGPKG.sloppy=		-m
    278      1.49       apb .endif
    279       1.1   thorpej 
    280      1.49       apb .if ${MAKEVERBOSE} == 0
    281      1.49       apb REGPKG.verbose?= -q
    282      1.49       apb .elif ${MAKEVERBOSE} == 1
    283      1.49       apb REGPKG.verbose?=
    284      1.65       apb .else	# MAKEVERBOSE >= 2
    285      1.49       apb REGPKG.verbose?= -v
    286      1.49       apb .endif
    287      1.49       apb REGPKG.force?=		# -f, or empty
    288      1.49       apb REGPKG.cache?= -c	# -c, or empty
    289      1.49       apb REGPKG.update:= ${MKUPDATE:tl:Nno:C/..*/-u/}
    290      1.49       apb SYSPKGSETS?= all
    291      1.49       apb makesyspkgs: .PHONY check_DESTDIR check_RELEASEDIR \
    292      1.49       apb 		sanitise_METALOG checkflist_if_DESTDIR
    293      1.59      matt 	mkdir -p ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/syspkgs
    294      1.49       apb 	${SETSCMD} ${.CURDIR}/regpkgset \
    295      1.49       apb 	    ${REGPKG.verbose} ${REGPKG.force} ${REGPKG.sloppy} \
    296      1.49       apb 	    ${REGPKG.cache} ${REGPKG.update} \
    297      1.67       apb 	    -d ${DESTDIR:S,^$,/,} ${METALOG.unpriv} \
    298      1.49       apb 	    -N ${NETBSDSRCDIR}/etc \
    299      1.59      matt 	    -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/syspkgs ${SYSPKGSETS}
    300      1.49       apb 
    301      1.49       apb makesyspkgsums: .PHONY check_RELEASEDIR
    302      1.59      matt 	${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/syspkgs
    303      1.43     lukem 
    304      1.50       apb # Update the "deps" file.
    305      1.50       apb # XXX: Why is "deps" checked in to the source tree, instead of
    306      1.50       apb # just being created as necessary?
    307      1.50       apb makedeps: .PHONY
    308      1.50       apb 	${SETSCMD} ./syspkgdeps all >${.CURDIR}/deps
    309      1.50       apb 
    310       1.1   thorpej #
    311       1.1   thorpej # MAIN ENTRY POINTS
    312       1.1   thorpej #
    313       1.1   thorpej 
    314      1.49       apb syspkgs: .PHONY makesyspkgs .WAIT makesyspkgsums
    315      1.49       apb 	@true
    316      1.49       apb 
    317      1.41     lukem sets: .PHONY maketars .WAIT makesums
    318      1.25     lukem 	@true
    319      1.25     lukem 
    320      1.41     lukem sourcesets: .PHONY makesrctars
    321       1.1   thorpej 	@true
    322       1.8     lukem 
    323       1.8     lukem .include <bsd.sys.mk>
    324