"inline" using a variable

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

"inline" using a variable

Russell Shaw
Hi,
When i "configured" binutils in a directory separate to the source directory, it
generates a 11500 line Makefile containing the following fragment.

Down the bottom it does:

   $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage1;

but "all-stage1" is not in the Makefile. I think it's got something to do with:

stage:
        @: $(MAKE); $(stage)

but i don't understand the description below of what that does.


Fragment:

# ---------------------
# GCC bootstrap support
# ---------------------

# We track the current stage (the one in 'gcc') in the stage_current file.
# stage_last instead tracks the stage that was built last.  These targets
# are dummy when toplevel bootstrap is not active.

# While making host and target tools, symlinks to the final stage must be
# there, so $(unstage) should be run at various points.  To avoid excessive
# recursive invocations of make, we "inline" them using a variable.  These
# must be referenced as ": $(MAKE) ; $(unstage)" rather than "$(unstage)"
# to avoid warnings from the GNU Make job server.

unstage = :
stage = :
current_stage = ""


.PHONY: unstage stage
unstage:
        @: $(MAKE); $(unstage)
stage:
        @: $(MAKE); $(stage)

# Disable commands for lean bootstrap.
LEAN = false

# We name the build directories for the various stages "stage1-gcc",
# "stage2-gcc","stage3-gcc", etc.

# Since the 'compare' process will fail (on debugging information) if any
# directory names are different, we need to link the gcc directory for
# the previous stage to a constant name ('prev-gcc'), and to make the name of
# the build directories constant as well. For the latter, we use naked names
# like 'gcc', because the scripts in that directory assume it.  We use
# mv on platforms where symlinks to directories do not work or are not
# reliable.

# 'touch' doesn't work right on some platforms.
STAMP = echo timestamp >

# We only want to compare .o files, so set this!
objext = .o


.PHONY: stage1-start stage1-end

stage1-start::
        @: $(MAKE); $(stage); \
        echo stage1 > stage_current ; \
        echo stage1 > stage_last; \
        $(SHELL) $(srcdir)/mkinstalldirs $(HOST_SUBDIR)
        @cd $(HOST_SUBDIR); [ -d stage1-bfd ] || \
          mkdir stage1-bfd; \
        mv stage1-bfd bfd
        @cd $(HOST_SUBDIR); [ -d stage1-opcodes ] || \
          mkdir stage1-opcodes; \
        mv stage1-opcodes opcodes
        @cd $(HOST_SUBDIR); [ -d stage1-binutils ] || \
          mkdir stage1-binutils; \
        mv stage1-binutils binutils
        @cd $(HOST_SUBDIR); [ -d stage1-gas ] || \
          mkdir stage1-gas; \
        mv stage1-gas gas
        @cd $(HOST_SUBDIR); [ -d stage1-intl ] || \
          mkdir stage1-intl; \
        mv stage1-intl intl
        @cd $(HOST_SUBDIR); [ -d stage1-ld ] || \
          mkdir stage1-ld; \
        mv stage1-ld ld
        @cd $(HOST_SUBDIR); [ -d stage1-libiberty ] || \
          mkdir stage1-libiberty; \
        mv stage1-libiberty libiberty
        @[ -d stage1-$(TARGET_SUBDIR) ] || \
          mkdir stage1-$(TARGET_SUBDIR); \
        mv stage1-$(TARGET_SUBDIR) $(TARGET_SUBDIR)

stage1-end::
        @if test -d $(HOST_SUBDIR)/bfd ; then \
          cd $(HOST_SUBDIR); mv bfd stage1-bfd  ; \
        fi
        @if test -d $(HOST_SUBDIR)/opcodes ; then \
          cd $(HOST_SUBDIR); mv opcodes stage1-opcodes  ; \
        fi
        @if test -d $(HOST_SUBDIR)/binutils ; then \
          cd $(HOST_SUBDIR); mv binutils stage1-binutils  ; \
        fi
        @if test -d $(HOST_SUBDIR)/gas ; then \
          cd $(HOST_SUBDIR); mv gas stage1-gas  ; \
        fi
        @if test -d $(HOST_SUBDIR)/intl ; then \
          cd $(HOST_SUBDIR); mv intl stage1-intl  ; \
        fi
        @if test -d $(HOST_SUBDIR)/ld ; then \
          cd $(HOST_SUBDIR); mv ld stage1-ld  ; \
        fi
        @if test -d $(HOST_SUBDIR)/libiberty ; then \
          cd $(HOST_SUBDIR); mv libiberty stage1-libiberty  ; \
        fi
        @if test -d $(TARGET_SUBDIR) ; then \
          mv $(TARGET_SUBDIR) stage1-$(TARGET_SUBDIR)  ; \
        fi
        rm -f stage_current

# Bubble a bug fix through all the stages up to stage 1.  They are
# remade, but not reconfigured.  The next stage (if any) will not be
# reconfigured either.
.PHONY: stage1-bubble
stage1-bubble::
        @r=`${PWD_COMMAND}`; export r; \
        s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
        if test -f stage1-lean  ; then \
          echo Skipping rebuild of stage1 ; \
        else \
          $(MAKE) stage1-start; \
          $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage1; \
        fi


_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: "inline" using a variable

Paul Smith-20
On Sun, 2016-10-02 at 00:19 +1000, Russell Shaw wrote:
> When i "configured" binutils in a directory separate to the source directory, it
> generates a 11500 line Makefile containing the following fragment.
>
> Down the bottom it does:
>
>    $(MAKE) $(RECURSE_FLAGS_TO_PASS) all-stage1;
>
> but "all-stage1" is not in the Makefile.

You should bring this up in the binutils support mailing lists.  There's
no issue with GNU make here (at least none that you've referenced) so we
can't help.

> I think it's got something to do with:
>
> stage:
>         @: $(MAKE); $(stage)

No, it doesn't have anything to do with that.  At least, not based on
the information you've provided.

When you send the message to the binutils list be sure to provide
information on the version of binutils you're using, the platform you're
building on, etc., and also show the make command that is invoked that
gives the error (for most autoconf makefiles you can run them in verbose
mode where they print the commands they're running by adding V=1 to the
make command line somewhere:

  make V=1

).

_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make