-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
33 lines (26 loc) · 1.01 KB
/
Makefile
File metadata and controls
33 lines (26 loc) · 1.01 KB
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
BUILD_DIR_RELEASE=.build_release
BUILD_DIR_DEBUG=.build_debug
COMPILE_COMMANDS_DIR=.compile_commands
NPROC=$(shell nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || echo 4)
all:
@echo "Usage:"
@echo " make <release | .debug>"
@echo " make <check>"
@echo " make <clean>"
release:
@mkdir -p $(BUILD_DIR_RELEASE)
cd $(BUILD_DIR_RELEASE) && cmake -DCMAKE_BUILD_TYPE=Release .. && $(MAKE) -j$(NPROC)
cp $(BUILD_DIR_RELEASE)/texpacker .
.debug:
@mkdir -p $(BUILD_DIR_DEBUG)
cd $(BUILD_DIR_DEBUG) && cmake -DCMAKE_BUILD_TYPE=Debug .. && $(MAKE) -j$(NPROC)
cp $(BUILD_DIR_DEBUG)/texpacker .
check:
cppcheck -j $(NPROC) --enable=all -f -I src src/ 2> cppcheck-output
build_compile_commands:
@mkdir -p $(COMPILE_COMMANDS_DIR)
cd $(COMPILE_COMMANDS_DIR) && cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=1
rm -f compile_commands.json && ln -s $(COMPILE_COMMANDS_DIR)/compile_commands.json compile_commands.json
clean:
rm -fr $(BUILD_DIR_RELEASE) $(BUILD_DIR_DEBUG) texpacker
rm -fr $(COMPILE_COMMANDS_DIR) .cache/