diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 20 |
1 files changed, 9 insertions, 11 deletions
@@ -1,6 +1,5 @@ PKGS=libtiff-4 libpng DEFINES= -EXE=prog BUILD_DIR=build/ INC_DIR=include/ @@ -22,10 +21,13 @@ LIB_OBJS=$(LIB_OBJS_sub:.c=.o) LIB_OBJ_DIRS_sub=$(shell find $(LIB_DIR) -type d) LIB_OBJ_DIRS=$(subst $(LIB_DIR),$(LIB_OBJ_DIR),$(LIB_OBJ_DIRS_sub)) -$(info $(LIB_SRCS)) -$(info $(LIB_OBJ_DIR)) -$(info $(LIB_OBJ_DIRS)) -$(info $(LIB_OBJS)) +# Programs +PROG_DIR= +PROG_OUT_DIR=$(BUILD_DIR)$(PROG_DIR) +PROG_SRCS=$(shell find $(SRC_DIR) -iname \*.c) +PROG_OBJS=$(PROG_SRCS:.c=.o) +PROG_DIRS_sub=$(subst $(SRC_DIR),$(PROG_OUT_DIR),$(PROG_SRCS)) +PROGS=$(PROG_DIRS_sub:.c=) # Include raylib if we want a visual experience ifdef RAYLIB @@ -60,9 +62,9 @@ default: clean build .PHONY: clean build run -build: $(BUILD_DIR)$(EXE) +build: $(PROGS) -$(BUILD_DIR)$(EXE): $(SRC_OBJS) $(LIB_OBJS) +$(BUILD_DIR)$(PROG_DIR)%: $(SRC_OBJ_DIR)%.o $(LIB_OBJS) @echo LD --\> $@ @gcc -o $@ $(LDFLAGS) $^ @@ -78,7 +80,3 @@ clean: @echo Cleaning build files... @-rm -rf $(OBJ_DIR) $(BUILD_DIR) @mkdir -p $(BUILD_DIR) $(SRC_OBJ_DIRS) $(LIB_OBJ_DIRS) - -run: $(BUILD_DIR)$(EXE) - @echo Executing... - @./$(BUILD_DIR)$(EXE) |