summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile7
1 files changed, 6 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 2e9ed50..a5f5962 100644
--- a/Makefile
+++ b/Makefile
@@ -3,6 +3,11 @@ CXXFLAGS := -Wall -Wextra -std=c++11 -O2 -I. -I/usr/local/lib
LIBS := -L/usr/local/lib -lsfml-{system,window,graphics}
BIN := game
+BIN2C := $(shell command -v bin2c 2>/dev/null)
+ifeq ($(BIN2C),)
+ BIN2C := xxd -i
+endif
+
object_src := $(wildcard src/objects/*.cpp)
object_obj := $(patsubst src/objects/%.cpp,build/objects/%.o,$(object_src))
object_head := $(patsubst src/objects/%.cpp,build/objects/%.h,$(object_src))
@@ -80,7 +85,7 @@ build/sprites/%.o: build/sprites/%.cpp
build/sprites/%.cpp: src/sprites/%.png
echo Generating for sprite $*
mkdir -p $(dir $@)
- printf "#include \"sprite.h\"\n\nstatic const unsigned char data[]={\n%s, 0\n};\n\nstatic Sprite struct_data=Sprite(data,%d);\nSprite *$*=&struct_data;\n" "$$(xxd -i <"$<")" $$(stat -f '%z' "$<") >"$@"
+ printf "#include \"sprite.h\"\n\nstatic const unsigned char data[]={\n%s, 0\n};\n\nstatic Sprite struct_data=Sprite(data,%d);\nSprite *$*=&struct_data;\n" "$$($(BIN2C) <"$<")" $$(stat -f '%z' "$<") >"$@"
build/sprites.h:
echo Collecting generated sprite files