summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile39
1 files changed, 24 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index bc5d612..f571d8a 100644
--- a/Makefile
+++ b/Makefile
@@ -3,37 +3,44 @@
#
# Compiler settings
-CC = gcc
-CFLAGS = -O3 -fPIC
+CC ?= gcc
+CFLAGS ?= -O2
+CFLAGS += -fPIC -Wall -ansi -pedantic
# Ar settings to build the library
-AR = ar
+AR ?= ar
ARFLAGS = rcv
SHLD = ${CC} ${CFLAGS}
-LDSHFLAGS = -shared -Wl,-Bsymbolic -Wl,-rpath -Wl,/usr/lib -Wl,-rpath,/usr/lib
-LDFLAGS = -Wl,-rpath -Wl,/usr/lib -Wl,-rpath,/usr/lib
+LDSHFLAGS = -shared -Wl,-Bsymbolic
+LDFLAGS += -Wl,-rpath -Wl,/usr/lib -Wl,-rpath,/usr/lib
# Set RANLIB to ranlib on systems that require it (Sun OS < 4, Mac OSX)
# RANLIB = ranlib
RANLIB = true
-RM = rm -f
+RM ?= rm -f
# Implicit rules
SUFFIXES = .o .c .h .a .so .sl
-COMPILE.c=$(CC) $(CFLAGS) -c
+COMPILE.c ?= $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
+
+ifndef V
+QUIET_AR = @echo "AR $@";
+QUIET_CC = @echo "CC $@";
+QUIET_LINK = @echo "LINK $@";
+QUIET_RANLIB = @echo "RANLIB $@";
+endif
+
.c.o:
- @(echo "compiling $< ...")
- @($(COMPILE.c) -o $@ $<)
+ $(QUIET_CC)$(COMPILE.c) $(OUTPUT_OPTION) $<
SRCS = src/iniparser.c \
- src/dictionary.c \
- src/strlib.c
+ src/dictionary.c
OBJS = $(SRCS:.c=.o)
@@ -41,11 +48,11 @@ OBJS = $(SRCS:.c=.o)
default: libiniparser.a libiniparser.so
libiniparser.a: $(OBJS)
- @($(AR) $(ARFLAGS) libiniparser.a $(OBJS))
- @($(RANLIB) libiniparser.a)
+ $(QUIET_AR)$(AR) $(ARFLAGS) $@ $^
+ $(QUIET_RANLIB)$(RANLIB) $@
libiniparser.so: $(OBJS)
- @$(SHLD) $(LDSHFLAGS) -o $@.0 $(OBJS) $(LDFLAGS) \
+ $(QUIET_LINK)$(SHLD) $(LDSHFLAGS) $(LDFLAGS) -o $@.0 $(OBJS) \
-Wl,-soname=`basename $@`.0
clean:
@@ -59,5 +66,7 @@ veryclean:
docs:
@(cd doc ; $(MAKE))
-check:
+check: default
@(cd test ; $(MAKE))
+
+.PHONY: default clean veryclean docs check