help-make
[Top][All Lists]
Advanced

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

Request for review of failing makefile


From: David Aldrich
Subject: Request for review of failing makefile
Date: Thu, 17 Dec 2009 16:06:21 +0000

Hi
 
I have a problem with my makefile and would appreciate a peer review please.
 
The makefile builds an .exe file from C++ source code and a static library. The static
library has its own separate makefile.  I find that if I touch a source file component
of the static library and then execute the makefile below, the source file is
compiled and the library is rebuilt, but the executable is not rebuilt. Running the
same makefile a second time rebuilds the executable.
 
Here's the code:
 
================================================================
TRUNKDIR := ..
EXEFILE := myapp
include $(TRUNKDIR)/MakeVars.mk
 
# Include the kernel and other static libraries as required
STATIC_LIBS := $(TRUNKDIR)/Kernel
 
.PHONY : release
release : $(OBJDIR_R)/$(EXEFILE)
 
# Generate the list of archives to be linked from the library paths specified in STATIC_LIBS
ARCHIVES_R = $(patsubst %,%/$(OBJDIR_R)/lib.a,$(STATIC_LIBS))
 
# Perform link (release mode)
$(OBJDIR_R)/$(EXEFILE) : $(ARCHIVES_R)
        $(CXX) -o $(OBJDIR_R)/$(EXEFILE) -ldl -Wl,-whole-archive,-export-dynamic $(ARCHIVES_R) $(EXTRA_LIBS_R) -Wl,--no-whole-archive 
 
$(ARCHIVES_R) : $(STATIC_LIBS)
 
.PHONY : $(STATIC_LIBS)
$(STATIC_LIBS) :
        @$(MAKE) --quiet --directory=$@ $(MAKECMDGOALS)
================================================================
 
Here's the console output:
 
$ touch ../Kernel/Clock.cpp
$ make
g++ -c -Wall -I../Kernel -O3 Clock.cpp -o _gnuRelease/Clock.o
$ make
g++ -o _gnuRelease/myapp -ldl -Wl,-whole-archive,-export-dynamic ../Kernel/_gnuRelease/lib.a  -Wl,--no-whole-archive
$
 
Please can anyone suggest why the executable does not get rebuilt in the same
run as building the library?
Best regards
David
 
 

reply via email to

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