diff options
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 |