-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
46 lines (36 loc) · 1.32 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
export TARGET := pokezero
export BUILD := build
export BINDIR := $(BUILD)/bin
# debug is the default build
export OBJDIR := $(BUILD)/objects/debug
export CXXTARGET := $(BINDIR)/$(TARGET)_debug
.PHONY: all bear debug release format run clean showdown $(GIT_SUBMODULES)
# passes C++ building to another makefile to assist in separate release and
# debug builds
all valgrind debug release format $(TARGET):
$(MAKE) $@ --no-print-directory -j -f makefiles/main.mk
run: showdown
$(MAKE) $@ --no-print-directory -j -f makefiles/main.mk
# runs `bear -- make` and then compdb
bear: clean
bear -- $(MAKE)
compdb list > compile_commands2.json
mv compile_commands2.json compile_commands.json
# update git submodules
GIT=git
GIT_SUBMODULES = $(shell sed -nE 's/path = +(.+)/\1\/.git/ p' .gitmodules | paste -s -)
$(GIT_SUBMODULES): %/.git: .gitmodules
$(GIT) submodule update --init $*
@touch $@
# build the showdown source code
SHOWDOWN_DIR := ./pokemon-showdown
showdown: $(GIT_SUBMODULES)
$(SHOWDOWN_DIR)/build
# change the executale target and object build location on release build
release: export OBJDIR := $(BUILD)/objects/release
release: export CXXTARGET := $(BINDIR)/$(TARGET)_release
valgrind: export OBJDIR := $(BUILD)/objects/valgrind
valgrind: export CXXTARGET := $(BINDIR)/$(TARGET)_valgrind
clean:
rm -rvf $(BUILD)
rm -vf $(TARGET)