-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (48 loc) · 1.45 KB
/
Copy pathMakefile
File metadata and controls
58 lines (48 loc) · 1.45 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
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
CORE_DIR := core
BUILD_DIR := $(CORE_DIR)/build
CMAKE := cmake
CMAKE_BUILD_TYPE ?= Release
FES := $(BUILD_DIR)/fes
MODEL_DIR := mdl
# Export build dir so 'fes' works directly from shell
export PATH := $(BUILD_DIR):$(PATH)
# All .fes projects (basenames in mdl/)
FES_PROJECTS := $(patsubst $(MODEL_DIR)/%.fes,%,$(wildcard $(MODEL_DIR)/*.fes))
.PHONY: all help config build clean $(FES_PROJECTS)
all: build
help:
@echo "Usage: make [target]"
@echo "Targets:"
@echo " build Build fes"
@echo " clean Remove build directory"
@echo " test Run all .fes models (verify load, mesh only)"
@echo ""
@echo "The fes binary is at $(FES)"
@echo " export PATH=\$$(pwd)/$(BUILD_DIR):\$$PATH"
@echo " fes <model> <args>"
config:
$(CMAKE) -S $(CORE_DIR) -B $(BUILD_DIR) -DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
build: config
$(CMAKE) --build $(BUILD_DIR) --config $(CMAKE_BUILD_TYPE)
clean:
rm -rf $(BUILD_DIR)
# Each .fes model: load and exit
define fes_target
$(1): build
@echo "--- $(1) ---"
cd $(MODEL_DIR) && $(abspath $(FES)) $(1)
endef
$(foreach p,$(FES_PROJECTS),$(eval $(call fes_target,$(p))))
test: build
@echo "Running all $(words $(FES_PROJECTS)) models..."
@failed=""; FES_BIN="$(abspath $(FES))"; \
for p in $(FES_PROJECTS); do \
echo "--- $$p ---"; \
cd $(MODEL_DIR) && $$FES_BIN $$p || failed="$$failed $$p"; \
cd ..; \
done; \
if [ -n "$$failed" ]; then \
echo "FAILED:$$failed"; \
else \
echo "All models passed"; \
fi