You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.2 KiB
68 lines
1.2 KiB
# |
|
# iniparser Makefile |
|
# |
|
|
|
# Compiler settings |
|
CC ?= gcc |
|
|
|
CFLAGS += -fPIC -Wall -Wextra -ansi -pedantic |
|
ifndef DEBUG |
|
CFLAGS += -O2 |
|
else |
|
CFLAGS += -g |
|
endif |
|
|
|
# Ar settings to build the library |
|
AR ?= ar |
|
ARFLAGS = rcv |
|
|
|
SHLD = ${CC} ${CFLAGS} |
|
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 |
|
|
|
|
|
# Implicit rules |
|
|
|
SUFFIXES = .o .c .h .a .so .sl |
|
|
|
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: |
|
$(QUIET_CC)$(COMPILE.c) $(OUTPUT_OPTION) $< |
|
|
|
|
|
SRCS = src/iniparser.c \ |
|
src/dictionary.c |
|
|
|
OBJS = $(SRCS:.c=.o) |
|
|
|
|
|
default: libiniparser.a libiniparser.so |
|
|
|
libiniparser.a: $(OBJS) |
|
$(QUIET_AR)$(AR) $(ARFLAGS) $@ $^ |
|
$(QUIET_RANLIB)$(RANLIB) $@ |
|
|
|
libiniparser.so: $(OBJS) |
|
$(QUIET_LINK)$(SHLD) $(LDSHFLAGS) $(LDFLAGS) -o $@.0 $(OBJS) \ |
|
-Wl,-soname=`basename $@`.0 |
|
|
|
clean: |
|
$(RM) $(OBJS) libiniparser.a libiniparser.so* |
|
|
|
.PHONY: example |
|
example: libiniparser.a |
|
@(cd example ; $(MAKE))
|
|
|