-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
29 lines (22 loc) · 751 Bytes
/
Copy pathMakefile
File metadata and controls
29 lines (22 loc) · 751 Bytes
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
CC:=gcc
C_FILES := $(shell find ./src -not -name "main.c" -and -name '*.c')
TEST_FILES := $(shell find ./tests -not -name "main_test.c" -and -name '*.c')
C_LIBS := -lm -lraylib
USER_SET_MACRO ?= -DTESTING
BUILD_DIR := ./build
OBJ_FILES := $(C_FILES:%=$(BUILD_DIR)/%.o)
OUTPUT := jpeg-decoder
TEST_OUT := ./test
C_FLAGS := -I./include
all: $(BUILD_DIR)/$(OUTPUT)
test: $(BUILD_DIR)/$(TEST_OUT)
$(BUILD_DIR)/$(TEST_OUT): $(OBJ_FILES) tests/main_test.c
$(CC) $(C_FLAGS) -o $@ $^ $(C_LIBS) -g -DTESTING
$(BUILD_DIR)/$(OUTPUT): $(OBJ_FILES) src/main.c
$(CC) $(C_FLAGS) -o $@ $^ $(C_LIBS) -g
$(BUILD_DIR)/%.c.o: %.c
mkdir -p $(dir $@)
$(CC) $(C_FLAGS) -c $< -o $@ -g $(USER_SET_MACRO)
clean:
rm -r $(BUILD_DIR)/$(SRC_DIR)
mkdir -p $(BUILD_DIR)