1. force updating libdiscord.a and cleaning up libdiscord.a; 2. add settings.o
@@ -2,7 +2,7 @@ CC ?= gcc
OBJDIR := obj
LIBDIR := lib
-SRC := $(wildcard discord-*.c curl-websocket.c)
+SRC := $(wildcard discord-*.c curl-websocket.c settings.c)
_OBJS := $(patsubst %.c, %.o, $(SRC))
OBJS := $(addprefix $(OBJDIR)/, $(_OBJS))
@@ -15,10 +15,9 @@ LIBDISCORD_LDFLAGS := -L./$(LIBDIR) -ldiscord -lcurl -lbearssl -static
LIBS_CFLAGS := $(LIBJSCON_CFLAGS) $(LIBCURL_CFLAGS) $(LIBDISCORD_CFLAGS)
LIBS_LDFLAGS := $(LIBCURL_LDFLAGS) $(LIBDISCORD_LDFLAGS) $(LIBJSCON_LDFLAGS)
-LIBDISCORD_DLIB := $(LIBDIR)/libdiscord.so
LIBDISCORD_SLIB := $(LIBDIR)/libdiscord.a
-CFLAGS := -Wall -Wextra -pedantic -fPIC -std=c11 -O0 -g \
+CFLAGS := -Wall -Wextra -pedantic -std=c11 -O0 -g \
-DLIBDISCORD_DEBUG -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700
@@ -39,25 +38,22 @@ $(OBJDIR)/discord-%.o : discord-%.c
$(CC) $(CFLAGS) $(LIBS_CFLAGS) \
-c -o $@ $<
+$(OBJDIR)/settings.o : settings.c
+ $(CC) $(CFLAGS) $(LIBS_CFLAGS) -c -o $@ $<
+
$(OBJDIR)/curl-websocket.o : curl-websocket.c
$(CC) $(CFLAGS) $(LIBS_CFLAGS) \
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -c -o $@ $<
-$(LIBDISCORD_DLIB) :
- $(CC) $(LIBS_CFLAGS) \
- $(OBJS) -shared -o $@ $(LIBS_LDFLAGS)
-
-$(LIBDISCORD_SLIB) :
+$(LIBDISCORD_SLIB) : $(OBJS)
$(AR) -cvq $@ $(OBJS)
# @todo better install solution
install : all
- cp $(INCLUDE) /usr/local/include && \
- cp $(LIBDISCORD_DLIB) /usr/local/lib && \
- ldconfig
+ cp $(INCLUDE) /usr/local/include
clean :
- rm -rf $(OBJDIR) test-api test-ws
+ rm -rf $(OBJDIR) test-api test-ws lib/*
purge : clean
rm -rf $(LIBDIR)
