From abd10d51c7e65880d236b38d4c8384a712ebd660 Mon Sep 17 00:00:00 2001 From: Christian C Date: Fri, 7 Mar 2025 22:12:56 -0800 Subject: Support programs in subdirectories --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 380a016..d25d150 100644 --- a/Makefile +++ b/Makefile @@ -26,8 +26,10 @@ 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=) +PROG_DIRS_sub=$(shell find $(SRC_DIR) -type d) +PROG_DIRS=$(subst $(SRC_DIR),$(PROG_OUT_DIR),$(PROG_DIRS_sub)) +PROGS_sub=$(subst $(SRC_DIR),$(PROG_OUT_DIR),$(PROG_SRCS)) +PROGS=$(PROGS_sub:.c=) # Include raylib if we want a visual experience ifdef RAYLIB @@ -79,4 +81,4 @@ $(LIB_OBJ_DIR)%.o: $(LIB_DIR)%.c clean: @echo Cleaning build files... @-rm -rf $(OBJ_DIR) $(BUILD_DIR) - @mkdir -p $(BUILD_DIR) $(SRC_OBJ_DIRS) $(LIB_OBJ_DIRS) + @mkdir -p $(BUILD_DIR) $(SRC_OBJ_DIRS) $(LIB_OBJ_DIRS) $(PROG_DIRS) -- cgit v1.2.1