-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from Cogmasters/dev
Cover remaining events and endpoints, update to Discord v10
- Loading branch information
Showing
143 changed files
with
5,640 additions
and
1,882 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,27 @@ | ||
*.tar | ||
*.exe | ||
*.out | ||
.ccls-cache | ||
*.o | ||
*~ | ||
cmake-build-debug | ||
*dev.json | ||
obj | ||
lib | ||
*.log | ||
concord-docs | ||
*.db | ||
*.swp | ||
src/specs-code | ||
include/discord-specs.h | ||
*.dSYM | ||
examples/*.dSYM | ||
test/*.dSYM | ||
# Ignore all | ||
* | ||
# But these | ||
!AUTHORS | ||
!.vscode | ||
!core | ||
!docs | ||
!doxygen-awesome-css | ||
!examples | ||
!gencodecs | ||
!include | ||
!include/*.h | ||
!lib | ||
!lib/.gitkeep | ||
!licenses | ||
!scripts | ||
!src | ||
!src/*.c | ||
!templates | ||
!test | ||
!.clang-format | ||
!.git* | ||
!Doxyfile | ||
!*.md | ||
!LICENSE | ||
!Makefile | ||
!config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,159 +1,87 @@ | ||
PREFIX ?= /usr/local | ||
CC ?= gcc | ||
PREFIX ?= /usr/local | ||
DESTINCLUDE_DIR = $(PREFIX)/include/concord | ||
DESTLIBDIR = $(PREFIX)/lib | ||
|
||
SRC_DIR = src | ||
INCLUDE_DIR = include | ||
OBJDIR = obj | ||
LIBDIR = lib | ||
DOCS_DIR = docs | ||
COGUTILS_DIR = cog-utils | ||
GENCODECS_DIR = gencodecs | ||
CORE_DIR = core | ||
THIRDP_DIR = $(CORE_DIR)/third-party | ||
EXAMPLES_DIR = examples | ||
TEST_DIR = test | ||
CCORDDOCS_DIR = concord-docs | ||
|
||
GENCODECS_HDR = $(GENCODECS_DIR)/discord_codecs.h | ||
GENCODECS_OBJ = $(GENCODECS_DIR)/discord_codecs.o | ||
|
||
COGUTILS_OBJS = $(COGUTILS_DIR)/cog-utils.o \ | ||
$(COGUTILS_DIR)/log.o \ | ||
$(COGUTILS_DIR)/logconf.o \ | ||
$(COGUTILS_DIR)/json-build.o \ | ||
$(COGUTILS_DIR)/jsmn-find.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-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-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 \ | ||
$(SRC_DIR)/channel.o \ | ||
$(SRC_DIR)/emoji.o \ | ||
$(SRC_DIR)/gateway.o \ | ||
$(SRC_DIR)/guild.o \ | ||
$(SRC_DIR)/guild_template.o \ | ||
$(SRC_DIR)/invite.o \ | ||
$(SRC_DIR)/user.o \ | ||
$(SRC_DIR)/voice.o \ | ||
$(SRC_DIR)/webhook.o | ||
|
||
OBJS = $(COGUTILS_OBJS) $(CORE_OBJS) $(THIRDP_OBJS) $(DISCORD_OBJS) \ | ||
$(GENCODECS_OBJ) | ||
|
||
ARLIB = $(LIBDIR)/libdiscord.a | ||
ARFLAGS = -cqsv | ||
|
||
SOLIB = $(LIBDIR)/libdiscord.so | ||
SOFLAGS = -fPIC | ||
LDFLAGS = -lcurl | ||
|
||
DYLIB = $(LIBDIR)/libdiscord.dylib | ||
DYFLAGS = -fPIC | ||
|
||
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 | ||
|
||
$(SRC_DIR)/%.o: $(SRC_DIR)/%.c | ||
$(CC) $(CFLAGS) $(WFLAGS) -c -o $@ $< | ||
|
||
all: $(ARLIB) | ||
|
||
shared: | ||
@ $(MAKE) clean | ||
@ $(MAKE) CFLAGS="$(SOFLAGS) $(CFLAGS)" $(SOLIB) | ||
|
||
shared_osx: | ||
@ $(MAKE) clean | ||
@ $(MAKE) CFLAGS="$(DYFLAGS) $(CFLAGS)" $(DYLIB) | ||
SOFLAGS = -fPIC | ||
DYFLAGS = -fPIC | ||
DEBUG_FLAGS = -O0 -g | ||
|
||
voice: | ||
@ $(MAKE) CFLAGS="$(CFLAGS) -DCCORD_VOICE" \ | ||
OBJS="$(OBJS) $(SRC_DIR)/discord-voice.o" all | ||
GIT_BRANCHES = master dev | ||
GIT_TARGETS = latest latest-dev | ||
|
||
debug: | ||
@ $(MAKE) CFLAGS="$(CFLAGS) -DCCORD_DEBUG_WEBSOCKETS -DCCORD_DEBUG_HTTP" \ | ||
all | ||
OPT = -O2 | ||
|
||
test: all | ||
@ $(MAKE) -C $(TEST_DIR) | ||
|
||
examples: all | ||
@ $(MAKE) -C $(EXAMPLES_DIR) | ||
all: static | ||
|
||
gencodecs: | ||
static: | ||
@ CFLAGS="$(OPT)" $(MAKE) -C $(CORE_DIR) | ||
@ $(MAKE) -C $(GENCODECS_DIR) | ||
@ CFLAGS="$(OPT)" $(MAKE) -C $(SRC_DIR) $@ | ||
shared: | ||
@ CFLAGS="$(SOFLAGS) $(OPT)" $(MAKE) -C $(CORE_DIR) | ||
@ CFLAGS="$(SOFLAGS)" $(MAKE) -C $(GENCODECS_DIR) | ||
@ CFLAGS="$(OPT)" $(MAKE) -C $(SRC_DIR) $@ | ||
shared_osx: | ||
@ CFLAGS="$(DYFLAGS) $(OPT)" $(MAKE) -C $(CORE_DIR) | ||
@ CFLAGS="$(DYFLAGS)" $(MAKE) -C $(GENCODECS_DIR) | ||
@ CFLAGS="$(OPT)" $(MAKE) -C $(SRC_DIR) $@ | ||
|
||
$(ARLIB): $(OBJS) | $(LIBDIR) | ||
$(AR) $(ARFLAGS) $@ $? | ||
|
||
$(SOLIB): $(OBJS) | $(LIBDIR) | ||
$(CC) -shared $(LDFLAGS) -o $@ $< | ||
|
||
$(DYLIB): $(OBJS) | $(LIBDIR) | ||
$(CC) -dynamiclib $(DYFLAGS) -o $@ $< | ||
|
||
$(LIBDIR): | ||
@ mkdir -p $@ | ||
|
||
$(OBJS): $(GENCODECS_HDR) | $(OBJDIR) | ||
|
||
$(GENCODECS_HDR): gencodecs | ||
|
||
$(OBJDIR): | ||
@ 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 $(ARLIB) $(PREFIX)/lib/ | ||
install -m 644 $(SOLIB) $(PREFIX)/lib/ | ||
install -m 644 $(DYLIB) $(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/ | ||
@ mkdir -p $(DESTLIBDIR) | ||
@ mkdir -p $(DESTINCLUDE_DIR) | ||
install -d $(DESTLIBDIR) | ||
install -m 644 $(LIBDIR)/* $(DESTLIBDIR) | ||
install -d $(DESTINCLUDE_DIR) | ||
install -m 644 $(INCLUDE_DIR)/*.h $(CORE_DIR)/*.h $(GENCODECS_DIR)/*.h \ | ||
$(DESTINCLUDE_DIR) | ||
|
||
uninstall: | ||
rm -rf $(PREFIX)/include/concord | ||
rm -rf $(PREFIX)/lib/libdiscord.a | ||
rm -rf $(PREFIX)/lib/libdiscord.so | ||
rm -rf $(PREFIX)/lib/libdiscord.dylib | ||
|
||
docs: | ||
@ $(MAKE) -C $(GENCODECS_DIR) docs | ||
@ $(MAKE) -C $(GENCODECS_DIR) headers | ||
|
||
echo: | ||
@ echo -e 'CC: $(CC)\n' | ||
@ echo -e 'PREFIX: $(PREFIX)\n' | ||
@ echo -e 'CFLAGS: $(CFLAGS)\n' | ||
@ echo -e 'COGUTILS_OBJS: $(COGUTILS_OBJS)\n' | ||
@ echo -e 'CORE_OBJS: $(CORE_OBJS)\n' | ||
@ echo -e 'DISCORD_OBJS: $(DISCORD_OBJS)\n' | ||
@ echo -e 'OBJS: $(OBJS)\n' | ||
|
||
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 | ||
voice: | ||
@ CFLAGS="$(OPT)" $(MAKE) -C $(SRC_DIR) $@ | ||
debug: | ||
@ CFLAGS="$(DEBUG_FLAGS)" $(MAKE) | ||
|
||
test: debug | ||
@ $(MAKE) -C $(TEST_DIR) | ||
examples: all | ||
@ $(MAKE) -C $(EXAMPLES_DIR) | ||
|
||
clean: | ||
@ $(MAKE) -C $(SRC_DIR) $@ | ||
@ $(MAKE) -C $(TEST_DIR) $@ | ||
@ $(MAKE) -C $(EXAMPLES_DIR) $@ | ||
purge: clean | ||
@ $(MAKE) -C $(GENCODECS_DIR) clean | ||
@ $(MAKE) -C $(SRC_DIR) $@ | ||
|
||
latest: master | ||
latest-dev: dev | ||
|
||
$(GIT_BRANCHES): | ||
$(MAKE) purge | ||
git switch $@ | ||
git pull | ||
$(MAKE) | ||
|
||
.PHONY: test examples install echo clean purge docs gencodecs | ||
.PHONY: test examples uninstall install echo clean purge docs static shared shared_osx $(GIT_BRANCHES) $(GIT_TARGETS) |
Oops, something went wrong.