From da86e33dcba7d66e2e5b55efa8a7265c5d2989b9 Mon Sep 17 00:00:00 2001 From: tomsmeding Date: Fri, 30 Dec 2016 22:52:28 +0100 Subject: xxd -i -> bin2c (if available) --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3-70-g09d2