diff options
author | Christian C <cc@localhost> | 2025-03-02 18:20:34 -0800 |
---|---|---|
committer | Christian C <cc@localhost> | 2025-03-02 18:20:34 -0800 |
commit | 95af2110c0f139cdfea49fa82358508f031f2ad8 (patch) | |
tree | 8d6eea6cb7ee970ec0191b1092af32162be4db14 /Makefile |
Initial commit
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..bd731f6 --- /dev/null +++ b/Makefile @@ -0,0 +1,34 @@ +PKGS=libtiff-4 raylib +EXE=prog +BUILD_DIR=build/ +OBJ_DIR=$(BUILD_DIR)obj/ +SRC_DIR=src/ +INC_DIR=include/ +SRCS=$(shell find $(SRC_DIR) -iname \*.c) +OBJS_sub=$(subst $(SRC_DIR),$(OBJ_DIR),$(SRCS)) +OBJS=$(OBJS_sub:.c=.o) +OBJ_DIRS_sub=$(shell find $(SRC_DIR) -type d) +OBJ_DIRS=$(subst $(SRC_DIR),$(OBJ_DIR),$(OBJ_DIRS_sub)) + +CFLAGS= +CFLAGS+=$(shell pkgconf --cflags $(PKGS)) +CFLAGS+=-I$(INC_DIR) + +LDFLAGS= +LDFLAGS+=$(shell pkgconf --libs $(PKGS)) + +default: clean build + +.PHONY: clean build + +build: $(BUILD_DIR)$(EXE) + +$(BUILD_DIR)$(EXE): $(OBJS) + gcc -o $@ $(LDFLAGS) $^ + +$(OBJ_DIR)%.o: $(SRC_DIR)%.c + gcc -o $@ $(CFLAGS) -c $< + +clean: + -rm -rf $(OBJ_DIR) $(BUILD_DIR) + @mkdir -p $(OBJ_DIR) $(BUILD_DIR) $(OBJ_DIRS) |