git » libjio » commit 3fd76c5

Split the default CFLAGS in optional and mandatory parts

author Alberto Bertogli
2009-02-22 07:09:24 UTC
committer Alberto Bertogli
2009-02-22 07:09:24 UTC
parent 9143f7fa888869ed2d88a95886f35e089f6948a7

Split the default CFLAGS in optional and mandatory parts

The library cannot be built without some flags, so split CFLAGS in two,
making it easier for the user to pass them in the command line without
having to include the mandatory ones.

While at it, also pass the flags when linking, because there may be
relevant flags. We should use LDFLAGS for this, tho; but for now we'll
take the simpler approach.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

Makefile +6 -4

diff --git a/Makefile b/Makefile
index adb05ba..6e4b9f9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,16 @@
 
 VERSION="0.23"
 
-CFLAGS += -std=c99 -pedantic -Wall -O3 -fPIC \
+CFLAGS = -std=c99 -pedantic -Wall -O3
+
+ALL_CFLAGS += $(CFLAGS) -fPIC \
 	-D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 \
 	-D_LFS_LARGEFILE=1 -D_LFS64_LARGEFILE=1 \
 	-D_FILE_OFFSET_BITS=64 `getconf LFS_CFLAGS 2>/dev/null` \
 	-D_XOPEN_SOURCE=500
 
 ifdef DEBUG
-CFLAGS += -g -pg -fprofile-arcs -ftest-coverage
+ALL_CFLAGS += -g -pg -fprofile-arcs -ftest-coverage
 endif
 
 
@@ -34,7 +36,7 @@ default: all
 all: libjio.so libjio.a jiofsck
 
 libjio.so: $(OBJS)
-	$(NICE_CC) -shared -fPIC $(OBJS) -o libjio.so
+	$(NICE_CC) -shared $(ALL_CFLAGS) $(OBJS) -o libjio.so
 
 libjio.a: $(OBJS)
 	$(NICE_AR) cr libjio.a $(OBJS)
@@ -57,7 +59,7 @@ install: all
 	@echo
 
 .c.o:
-	$(NICE_CC) $(CFLAGS) $(INCLUDES) -c $< -o $@
+	$(NICE_CC) $(ALL_CFLAGS) $(INCLUDES) -c $< -o $@
 
 
 python: all