aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian C <cc@localhost>2025-03-07 22:12:56 -0800
committerChristian C <cc@localhost>2025-03-07 22:12:56 -0800
commitabd10d51c7e65880d236b38d4c8384a712ebd660 (patch)
treefc995acd9df7e0ee3b8b76f9765237d15dba047a
parent7ed69a0373ea170a164bf0557d61096100a7bba0 (diff)
Support programs in subdirectories
-rw-r--r--Makefile8
1 files 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)