From 95af2110c0f139cdfea49fa82358508f031f2ad8 Mon Sep 17 00:00:00 2001 From: Christian C Date: Sun, 2 Mar 2025 18:20:34 -0800 Subject: Initial commit --- Makefile | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Makefile (limited to 'Makefile') 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) -- cgit v1.2.1