[Top][All Lists]

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

Re: GNU Make - Problem defining pattern rules

From: Manuel Collado
Subject: Re: GNU Make - Problem defining pattern rules
Date: Thu, 29 Apr 2010 13:24:52 +0200
User-agent: Thunderbird (Windows/20090812)

Dave escribió:
When I execute:
make src/application/SampleApplication

I see  "Building a Binary"

When I execute
make src/libraries/PluginOne/

I see "make: Nothing to be done for `src/libraries/PluginOne/'."

Can anyone explain why the pattern rule for the binary appears to
work, but the pattern rule for a .so library doesn't?

After expanding the variable values and stripping down the file paths,
it seems that the relevant part of your Makefile can be reduced to: %.o
        @echo "Building a Library" PluginOne.o ...

The last, explicit rule doesn't match the first, implicit rule (note the 'lib' prefix), and contains no actions, so ... "Nothing to do ..."

# Some Pattern Rules
%.o: %.cpp
        @echo "Building Object Files" %.o
        @echo "Building a Library"

%: %.o
        @echo "Building a Binary"


# Some variables to hold data
SOURCES      :=

# Build the first binary
local_bin       := src/application/SampleApplication
local_src       := src/application/SampleApplication.cpp src/
local_objs      := $(subst .cpp,.o,$(local_src))

PROGRAMS        += $(local_bin)
SOURCES         += $(local_src)

$(local_bin): $(local_objs)

# Build the first library
local_lib       := src/libraries/PluginOne/
local_src       := src/libraries/PluginOne/PluginOne.cpp src/libraries/
local_objs      := $(subst .cpp,.o,$(local_src))

LIBRARIES       += $(local_lib)
SOURCES         += $(local_src)

$(local_lib): $(local_objs)

Manuel Collado -

reply via email to

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