/[sudobot]/branches/8.x/lib/Makefile
ViewVC logotype

Annotation of /branches/8.x/lib/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 577 - (hide annotations)
Mon Jul 29 18:52:37 2024 UTC (8 months ago) by rakinar2
File size: 1454 byte(s)
chore: add old version archive branches (2.x to 9.x-dev)
1 rakinar2 577 export CC = gcc
2     export CFLAGS = -O2 -fPIC -g -Wall -Wextra
3     export CPPFLAGS = -DDCCORD_DEBUG_HTTP
4    
5     ifeq ($(NDEBUG), 1)
6     export CPPFLAGS += -DNDEBUG
7     endif
8    
9     export LIBDISCORD = /usr/local/lib/libdiscord.a
10     export BIN_LDLIBS = -pthread $(LIBDISCORD) -lcurl -lm
11     export LIB_LDLIBS = -pthread -ldiscord -lcurl -lm
12     export TARGETS = common linux windows bsd macos
13     export BUILD_DIR = "$(abspath build)"
14     export COMMON_OBJECTS = $(patsubst %.c,%.o,$(wildcard common/**/*.c) $(wildcard common/*.c) $(wildcard common/**/**/*.c))
15     export ALL_OBJECTS = $(COMMON_OBJECTS)
16     export MAIN_OBJECT = common/main.c
17     export ALL_OBJECTS_WITHOUT_MAIN = $(filter-out $(MAIN_OBJECT),$(ALL_OBJECTS))
18     export BIN = sudobot
19     export LIB = libsudobot.so
20    
21     all: bin
22     @if test "$(BUILD_LIB)" != ""; then \
23     $(MAKE) lib; \
24     fi
25    
26     .PHONY: $(TARGETS)
27    
28     prepare: $(BUILD_DIR)
29    
30     $(BUILD_DIR):
31     mkdir -p $(BUILD_DIR)
32     mkdir -p $(BUILD_DIR)/bin
33     mkdir -p $(BUILD_DIR)/lib
34    
35     bin: prepare $(TARGETS)
36     $(CC) $(LDFLAGS) $(ALL_OBJECTS) -o $(BUILD_DIR)/bin/$(BIN) $(BIN_LDLIBS)
37    
38     lib: prepare $(TARGETS)
39     $(CC) -shared $(LDFLAGS) $(ALL_OBJECTS_WITHOUT_MAIN) -o $(BUILD_DIR)/lib/$(LIB) $(LIB_LDLIBS)
40    
41     $(TARGETS):
42     dir="$$(readlink -f .)"; \
43     echo $(MAKE) -C $@ "TOP_SRCDIR=\"$${dir}\""; \
44     $(MAKE) -C $@ "TOP_SRCDIR=$${dir}"
45    
46     clean:
47     for t in $(TARGETS); do \
48     dir="$$(readlink -f .)"; \
49     $(MAKE) -C "$$t" clean "TOP_SRCDIR=$$dir"; \
50     if test "$$?" != "0"; then \
51     exit 1; \
52     fi \
53     done
54     $(RM) -r $(BUILD_DIR)

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26