diff options
author | tomsmeding <tom.smeding@gmail.com> | 2016-12-30 22:52:28 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2016-12-30 22:52:28 +0100 |
commit | da86e33dcba7d66e2e5b55efa8a7265c5d2989b9 (patch) | |
tree | be1cf66b9076b65ceae6419b04b2d2fd781e9b4d /Makefile | |
parent | 9f84ef2686feab6c82f7f523319fda65ff077962 (diff) |
xxd -i -> bin2c (if available)
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -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 |