From 595c76a3e66c5fc4675204078dba470644600369 Mon Sep 17 00:00:00 2001 From: Quinn Date: Sat, 25 Jan 2025 15:47:25 +0100 Subject: [PATCH] update makefile to add asset copying --- makefile | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 0bd135e..d7810ac 100644 --- a/makefile +++ b/makefile @@ -13,10 +13,14 @@ DIR_OBJ := obj DIR := $(DIR_BIN)/$(ARCH) $(DIR_OBJ)/$(ARCH) SRC := $(wildcard src/*.c) $(wildcard src/**/*.c) $(wildcard src/**/**/*.c) $(wildcard src/**/**/**/*.c) $(wildcard src/**/**/**/**/*.c) +SRC_ASSETS := $(wildcard assets/*) + OBJ := $(patsubst src/%,$(DIR_OBJ)/$(ARCH)/%,$(SRC:.c=.o)) DEP := $(OBJ:.o=.d) +ASSETS := $(patsubst assets/%,$(DIR_BIN)/$(ARCH)/%,$(SRC_ASSETS)) TARGET := $(DIR_BIN)/$(ARCH)/$(NAME)$(EXT) + # sets the variables for the different targets linux-x86_64: $(MAKE) build ARCH=linux-x86_64 CFLAGS="$(CFLAGS) -target x86_64-pc-linux-gnu" @@ -26,7 +30,7 @@ web: $(MAKE) build ARCH=web CC=emcc EXT=".html" all: linux-x86_64 win-x86_64 web -build: $(DIR) $(TARGET) compile_commands.json +build: $(DIR) $(TARGET) $(ASSETS) compile_commands.json clean: rm -rf $(DIR_BIN) $(DIR_OBJ) @@ -39,6 +43,11 @@ $(DIR_OBJ)/$(ARCH)/%.o: src/%.c @mkdir -p $(dir $@) $(CC) -o $@ -MD -MP -c $< $(CFLAGS) -std=$(STD) -x $(LANG) -Wno-unused-command-line-argument +# copy the assets +$(DIR_BIN)/$(ARCH)/%: assets/% + @mkdir -p $(dir $@) + cp $< $@ + $(DIR): @mkdir -p $@