summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile8
1 files changed, 4 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index 995f07f..54d6f53 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
CXX := g++
CXXFLAGS := -Wall -Wextra -std=c++11 -O2 -I.
-LIBS := -lfltk -L/usr/local/lib
+LIBS := -L/usr/local/lib -lfltk -lfltk_images
BIN := game
object_src := $(wildcard src/objects/*.cpp)
@@ -12,10 +12,10 @@ sprite_allfiles := $(wildcard src/sprites/*)
sprite_fnames := $(filter %.png,$(sprite_allfiles))
sprite_skipped := $(filter-out %.png,$(sprite_allfiles))
sprite_obj := $(patsubst src/sprites/%.png,build/sprites/%.o,$(sprite_fnames))
-sprite_externs := $(shell echo $$(for f in $(sprite_obj); do basename $$f | sed 's/\.[^.]*$$//' | sed 's/.*/extern const Sprite &;/'; done))
+sprite_externs := $(shell echo $$(for f in $(sprite_obj); do basename $$f | sed 's/\.[^.]*$$//' | sed 's/.*/extern Sprite *&;/'; done))
base_src := $(wildcard *_base.cpp)
-base_src += library.cpp main.cpp
+base_src += library.cpp sprite.cpp main.cpp
base_obj := $(patsubst %.cpp,build/%.o,$(base_src))
.PHONY: all clean remake run
@@ -80,7 +80,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\nSprite $*=(Sprite){.image=data,.image_len=%d};\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" "$$(xxd -i <"$<")" $$(stat -f '%z' "$<") >"$@"
build/sprites.h:
echo Collecting generated sprite files