-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
46 lines (34 loc) · 938 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
# project config
BUILD_DIR := build
EXECUTABLE := cmd-play
FRAMES_FOLDER := ./frames/
CORES := $(shell sysctl -n hw.logicalcpu)
# compiler config
COMPILER := clang
FLAGS := -c -g -Wall -Werror -pedantic-errors
# source files
RENDER_FILES := process.c render.c
VIDEO_FILES := bmp.c
FILES := main.c util.c $(RENDER_FILES) $(VIDEO_FILES)
OBJECTS := $(addprefix $(BUILD_DIR)/,$(patsubst %.c,%.o,$(FILES)))
.PHONY: $(EXECUTABLE)
$(EXECUTABLE): $(BUILD_DIR)/$(EXECUTABLE)
.PRECIOUS: $(BUILD_DIR)/. $(BUILD_DIR)%/.
$(BUILD_DIR)/.:
mkdir -p $@
$(BUILD_DIR)%/.:
mkdir -p $@
.SECONDEXPANSION:
$(BUILD_DIR)/%.o: src/%.c | $$(@D)/.
$(COMPILER) $(FLAGS) $< -o $@
$(BUILD_DIR)/$(EXECUTABLE): $(OBJECTS)
$(COMPILER) $^ -o ./$(BUILD_DIR)/$(EXECUTABLE)
run:
make
./$(BUILD_DIR)/$(EXECUTABLE) ./input/input.mp4 --verbose --scale=1 --cores=$(CORES) --frames-folder=$(FRAMES_FOLDER)
new:
make clean
make
clean:
rm -rf build
mkdir build