# DO NOT CHANGE STUFF BEYOND THIS LINE
# ====================================
-all: $(LIBRARY_NAME).a $(BINARY_NAME)
+all: $(LIBRARY_NAME).a $(LIBRARY_NAME).so $(BINARY_NAME)
CC=gcc
LD=gcc
OPTIFLAG = -O3
endif
-CFLAGS := $(CFLAGS) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG)
+#FIXME: Add a way to better control the library build
+CFLAGS := -fPIC $(CFLAGS) $(WARN_FLAGS) $(STD_FLAG) $(OPTI_FLAG) $(DEBUG_FLAG)
LDFLAGS := $(LDFLAGS) $(STRIP_FLAG)
LIBLDFLAGS := -shared $(LDFLAGS)
DEPFLAGS = -MT $@ -MMD -MP -MF $(DEPDIR)/$*.Td
POSTCOMPILE = mv -f $(DEPDIR)/$*.Td $(DEPDIR)/$*.d
-$(BINARY_NAME): $(OBJS)
- @echo "[LD ] $@"
- @$(LD) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
+$(LIBRARY_NAME).a: $(OBJSLIB)
+ @echo "[AR StO] $@"
+ @$(AR) rcs $@ $^
-$(LIBRARY_NAME).so: $(OBJSLIB) $(BINARY_NAME)
+$(LIBRARY_NAME).so: $(OBJSLIB)
@echo "[LD ShO] $@"
- @$(LD) $(CFLAGS) $(LDLIBFLAGS) $^ $(LDLIBS) -o $@
+ @$(LD) $(CFLAGS) $(LIBLDFLAGS) $^ -o $@
-$(LIBRARY_NAME).a: $(OBJS)
- @echo "[AR StO] $@"
- @$(AR) rcs $@ $^
+$(BINARY_NAME): $(OBJS)
+ @echo "[LD ] $@"
+ @$(LD) $(CFLAGS) $(LDFLAGS) $^ $(LDLIBS) -o $@
$(OBJDIR)/%.o: %.c $(DEPDIR)/%.d
@echo "[C ] $*"