-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathMakefile
56 lines (39 loc) · 1.57 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
ifeq ($(mode),)
mode := debug
endif
link_args := -Xswiftc -Ounchecked $(addprefix -Xcc ,-O2 -ffast-math -ffp-contract=fast -march=native)
gybs := $(shell find Sources Tests -type f -name '*.gyb')
conv_gybs := $(patsubst %.gyb,%,$(gybs))
sources := $(conv_gybs) $(shell find Sources Tests -type f -name '*.swift')
sources := $(sources) $(shell find Sources Tests -type f -name '*.cpp')
headers := $(sources) $(shell find Sources Tests -type f -name '*.hpp')
sources := $(sources) $(shell find Sources Tests -type f -name '*.c')
headers := $(sources) $(shell find Sources Tests -type f -name '*.h')
sources := $(sources) $(headers)
yaml := ./.build/${mode}.yaml
run_args := -c $(mode) $(link_args)
all: $(yaml)
run: $(yaml)
$(prefix) swift run $(run_args)
test: $(yaml)
$(prefix) swift test $(run_args)
$(yaml): gyb
swift build -v $(run_args)
Tests/LinuxMain.swift: Tests/BaseMathTests/BaseMathTests.swift
gyb: $(sources)
%.swift: %.swift.gyb
gyb --line-directive '' -o $@ $<
%.c: %.c.gyb
gyb --line-directive '' -o $@ $<
%.h: %.h.gyb
gyb --line-directive '' -o $@ $<
%.cpp: %.cpp.gyb
gyb --line-directive '' -o $@ $<
%.hpp: %.hpp.gyb
gyb --line-directive '' -o $@ $<
Sources/BaseMath/BaseRandom.swift Sources/BaseMath/CBaseRandom.swift Sources/BaseMath/BaseMath.swift Sources/BaseMath/BaseVector.swift Sources/CBaseMath/CBaseMath.cpp: mathfuncs.py cpp_template.py cpp_types.py c2swift.py
Sources/CBaseMath/include/CBaseMath.h: Sources/CBaseMath/CBaseMath.cpp
Sources/CBaseMath/include/CBaseRandom.h: Sources/CBaseMath/CBaseRandom.cpp
.PHONY: clean
clean:
rm -rf .build $(conv_gybs)