diff options
| author | Freya Murphy <freya@freyacat.org> | 2025-12-04 13:16:21 -0500 |
|---|---|---|
| committer | Freya Murphy <freya@freyacat.org> | 2025-12-04 13:18:33 -0500 |
| commit | ba2f810f0752bdecf8253b34bd245c7939f23534 (patch) | |
| tree | 23a5fa60afb7f9f5d0ff1b51d11bb8dd24f46e04 /Makefile | |
| download | voxel-ba2f810f0752bdecf8253b34bd245c7939f23534.tar.gz voxel-ba2f810f0752bdecf8253b34bd245c7939f23534.tar.bz2 voxel-ba2f810f0752bdecf8253b34bd245c7939f23534.zip | |
initial chunk rendering
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c8e3fc2 --- /dev/null +++ b/Makefile @@ -0,0 +1,42 @@ +### Copyright (c) 2025 Freya Murphy <freya@freyacat.org> + +CC ?= cc + +CFLAGS += -O2 +CFLAGS += -std=gnu23 +CFLAGS += -Wall -Wextra -pedantic + +LDFLAGS += -lglfw -lGL -lGLEW -lcglm -lm -lc + +.PHONY: build clean run fmt +.SILENT: + +SRC := src +BIN := bin +OUT := voxel + +H_SRC := $(shell find $(SRC) -type f -name "*.h") +C_SRC := $(shell find $(SRC) -type f -name "*.c") +C_OBJ := $(patsubst %.c,$(BIN)/%.o,$(C_SRC)) + +build: $(BIN)/$(OUT) + +clean: + rm -fr $(BIN) + +run: build + $(BIN)/$(OUT) + +fmt: + clang-format -i $(shell find -type f -name "*.[ch]") + sed -i 's/[ \t]*$$//' $(shell find -type f -name "*.[chS]" -or -name "*.glsl") + +$(C_OBJ): $(BIN)/%.o : %.c $(H_SRC) + mkdir -p $(@D) + printf "\033[34m CC \033[0m%s\n" $< + $(CC) -c $(CFLAGS) -o $@ $< + +$(BIN)/$(OUT): $(C_OBJ) + mkdir -p $(@D) + printf "\033[32m LD \033[0m%s\n" $@ + $(CC) $(LDFLAGS) -o $(BIN)/$(OUT) $(C_OBJ) |