-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (40 loc) · 1.35 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
SOURCE_DIR = src
BUILD_DIR = build
# pack
PACK_DIR = pack
ZIPFILE = xgysel00.zip
SOURCELIST := $(shell find $(SOURCE_DIR)/ -type f -name '*.c')
SOURCELIST += $(shell find $(SOURCE_DIR)/ -type f -name '*.h')
BUILDFLAGS = -j 12
.PHONY: all Release Debug test testd zip clean
all: Release
###### Development tree specific targets
Release: $(BUILD_DIR)
cmake --build $(BUILD_DIR) --config $@ $(BUILDFLAGS)
Debug: $(BUILD_DIR)
cmake --build $(BUILD_DIR) --config $@ $(BUILDFLAGS)
$(BUILD_DIR): CMakeLists.txt
cmake -B $@
test:
cd $(BUILD_DIR) && ctest -C Release --output-on-failure
testd:
cd $(BUILD_DIR) && ctest -C Debug --output-on-failure
###### Pack
# this target is used in CI to test whether the zipfile contents will compile
# NOTE: This does NOT need to work on Windows
pack-build: $(PACK_DIR) pack/Makefile
$(MAKE) -C $<
zip: $(PACK_DIR) pack/Makefile
cd $< && zip ../$(ZIPFILE) *.c *.h Makefile rozdeleni rozsireni
pack/Makefile: Makefile.template $(PACK_DIR)
cp $< $@
sed -i "s/TMPLT_SRCS/$(shell find $(PACK_DIR) -type f -name '*.c' -exec basename {} \;)/g" $@
sed -i "s/TMPLT_INCL/$(shell find $(PACK_DIR) -type f -name '*.h' -exec basename {} \;)/g" $@
$(PACK_DIR): $(SOURCELIST) rozdeleni rozsireni
mkdir -p $@
cp $^ $@
###### Cleanup
clean:
rm -rf $(BUILD_DIR)
rm -rf $(PACK_DIR)
rm -rf Testing