From 3fd76c54a0a2cd4a6b611cb428b5143a5f86f6e4 Mon Sep 17 00:00:00 2001
From: Alberto Bertogli <albertito@blitiri.com.ar>
Date: Sun, 22 Feb 2009 05:09:24 -0200
Subject: [PATCH 14/31] 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 |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

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
-- 
1.6.2.rc0.226.gf08f

