Re: [GNU Make 4.2.1] Implicit rule not used

2016-10-01 Thread Philip Guenther
On Sat, Oct 1, 2016 at 12:55 PM, Jari Vetoniemi  wrote:
> I have Makefile where implict rule is not used for target that is
> prerequisite of another target.
>
> You can see the Makefile here:
> https://ptpb.pw/WxM9

(putting a makefile that's about the same size as your email message
behind a link.  WTH?)

> If I remove the recipe from vitaserve target GNU/Make will not use the
> implicit rule '%: %.c' for the target.
> Is this a bug in GNU/Make or am I understanding the implicit rule
> search algorithm wrong?

All the %s in a pattern rule have to match exactly the same string.
So, how is make going to match this:

vitaserve: vitac.c
$(LINK.c) $^ $(LDLIBS) -o $@

with a %:%.c rule?  What would the %s *both* match?


Philip Guenther

___
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make


[GNU Make 4.2.1] Implicit rule not used

2016-10-01 Thread Jari Vetoniemi
Hi,

I have Makefile where implict rule is not used for target that is
prerequisite of another target.

You can see the Makefile here:
https://ptpb.pw/WxM9

If I remove the recipe from vitaserve target GNU/Make will not use the
implicit rule '%: %.c' for the target.
Is this a bug in GNU/Make or am I understanding the implicit rule
search algorithm wrong?

___
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make


"inline" using a variable

2016-10-01 Thread 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
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make


Re: GNU Make Windows: absolute path to the file that contains the Make file that is currently being interpreted by Make.

2016-10-01 Thread Eli Zaretskii
> From: Denis BEURIVE 
> Date: Fri, 30 Sep 2016 23:15:42 +0200
> 
> I use to use GNU Make under UNIX, but (unfortunately), I have to work under
> Windows. This is not my cup of tea… and I have the MSDOS, which is a
> prehistoric tool. However, I have no choice.

What do you mean by "I have the MSDOS"?  Are you using MSDOS tools on
Windows?  Or does it mean something else?

> Under UNIX, I use to use this construct in order to get the absolute path
> to the file that contains the Make file that is currently being interpreted
> by Make :
> 
> __DIR__ := $(dir $(abspath $(lastword $(MAKEFILE_LIST
> 
> This works fine under UNIX.
> 
> However, under Windows, it does not work… The result is totally unexpected.

What is the version of GNU Make you have installed on the Windows
machine?  With Make 4.2, the latest official release, your recipe
works for me.  Here's how I tried this (where "^Z" means Ctrl-Z, the
Windows EOF character):

  D:\usr\eli\data>make -f-
  DIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST
  all:
  echo $(DIR)
  ^Z
  echo D:/usr/tmp/
  D:/usr/tmp/

> Does somebody know a reliable way to get the absolute path to the file that
> contains the Make file that is currently being interpreted by Make, under
> Windows ?

The file-name related built-in functions should all work on MS-Windows
as you'd expect.  I suspect you have some old version of Make, which
perhaps didn't support some of these functions.

___
Help-make mailing list
Help-make@gnu.org
https://lists.gnu.org/mailman/listinfo/help-make