Skip to content

Commit

Permalink
Merge pull request #70 from Cogmasters/dev
Browse files Browse the repository at this point in the history
V2.0.0 Release
  • Loading branch information
lcsmuller authored Jun 9, 2022
2 parents a72eeaa + 002c662 commit 8fc821c
Show file tree
Hide file tree
Showing 108 changed files with 6,829 additions and 6,618 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/test_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ jobs:
make examples
echo "Building tests"
make test
echo "Building voice"
make voice
- name: Run Makefile with parallelism
run: |
Expand All @@ -39,3 +41,5 @@ jobs:
make examples -j$(nproc)
echo "Building tests with parallelism"
make test -j$(nproc)
echo "Building voice with parallelism"
make voice -j$(nproc)
5 changes: 3 additions & 2 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -833,8 +833,9 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = include/ core/ docs/api \
README.md docs/DISCORD_ROADMAP.md docs/WINDOWS.md
INPUT = core/error.h core/types.h include/discord.h include/ \
core/ docs/api README.md docs/DISCORD_ROADMAP.md \
docs/WINDOWS.md

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down
63 changes: 38 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,26 @@ COGUTILS_OBJS = $(COGUTILS_DIR)/cog-utils.o \
$(COGUTILS_DIR)/logconf.o \
$(COGUTILS_DIR)/json-build.o \
$(COGUTILS_DIR)/jsmn-find.o
CORE_OBJS = $(CORE_DIR)/work.o \
$(CORE_DIR)/user-agent.o \
CORE_OBJS = $(CORE_DIR)/user-agent.o \
$(CORE_DIR)/websockets.o \
$(CORE_DIR)/io_poller.o
THIRDP_OBJS = $(THIRDP_DIR)/sha1.o \
$(THIRDP_DIR)/curl-websocket.o \
$(THIRDP_DIR)/threadpool.o \
$(THIRDP_DIR)/priority_queue.o
DISCORD_OBJS = $(SRC_DIR)/concord-once.o \
$(SRC_DIR)/discord-adapter.o \
$(SRC_DIR)/discord-adapter_ratelimit.o \
$(SRC_DIR)/discord-adapter_refcount.o \
$(SRC_DIR)/discord-refcount.o \
$(SRC_DIR)/discord-rest.o \
$(SRC_DIR)/discord-rest_request.o \
$(SRC_DIR)/discord-rest_ratelimit.o \
$(SRC_DIR)/discord-client.o \
$(SRC_DIR)/discord-loop.o \
$(SRC_DIR)/discord-loop.o \
$(SRC_DIR)/discord-gateway.o \
$(SRC_DIR)/discord-gateway_dispatch.o \
$(SRC_DIR)/discord-messagecommands.o \
$(SRC_DIR)/discord-timer.o \
$(SRC_DIR)/discord-misc.o \
$(SRC_DIR)/discord-worker.o \
$(SRC_DIR)/application_command.o \
$(SRC_DIR)/interaction.o \
$(SRC_DIR)/audit_log.o \
Expand All @@ -50,31 +53,39 @@ DISCORD_OBJS = $(SRC_DIR)/concord-once.o \
$(SRC_DIR)/invite.o \
$(SRC_DIR)/user.o \
$(SRC_DIR)/voice.o \
$(SRC_DIR)/webhook.o \
$(XOBJ)
$(SRC_DIR)/webhook.o

OBJS := $(COGUTILS_OBJS) $(CORE_OBJS) $(THIRDP_OBJS) $(DISCORD_OBJS) \
$(GENCODECS_OBJ)
OBJS = $(COGUTILS_OBJS) $(CORE_OBJS) $(THIRDP_OBJS) $(DISCORD_OBJS) \
$(GENCODECS_OBJ)

LIB := $(LIBDIR)/libdiscord.a
ARLIB = $(LIBDIR)/libdiscord.a
ARFLAGS = -cqsv

SOLIB = $(LIBDIR)/libdiscord.so
SOFLAGS = -fPIC
LDFLAGS = -lcurl

WFLAGS += -Wall -Wextra -Wshadow -Wdouble-promotion -Wconversion -Wpedantic
CFLAGS += -std=c99 -O0 -g -pthread -D_XOPEN_SOURCE=600 \
-I$(INCLUDE_DIR) -I$(COGUTILS_DIR) -I$(CORE_DIR) -I$(THIRDP_DIR) \
-I$(GENCODECS_DIR) -I$(PREFIX)/include -DLOG_USE_COLOR
WFLAGS += -Wall -Wextra -Wshadow -Wdouble-promotion -Wconversion -Wpedantic

$(SRC_DIR)/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) $(WFLAGS) $(XFLAGS) -c -o $@ $<
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
$(CC) $(CFLAGS) $(WFLAGS) -c -o $@ $<

all: $(LIB)
all: $(ARLIB)

shared:
@ $(MAKE) clean
@ $(MAKE) CFLAGS="$(SOFLAGS) $(CFLAGS)" $(SOLIB)

voice:
@ $(MAKE) XFLAGS=-DCCORD_VOICE XOBJ=$(SRC_DIR)/discord-voice.o all
@ $(MAKE) CFLAGS="$(CFLAGS) -DCCORD_VOICE" \
OBJS="$(OBJS) $(SRC_DIR)/discord-voice.o" all

debug:
@ $(MAKE) XFLAGS="-DCCORD_DEBUG_WEBSOCKETS -DCCORD_DEBUG_ADAPTER" all
@ $(MAKE) CFLAGS="$(CFLAGS) -DCCORD_DEBUG_WEBSOCKETS -DCCORD_DEBUG_HTTP" \
all

test: all
@ $(MAKE) -C $(TEST_DIR)
Expand All @@ -85,8 +96,10 @@ examples: all
gencodecs:
@ $(MAKE) -C $(GENCODECS_DIR)

$(LIB): $(OBJS) | $(LIBDIR)
$(AR) -cqsv $@ $?
$(ARLIB): $(OBJS) | $(LIBDIR)
$(AR) $(ARFLAGS) $@ $?
$(SOLIB): $(OBJS) | $(LIBDIR)
$(CC) -shared $(LDFLAGS) -o $@ $<

$(LIBDIR):
@ mkdir -p $@
Expand All @@ -96,16 +109,16 @@ $(OBJS): $(GENCODECS_HDR) | $(OBJDIR)
$(GENCODECS_HDR): gencodecs

$(OBJDIR):
@ mkdir -p $@/$(THIRDP_DIR) \
$@/$(COGUTILS_DIR) \
$@/$(SRC_DIR) \
@ mkdir -p $@/$(THIRDP_DIR) $@/$(COGUTILS_DIR) $@/$(SRC_DIR) \
$@/$(GENCODECS_DIR)

.IGNORE:
install:
@ mkdir -p $(PREFIX)/lib/
@ mkdir -p $(PREFIX)/include/concord
install -d $(PREFIX)/lib/
install -m 644 $(LIB) $(PREFIX)/lib/
install -m 644 $(ARLIB) $(PREFIX)/lib/
install -m 644 $(SOLIB) $(PREFIX)/lib/
install -d $(PREFIX)/include/concord/
install -m 644 $(INCLUDE_DIR)/*.h $(COGUTILS_DIR)/*.h $(CORE_DIR)/*.h \
$(THIRDP_DIR)/*.h $(GENCODECS_DIR)/*.h $(PREFIX)/include/concord/
Expand All @@ -124,11 +137,11 @@ echo:

clean:
@ $(RM) $(GENCODECS_OBJS) $(COGUTILS_OBJS) $(CORE_OBJS) $(THIRDP_OBJS) $(DISCORD_OBJS)
@ $(RM) -r $(LIBDIR)
@ $(MAKE) -C $(TEST_DIR) clean
@ $(MAKE) -C $(EXAMPLES_DIR) clean

purge: clean
@ $(RM) -r $(LIBDIR)
@ $(MAKE) -C $(GENCODECS_DIR) clean

.PHONY: test examples install echo clean purge docs gencodecs
135 changes: 0 additions & 135 deletions Makefile.dynamic

This file was deleted.

Loading

0 comments on commit 8fc821c

Please sign in to comment.