Bug 13834 - sim/ppc/Makefile relies on GNU Make specific $< handling
Summary: sim/ppc/Makefile relies on GNU Make specific $< handling
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: sim (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-12 15:36 UTC by Christopher January
Modified: 2015-11-22 07:03 UTC (History)
1 user (show)

See Also:
Host:
Target: powerpc-*
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher January 2012-03-12 15:36:41 UTC
sim/ppc/Makefile uses GNU Make specific features but doesn't test for
GNU make in configure:

1. $< used in a non-default rule:

gentmap: ../common/gentmap.c
        $(CC_FOR_BUILD) $(BUILD_CFLAGS) -I. -I../common -I
$(srcdir)/../common -o gentmap $< $(BUILD_LIBS)

From the autoconf manual:

"Posix says that the ‘$<’ construct in makefiles can be used only in
inference rules and in the ‘.DEFAULT’ rule; its meaning in ordinary
rules is unspecified. Solaris make for instance replaces it with the
empty string. OpenBSD (3.0 and later) make diagnoses these uses and
errors out. "

Result (on AIX, with AIX make):

        gcc -g -O2 -I. -I. -I./../../include -I../../bfd -I./../../bfd
-I../../gdb -I./../../gdb  -I./../../gdb/config  -I. -I../common
-I./../common -o gentmap  
gcc: no input files
make: 1254-004 The error code from the last command is 1.

2. psim depends on -lz, which is not a real file:

LIBS = -lz

psim: $(TARGETLIB) main.o $(LIBIBERTY_LIB) $(BFD_LIB) $(LIBS)
$(LIBINTL_DEP)

Result (again, with AIX make):

make: 1254-002 Cannot find a rule to create target -lz from
dependencies.
Stop.
Comment 1 Mike Frysinger 2015-11-22 06:54:38 UTC
the issue wrt LIBS and the psim deps was already reported in bug 12202 (and is fixed in the current tree)
Comment 2 Sourceware Commits 2015-11-22 07:01:52 UTC
The master branch has been updated by Michael Frysinger <vapier@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7c125e3b10ac6f9222d24c76cdf31a5a9ec8dae0

commit 7c125e3b10ac6f9222d24c76cdf31a5a9ec8dae0
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Sat Nov 21 22:56:04 2015 -0800

    sim: ppc: avoid use of $< in ordinary rules [PR sim/13834]
    
    POSIX does not define $< behavior in ordinary rules, so avoid its use
    to fix building on non-GNU make setups.
    
    Reported-by: Christopher January <chris.january@allinea.com>
Comment 3 Mike Frysinger 2015-11-22 07:03:59 UTC
fixed by aformentioned commit