This repository has been archived by the owner on Nov 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
64 lines (55 loc) · 1.62 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
EVENTS = events/events.go
GO_SRC = $(wildcard *.go) $(EVENTS)
JSON_SUFFIX = _easyjson.go
JSON_SRC = model/models.go packets.go
JSON_GEN = $(addsuffix $(JSON_SUFFIX), $(basename $(JSON_SRC)))
all: events $(JSON_GEN) $(GO_SRC) check
@printf " ✔ Finished %s \n" $@
json: $(JSON_GEN)
%$(JSON_SUFFIX): $(JSON_SRC)
ifeq (, $(shell which easyjson))
@printf " → Installing easyjson\n"
@go get github.com/mailru/easyjson/easyjson
endif
@printf " → Generating %s \n" $@
@rm -f $@
@easyjson -all $^
events:
@printf " → Generating %s \n" $@
@go run ./cmd/genevents/main.go \
CHANNEL_CREATE=Channel \
CHANNEL_UPDATE=Channel \
CHANNEL_DELETE=Channel \
GUILD_CREATE=Guild \
GUILD_UPDATE=Guild \
GUILD_DELETE=Guild \
GUILD_BAN_ADD=Guild \
GUILD_MEMBER_ADD=Member \
GUILD_MEMBER_UPDATE=Member \
GUILD_MEMBER_REMOVE=Member \
GUILD_ROLE_CREATE=GuildRole \
GUILD_ROLE_UPDATE=GuildRole \
GUILD_ROLE_DELETE=GuildRoleDelete \
GUILD_INTEGRATIONS_UPDATE=GuildIntegrationsUpdate \
GUILD_EMOJIS_UPDATE=GuildEmojisUpdate \
MESSAGE_ACK=MessageAck \
MESSAGE_CREATE=Message \
MESSAGE_UPDATE=Message \
MESSAGE_DELETE=Message \
PRESENCE_UPDATE=PresenceUpdate \
PRESENCES_REPLACE=PresencesReplace \
READY=Ready \
RESUMED=Resumed \
USER_UPDATE=User \
USER_SETTINGS_UPDATE=UserSettingsUpdate \
USER_GUILD_SETTINGS_UPDATE=UserGuildSettings \
TYPING_START=TypingStart \
VOICE_SERVER_UPDATE=VoiceServerUpdate \
VOICE_STATE_UPDATE=VoiceState > $(EVENTS)
check: $(JSON_GEN) $(GO_SRC)
@printf " → Running tests\n"
@go test -race ./...
@go vet ./...
clean:
rm -f $(JSON_GEN) $(EVENTS)
.PHONY: clean check json events