This repository has been archived by the owner on Sep 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
70 lines (54 loc) · 1.43 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
65
66
67
68
69
70
NINJA := $(shell command -v ninja 2> /dev/null)
ifdef NINJA
BUILD ?= ninja
CMAKE_FLAGS += -GNinja
else
BUILD ?= $(MAKE) -s
endif
ifdef RELEASE
CMAKE_FLAGS += -DCMAKE_BUILD_TYPE=Release
endif
.PHONY: fysh-sea
fysh-sea: build/fysh-sea
.PHONY: build/fysh-sea
build/fysh-sea: doctest/doctest.h build/compile_commands.json | build
cd build && $(BUILD) fysh-sea
.PHONY: babel-fysh
babel-fysh: doctest/doctest.h build/compile_commands.json | build
cd build && $(BUILD) babel-fysh
.PHONY: tests
tests: doctest/doctest.h build/compile_commands.json | build
cd build && $(BUILD) tests
.PHONY: test
test: tests
./build/test/tests
.PHONY: release
release:
rm -rf build
RELEASE=1 $(MAKE) fysh-sea
.PHONY: install
install: build/fysh-sea
cp $< /usr/local/bin/fysh-sea
.PHONY: clean
clean: build
cd build && $(BUILD) clean
build/compile_commands.json: build
cd build && cmake $(CMAKE_FLAGS) ..
doctest/doctest.h:
wget -O $@ https://raw.githubusercontent.com/doctest/doctest/master/doctest/doctest.h
build:
mkdir -p $@
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
SRC := $(call rwildcard,src,*.cc) \
$(call rwildcard,src,*.h) \
$(call rwildcard,test,*.cc) \
$(call rwildcard,test,*.h) \
$(call rwildcard,asm,*.cc) \
$(call rwildcard,asm,*.h)
DPRINT := $(shell command -v dprint 2> /dev/null)
.PHONY: fmt
fmt: $(SRC)
clang-format -i $^
ifdef DPRINT
dprint fmt
endif