mirror of
https://github.com/thepigeongenerator/sdl_template.git
synced 2025-12-17 05:55:47 +01:00
update makefile to add asset copying
This commit is contained in:
11
makefile
11
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 $@
|
||||
|
||||
|
||||
Reference in New Issue
Block a user