rlarranaga / bafprp

Automatically exported from code.google.com/p/bafprp
0 stars 0 forks source link

Makefile_NoSQL still compiles sql object files #7

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. gmake -f Makefile_NoSQL
2. OR gmake -n -f Makefile_NoSQL, which will show that the following will
be done:

/usr/bin/gcc -I. -Iinclude -O3 -pipe -s -funroll-loops -fno-rtti -v
-fpermissive -D_LINUX -DNDEBUG -fPIC -Wno-deprecated -static-libgcc -o
bin/mssqloutput.o -c src/mssqloutput.cpp
/usr/bin/gcc -I. -Iinclude -O3 -pipe -s -funroll-loops -fno-rtti -v
-fpermissive -D_LINUX -DNDEBUG -fPIC -Wno-deprecated -static-libgcc -o
bin/mysqloutput.o -c src/mysqloutput.cpp

I'm no expert on gmake, but it appears to be because these lines in the
Makefile...

$(BIN_DIR)/%.o: $(SOURCE_DIR)/%.cpp
        $(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<

...expand to include all files in the src directory.  Since the sql files
are there, the Makefile attempts to build objects for them.  The list of
source/object files to be used by bafprp will not include these objects,
but the attempt to compile them is still made.

This is tested with the Trunk from today (2009-11-04)

Since I am building bafprp on OpenBSD, I built a Makefile based on the one
provided.  Unfortunately, gmake apparently doesn't understand any kind of
for loop that I can find in the GNU Make manual...  This makefile
(attached) is tested on OpenBSD 4.5 and FreeBSD 7.2 (both are amd64).  The
resulting binary runs on FreeBSD, but dumps core on OpenBSD (possibly
because of something propolice doesn't like).

Feel free to use this Makefile as you see fit.  Only fixes the problem for
BSD, though :(

Original issue reported on code.google.com by th...@bendtel.net on 4 Nov 2009 at 8:02

Attachments:

GoogleCodeExporter commented 9 years ago
Ah, crud.  There's a minor error in that Makefile that probably won't really 
make a
difference, but I will attach a fix here anyway.

Original comment by th...@bendtel.net on 4 Nov 2009 at 9:38

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the fixed make files.  
I am unfamiliar with the qerks and gotchas of gmake vs make but I understand the
definition of 
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
to simply take my sources list and turn it into the list minus cpp plus o
then
$(BIN_DIR)/%.o: $(SOURCE_DIR)/%.cpp
should only be used for objects in the source list since *.o is required by
bafprp: $(OBJ_LINUX)

but maybe gmake is doing something funny with $(BIN_DIR)/%.o: 
$(SOURCE_DIR)/%.cpp
it can certainly be changed to $(OBJECTS:%.cpp) or whatever it should be..  
Ill check it out

Original comment by charless...@gmail.com on 5 Nov 2009 at 7:29

GoogleCodeExporter commented 9 years ago

Original comment by charless...@gmail.com on 5 Nov 2009 at 7:29

GoogleCodeExporter commented 9 years ago
Just FYI, when I tested the NoSQL makefile on Ubuntu, I had to remove the sql 
source
files from the source directory to prevent errors (same as when tested with 
gmake on
BSD).

Original comment by th...@bendtel.net on 5 Nov 2009 at 7:35

GoogleCodeExporter commented 9 years ago
I updated the makefiles using stricter implicit matching rules.
This update SHOULD fix this issue.
I compiled as expected in Debian, will try Ubuntu and BSD sometime soon.

Of course, please feel free to verify this fix yourself as well :)

Original comment by charless...@gmail.com on 26 Nov 2009 at 5:47

GoogleCodeExporter commented 9 years ago

Original comment by charless...@gmail.com on 10 Dec 2009 at 5:11