-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (36 loc) · 998 Bytes
/
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
EXE := build/ray-tracer
IMG := render/render.ppm
CONFIG_FILE := apps/config.json
.PHONY: all init build start test clean full-clean $(SUPPORTED_EXTENTIONS)
SUPPORTED_EXTENTIONS := png jpg jpeg
BUILD := $(dir $(EXE))
# launch project from scratch
all: build start png
# init project for use
init: full-clean build
# start project and create image from already compiled version
start: $(EXE)
@mkdir -p $(dir $(IMG))
@echo "* Rendering"
$(EXE) $(CONFIG_FILE)
# launch project in dev mode (rebuild)
# dev: build start
# build project
build:
@mkdir -p $(BUILD)
@echo "* Building app..."
@cd $(BUILD) && cmake .. && $(MAKE) --no-print-directory
# convert image to specified format
$(SUPPORTED_EXTENTIONS): $(IMG)
@echo "* Convert to $@"
@convert $< $(basename $<).$@
$(EXE):
@$(MAKE) build --no-print-directory
# clean img folder
clean:
@echo "clean render folder..."
@rm -rf $(dir $(IMG))
# clean all folders
full-clean: clean
@echo "clean build folder..."
@rm -rf $(BUILD)