help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"inline" using a variable


From: Russell Shaw
Subject: "inline" using a variable
Date: Sun, 2 Oct 2016 00:19:21 +1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.1.0

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]