diff options
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) |