svn commit: r215226 - in head: rescue/rescue share/mk

Adrian Chadd adrian at freebsd.org
Tue Nov 16 22:39:39 UTC 2010


This has apparently broken symlink generation. I thought I had tested
that locally. Grr.

In any case, I'll investigate this over the weekend. I have an exam tomorrow.

Thanks,


Adrian

On 13 November 2010 11:11, Adrian Chadd <adrian at freebsd.org> wrote:
>
> Author: adrian
> Date: Sat Nov 13 03:11:27 2010
> New Revision: 215226
> URL: http://svn.freebsd.org/changeset/base/215226
>
> Log:
>  Break out the rules which generate crunchgen'ed binaries into a separate
>  .mk file so they can be reused.
>
>  Introduce a new option, CRUNCH_BUILDTOOLS, which lists the binaries that
>  require tools built in the local architecture. sh and csh both require this.
>  It was previously hardcoded in rescue/rescue/Makefile .
>
>  Introduce a new option, CRUNCH_SHLIBS, which lists the shared libraries
>  to link against. These override the static libraries listed in CRUNCH_LIBS.
>  Some build environments may wish to use a handful of shared libraries
>  (eg libc.so) so other small, dynamic binaries can be run in the environment.
>
>  Remove the now-shared code from rescue/rescue/Makefile and introduce the
>  CRUNCH_BUILDTOOLS option for the above shells.
>
> Added:
>  head/share/mk/bsd.crunchgen.mk   (contents, props changed)
> Modified:
>  head/rescue/rescue/Makefile
>
> Modified: head/rescue/rescue/Makefile
> ==============================================================================
> --- head/rescue/rescue/Makefile Sat Nov 13 01:28:56 2010        (r215225)
> +++ head/rescue/rescue/Makefile Sat Nov 13 03:11:27 2010        (r215226)
> @@ -22,27 +22,7 @@ dhclient_FIXED: ../../sbin/dhclient/dhcl
>        sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET}
>  CLEANFILES+= dhclient_FIXED
>
> -#################################################################
> -#
> -# General notes:
> -#
> -# A number of Make variables are used to generate the crunchgen config file.
> -#
> -#  CRUNCH_SRCDIRS: lists directories to search for included programs
> -#  CRUNCH_PROGS:  lists programs to be included
> -#  CRUNCH_LIBS:  libraries to link with
> -#  CRUNCH_BUILDOPTS: generic build options to be added to every program
> -#
> -# Special options can be specified for individual programs
> -#  CRUNCH_SRCDIR_$(P): base source directory for program $(P)
> -#  CRUNCH_BUILDOPTS_$(P): additional build options for $(P)
> -#  CRUNCH_ALIAS_$(P): additional names to be used for $(P)
> -#
> -# By default, any name appearing in CRUNCH_PROGS or CRUNCH_ALIAS_${P}
> -# will be used to generate a hard link to the resulting binary.
> -# Specific links can be suppressed by setting
> -# CRUNCH_SUPPRESS_LINK_$(NAME) to 1.
> -#
> +# The help which used to be here is now in mk/bsd.crunchgen.mk
>
>  # Define Makefile variable RESCUE
>  CRUNCH_BUILDOPTS+= -DRESCUE
> @@ -73,6 +53,7 @@ CRUNCH_PROGS_bin= cat chflags chio chmod
>         ed expr getfacl hostname kenv kill ln ls mkdir mv      \
>         pkill ps pwd realpath rm rmdir setfacl sh stty sync test
>  CRUNCH_LIBS+= -lcrypt -ledit -lkvm -ll -ltermcap -lutil
> +CRUNCH_BUILDTOOLS+= bin/sh
>
>  # Additional options for specific programs
>  CRUNCH_ALIAS_test= [
> @@ -91,6 +72,7 @@ CRUNCH_PROGS_bin+= rcp
>  .if ${MK_TCSH} != "no"
>  CRUNCH_PROGS_bin+= csh
>  CRUNCH_ALIAS_csh= -csh tcsh -tcsh
> +CRUNCH_BUILDTOOLS+= bin/csh
>  CRUNCH_SUPPRESS_LINK_-csh= 1
>  CRUNCH_SUPPRESS_LINK_-tcsh= 1
>  .endif
> @@ -236,132 +218,5 @@ CRUNCH_ALIAS_chown= chgrp
>  ##################################################################
>  CRUNCH_LIBS+= -lm
>
> -##################################################################
> -#  The following is pretty nearly a generic crunchgen-handling makefile
> -#
> -
> -CONF=  $(PROG).conf
> -OUTMK= $(PROG).mk
> -OUTC=   $(PROG).c
> -OUTPUTS=$(OUTMK) $(OUTC) $(PROG).cache
> -CRUNCHOBJS= ${.OBJDIR}
> -.if defined(MAKEOBJDIRPREFIX)
> -CANONICALOBJDIR:= ${MAKEOBJDIRPREFIX}${.CURDIR}
> -.else
> -CANONICALOBJDIR:= /usr/obj${.CURDIR}
> -.endif
> -
> -CLEANFILES+= $(CONF) *.o *.lo *.c *.mk *.cache *.a *.h
> -
> -# Program names and their aliases contribute hardlinks to 'rescue' executable,
> -# except for those that get suppressed.
> -.for D in $(CRUNCH_SRCDIRS)
> -.for P in $(CRUNCH_PROGS_$(D))
> -.ifdef CRUNCH_SRCDIR_${P}
> -$(OUTPUTS): $(CRUNCH_SRCDIR_${P})/Makefile
> -.else
> -$(OUTPUTS): $(.CURDIR)/../../$(D)/$(P)/Makefile
> -.endif
> -.ifndef CRUNCH_SUPPRESS_LINK_${P}
> -LINKS+= $(BINDIR)/$(PROG) $(BINDIR)/$(P)
> -.endif
> -.for A in $(CRUNCH_ALIAS_$(P))
> -.ifndef CRUNCH_SUPPRESS_LINK_${A}
> -LINKS+= $(BINDIR)/$(PROG) $(BINDIR)/$(A)
> -.endif
> -.endfor
> -.endfor
> -.endfor
> -
> -all: $(PROG)
> -exe: $(PROG)
> -
> -$(CONF): Makefile
> -       echo \# Auto-generated, do not edit >$(.TARGET)
> -.ifdef CRUNCH_BUILDOPTS
> -       echo buildopts $(CRUNCH_BUILDOPTS) >>$(.TARGET)
> -.endif
> -.ifdef CRUNCH_LIBS
> -       echo libs $(CRUNCH_LIBS) >>$(.TARGET)
> -.endif
> -.for D in $(CRUNCH_SRCDIRS)
> -.for P in $(CRUNCH_PROGS_$(D))
> -       echo progs $(P) >>$(.TARGET)
> -.ifdef CRUNCH_SRCDIR_${P}
> -       echo special $(P) srcdir $(CRUNCH_SRCDIR_${P}) >>$(.TARGET)
> -.else
> -       echo special $(P) srcdir $(.CURDIR)/../../$(D)/$(P) >>$(.TARGET)
> -.endif
> -.ifdef CRUNCH_BUILDOPTS_${P}
> -       echo special $(P) buildopts DIRPRFX=${DIRPRFX}${P}/ \
> -           $(CRUNCH_BUILDOPTS_${P}) >>$(.TARGET)
> -.else
> -       echo special $(P) buildopts DIRPRFX=${DIRPRFX}${P}/ >>$(.TARGET)
> -.endif
> -.for A in $(CRUNCH_ALIAS_$(P))
> -       echo ln $(P) $(A) >>$(.TARGET)
> -.endfor
> -.endfor
> -.endfor
> -
> -# XXX Make sure we don't pass -P to crunchgen(1).
> -.MAKEFLAGS:= ${.MAKEFLAGS:N-P}
> -.ORDER: $(OUTPUTS) objs
> -$(OUTPUTS): $(CONF)
> -       MAKEOBJDIRPREFIX=${CRUNCHOBJS} crunchgen -fq -m $(OUTMK) \
> -           -c $(OUTC) $(CONF)
> -
> -$(PROG): $(OUTPUTS) objs
> -       MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} -f $(OUTMK) exe
> -
> -objs: $(OUTMK)
> -       MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} -f $(OUTMK) objs
> -
> -# <sigh> Someone should replace the bin/csh and bin/sh build-tools with
> -# shell scripts so we can remove this nonsense.
> -build-tools:
> -.for _tool in bin/csh bin/sh
> -       cd $(.CURDIR)/../../${_tool}; \
> -       MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} obj; \
> -       MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} build-tools
> -.endfor
> -
> -# Use a separate build tree to hold files compiled for this crunchgen binary
> -# Yes, this does seem to partly duplicate bsd.subdir.mk, but I can't
> -# get that to cooperate with bsd.prog.mk.  Besides, many of the standard
> -# targets should NOT be propagated into the components.
> -cleandepend cleandir obj objlink:
> -.for D in $(CRUNCH_SRCDIRS)
> -.for P in $(CRUNCH_PROGS_$(D))
> -.ifdef CRUNCH_SRCDIR_${P}
> -       cd ${CRUNCH_SRCDIR_$(P)} && \
> -           MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
> -           DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${.TARGET}
> -.else
> -       cd $(.CURDIR)/../../${D}/${P} && \
> -           MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
> -           DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${.TARGET}
> -.endif
> -.endfor
> -.endfor
> -
> -clean:
> -       rm -f ${CLEANFILES}
> -       if [ -e ${.OBJDIR}/$(OUTMK) ]; then                             \
> -               MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} -f $(OUTMK) clean;       \
> -       fi
> -.for D in $(CRUNCH_SRCDIRS)
> -.for P in $(CRUNCH_PROGS_$(D))
> -.ifdef CRUNCH_SRCDIR_${P}
> -       cd ${CRUNCH_SRCDIR_$(P)} && \
> -           MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
> -           DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${.TARGET}
> -.else
> -       cd $(.CURDIR)/../../${D}/${P} && \
> -           MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
> -           DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${.TARGET}
> -.endif
> -.endfor
> -.endfor
> -
> +.include <bsd.crunchgen.mk>
>  .include <bsd.prog.mk>
>
> Added: head/share/mk/bsd.crunchgen.mk
> ==============================================================================
> --- /dev/null   00:00:00 1970   (empty, because file is newly added)
> +++ head/share/mk/bsd.crunchgen.mk      Sat Nov 13 03:11:27 2010        (r215226)
> @@ -0,0 +1,160 @@
> +#################################################################
> +#
> +# General notes:
> +#
> +# A number of Make variables are used to generate the crunchgen config file.
> +#
> +#  CRUNCH_SRCDIRS: lists directories to search for included programs
> +#  CRUNCH_PROGS:  lists programs to be included
> +#  CRUNCH_LIBS:  libraries to statically link with
> +#  CRUNCH_SHLIBS:  libraries to dynamically link with
> +#  CRUNCH_BUILDOPTS: generic build options to be added to every program
> +#  CRUNCH_BUILDTOOLS: lists programs that need build tools built in the
> +#       local architecture.
> +#
> +# Special options can be specified for individual programs
> +#  CRUNCH_SRCDIR_$(P): base source directory for program $(P)
> +#  CRUNCH_BUILDOPTS_$(P): additional build options for $(P)
> +#  CRUNCH_ALIAS_$(P): additional names to be used for $(P)
> +#
> +# By default, any name appearing in CRUNCH_PROGS or CRUNCH_ALIAS_${P}
> +# will be used to generate a hard link to the resulting binary.
> +# Specific links can be suppressed by setting
> +# CRUNCH_SUPPRESS_LINK_$(NAME) to 1.
> +#
> +
> +# $FreeBSD$
> +
> +##################################################################
> +#  The following is pretty nearly a generic crunchgen-handling makefile
> +#
> +
> +CONF=  $(PROG).conf
> +OUTMK= $(PROG).mk
> +OUTC=   $(PROG).c
> +OUTPUTS=$(OUTMK) $(OUTC) $(PROG).cache
> +CRUNCHOBJS= ${.OBJDIR}
> +.if defined(MAKEOBJDIRPREFIX)
> +CANONICALOBJDIR:= ${MAKEOBJDIRPREFIX}${.CURDIR}
> +.else
> +CANONICALOBJDIR:= /usr/obj${.CURDIR}
> +.endif
> +
> +CLEANFILES+= $(CONF) *.o *.lo *.c *.mk *.cache *.a *.h
> +
> +# Program names and their aliases contribute hardlinks to 'rescue' executable,
> +# except for those that get suppressed.
> +.for D in $(CRUNCH_SRCDIRS)
> +.for P in $(CRUNCH_PROGS_$(D))
> +.ifdef CRUNCH_SRCDIR_${P}
> +$(OUTPUTS): $(CRUNCH_SRCDIR_${P})/Makefile
> +.else
> +$(OUTPUTS): $(.CURDIR)/../../$(D)/$(P)/Makefile
> +.endif
> +# Disable building links for bsdbox - whatever is installing the binaries into
> +# the embedded system should (for now) do the linking there. This may change
> +# in the future. -adrian
> +#.ifndef CRUNCH_SUPPRESS_LINK_${P}
> +#LINKS+= $(BINDIR)/$(PROG) $(BINDIR)/$(P)
> +#.endif
> +#.for A in $(CRUNCH_ALIAS_$(P))
> +#.ifndef CRUNCH_SUPPRESS_LINK_${A}
> +#LINKS+= $(BINDIR)/$(PROG) $(BINDIR)/$(A)
> +#.endif
> +#.endfor
> +.endfor
> +.endfor
> +
> +all: $(PROG)
> +exe: $(PROG)
> +
> +$(CONF): Makefile
> +       echo \# Auto-generated, do not edit >$(.TARGET)
> +.ifdef CRUNCH_BUILDOPTS
> +       echo buildopts $(CRUNCH_BUILDOPTS) >>$(.TARGET)
> +.endif
> +.ifdef CRUNCH_LIBS
> +       echo libs $(CRUNCH_LIBS) >>$(.TARGET)
> +.endif
> +.ifdef CRUNCH_SHLIBS
> +       echo libs_so $(CRUNCH_SHLIBS) >>$(.TARGET)
> +.endif
> +.for D in $(CRUNCH_SRCDIRS)
> +.for P in $(CRUNCH_PROGS_$(D))
> +       echo progs $(P) >>$(.TARGET)
> +.ifdef CRUNCH_SRCDIR_${P}
> +       echo special $(P) srcdir $(CRUNCH_SRCDIR_${P}) >>$(.TARGET)
> +.else
> +       echo special $(P) srcdir $(.CURDIR)/../../$(D)/$(P) >>$(.TARGET)
> +.endif
> +.ifdef CRUNCH_BUILDOPTS_${P}
> +       echo special $(P) buildopts DIRPRFX=${DIRPRFX}${P}/ \
> +           $(CRUNCH_BUILDOPTS_${P}) >>$(.TARGET)
> +.else
> +       echo special $(P) buildopts DIRPRFX=${DIRPRFX}${P}/ >>$(.TARGET)
> +.endif
> +.for A in $(CRUNCH_ALIAS_$(P))
> +       echo ln $(P) $(A) >>$(.TARGET)
> +.endfor
> +.endfor
> +.endfor
> +
> +# XXX Make sure we don't pass -P to crunchgen(1).
> +.MAKEFLAGS:= ${.MAKEFLAGS:N-P}
> +.ORDER: $(OUTPUTS) objs
> +$(OUTPUTS): $(CONF)
> +       MAKEOBJDIRPREFIX=${CRUNCHOBJS} crunchgen -fq -m $(OUTMK) \
> +           -c $(OUTC) $(CONF)
> +
> +$(PROG): $(OUTPUTS) objs
> +       MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} -f $(OUTMK) exe
> +
> +objs: $(OUTMK)
> +       MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} -f $(OUTMK) objs
> +
> +# <sigh> Someone should replace the bin/csh and bin/sh build-tools with
> +# shell scripts so we can remove this nonsense.
> +build-tools:
> +.for _tool in $(CRUNCH_BUILDTOOLS)
> +       cd $(.CURDIR)/../../${_tool}; \
> +       MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} obj; \
> +       MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} build-tools
> +.endfor
> +
> +# Use a separate build tree to hold files compiled for this crunchgen binary
> +# Yes, this does seem to partly duplicate bsd.subdir.mk, but I can't
> +# get that to cooperate with bsd.prog.mk.  Besides, many of the standard
> +# targets should NOT be propagated into the components.
> +cleandepend cleandir obj objlink:
> +.for D in $(CRUNCH_SRCDIRS)
> +.for P in $(CRUNCH_PROGS_$(D))
> +.ifdef CRUNCH_SRCDIR_${P}
> +       cd ${CRUNCH_SRCDIR_$(P)} && \
> +           MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
> +           DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${.TARGET}
> +.else
> +       cd $(.CURDIR)/../../${D}/${P} && \
> +           MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
> +           DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${.TARGET}
> +.endif
> +.endfor
> +.endfor
> +
> +clean:
> +       rm -f ${CLEANFILES}
> +       if [ -e ${.OBJDIR}/$(OUTMK) ]; then                             \
> +               MAKEOBJDIRPREFIX=${CRUNCHOBJS} ${MAKE} -f $(OUTMK) clean;       \
> +       fi
> +.for D in $(CRUNCH_SRCDIRS)
> +.for P in $(CRUNCH_PROGS_$(D))
> +.ifdef CRUNCH_SRCDIR_${P}
> +       cd ${CRUNCH_SRCDIR_$(P)} && \
> +           MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
> +           DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${.TARGET}
> +.else
> +       cd $(.CURDIR)/../../${D}/${P} && \
> +           MAKEOBJDIRPREFIX=${CANONICALOBJDIR} ${MAKE} \
> +           DIRPRFX=${DIRPRFX}${P}/ ${CRUNCH_BUILDOPTS} ${.TARGET}
> +.endif
> +.endfor
> +.endfor


More information about the svn-src-all mailing list