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

Contents of /branches/6.x/lib/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 577 - (show annotations)
Mon Jul 29 18:52:37 2024 UTC (8 months ago) by rakinar2
File size: 1683 byte(s)
chore: add old version archive branches (2.x to 9.x-dev)
1 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="$(realpath .)"; \
43 which realpath > /dev/null; \
44 if test "$$?" = "0"; then \
45 dir="$(shell realpath . --relative-to "$@")"; \
46 fi; \
47 echo $(MAKE) -C $@ "TOP_SRCDIR=\"$${dir}\""; \
48 $(MAKE) -C $@ "TOP_SRCDIR=$${dir}"
49
50 clean:
51 for t in $(TARGETS); do \
52 dir="$(realpath .)"; \
53 which realpath > /dev/null; \
54 if test "$$?" = "0"; then \
55 dir="$(shell realpath . --relative-to "$@")"; \
56 fi; \
57 $(MAKE) -C "$$t" clean "TOP_SRCDIR=$$dir"; \
58 if test "$$?" != "0"; then \
59 exit 1; \
60 fi \
61 done
62 $(RM) -r $(BUILD_DIR)

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26