[Top][All Lists]

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

Re: Using the same options for compilation and linking

From: Philip Guenther
Subject: Re: Using the same options for compilation and linking
Date: Mon, 6 May 2013 09:46:18 -0700

[Sending a message to three lists without a reply-to header to keep
the discussion in one location that everyone can post to?  Oh well, I
hope this works...]

On Sun, May 5, 2013 at 10:03 AM, Pau Koning <address@hidden> wrote:
> Or as another example take the builtin rules from GNU make:
> %: %.o
> #  commands to execute (built-in):
> $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
> It is missing the CFLAGS completely.

In theory, that rule should be (programming) language independent, as
the .o suffix isn't specific to C.  However it obviously isn't, as it
use $(CC) just like LINK.c, as contrasted with LINK.cpp using $(CXX)
and LINK.f using $(FC).

I think the Right Thing is actually to *remove* that rule.  Not only
does it not do the right thing for CFLAGS, but it's not required by
POSIX and at least BSD make doesn't have it, so makefiles can't
portably rely on it.

If it's going to be kept (blech), then LINK.o should have $(CFLAGS)
and $(CPPFLAGS) in its expansion.

(Why $(CPPFLAGS) when it's just linking .o files?  Because there are
options affect both preprocessing and linking.  -fmudflap being the
easiest to see.)

Philip Guenther

reply via email to

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