Snek/Makefile

102 lines
3.6 KiB
Makefile
Raw Normal View History

2020-03-23 19:11:39 +00:00
.PHONY: all clean
2020-03-26 18:26:47 +00:00
FIRE_ANIM = $(foreach angle, $(shell seq 0 6 359), build/fire$(angle).png)
2020-04-06 13:17:21 +00:00
PEACH_DECAY_ANIM = $(foreach percent, $(shell seq 99 -1 0), build/peach-decay$(percent).png)
2020-04-06 12:40:48 +00:00
PEACH_RAINBOW_ANIM = $(foreach percent, $(shell seq 100 2 299), build/peach-rainbow$(percent).png)
PORTAL_A_ANIM = $(foreach angle, $(shell seq 0 6 359), build/portal-a$(angle).png)
PORTAL_B_ANIM = $(foreach angle, $(shell seq 0 6 359), build/portal-b$(angle).png)
PORTAL_C_ANIM = $(foreach angle, $(shell seq 0 6 359), build/portal-c$(angle).png)
PORTAL_D_ANIM = $(foreach angle, $(shell seq 0 6 359), build/portal-d$(angle).png)
2020-03-26 18:26:47 +00:00
IMAGES = $(foreach name, apple wall oil key door, public/assets/$(name)32.png)
2020-03-26 17:05:12 +00:00
TILESETS = $(foreach name, hole, public/assets/$(name)-ts.png)
ANIMATIONS = $(foreach name, fire peach-decay peach-rainbow portal-a portal-b portal-c portal-d, public/assets/$(name)-anim.png)
JSON = $(foreach name, snake levelList config metaConfig, public/assets/$(name).json)
2020-03-23 19:11:39 +00:00
ICON = public/assets/icon32.png public/assets/icon256.png public/favicon.ico
CSS = public/css/snek.css
2020-03-24 09:46:01 +00:00
JS = public/js/snek.js
2020-03-23 19:11:39 +00:00
2020-03-26 18:26:47 +00:00
OUTPUT = $(IMAGES) $(TILESETS) $(ANIMATIONS) $(JSON) $(ICON) $(CSS) $(JS)
2020-03-24 09:46:01 +00:00
2020-03-26 18:26:47 +00:00
all: images tilesets animations json icon css js
2020-03-23 19:11:39 +00:00
2020-03-26 17:05:12 +00:00
images: $(IMAGES)
tilesets: $(TILESETS)
2020-03-26 18:26:47 +00:00
animations: $(ANIMATIONS)
2020-03-26 17:05:12 +00:00
json: $(JSON)
icon: $(ICON)
2020-03-23 19:11:39 +00:00
css: $(CSS)
2020-03-24 09:46:01 +00:00
js: $(JS)
2020-03-23 19:11:39 +00:00
public/favicon.ico: assets/icon.jpg
convert $^ -resize 32x $@
2020-03-25 14:57:20 +00:00
public/assets/%32.png: assets/%.png
2020-03-23 19:11:39 +00:00
convert $^ -resize 32x $@
2020-03-25 14:57:20 +00:00
public/assets/%256.png: assets/%.png
convert $^ -resize 256x $@
2020-03-23 19:11:39 +00:00
2020-03-25 14:57:20 +00:00
public/assets/%32.png: assets/%.jpg
2020-03-23 19:11:39 +00:00
convert $^ -resize 32x $@
2020-03-25 14:57:20 +00:00
public/assets/%256.png: assets/%.jpg
convert $^ -resize 256x $@
2020-03-23 19:11:39 +00:00
2020-03-26 17:05:12 +00:00
public/assets/%-ts.png: assets/%.png
convert $^ -scale 32x $@
2020-03-26 18:26:47 +00:00
public/assets/fire-anim.png: $(FIRE_ANIM)
convert $^ -append $@
2020-03-26 18:26:47 +00:00
build/fire%.png: assets/fire.png
convert $^ -distort ScaleRotateTranslate $(shell echo $@ | sed 's/[^0-9]*//g') -resize 32x $@
2020-03-26 18:26:47 +00:00
2020-04-06 12:40:48 +00:00
public/assets/peach-decay-anim.png: $(PEACH_DECAY_ANIM)
convert $^ -append $@
build/peach-decay%.png: assets/peach.png
convert $^ -modulate 100,$(shell echo $@ | sed 's/[^0-9]*//g') -resize 32x $@
public/assets/peach-rainbow-anim.png: $(PEACH_RAINBOW_ANIM)
convert $^ -append $@
build/peach-rainbow%.png: assets/peach.png
convert $^ -modulate 100,100,$(shell echo $@ | sed 's/[^0-9]*//g') -resize 32x $@
build/portal-b.png: assets/portal.png
convert $^ -modulate 100,100,200 $@
build/portal-c.png: assets/portal.png
convert $^ -modulate 100,100,150 $@
build/portal-d.png: assets/portal.png
convert $^ -modulate 100,100,50 $@
build/portal-a%.png: assets/portal.png
convert $^ -distort ScaleRotateTranslate $(shell echo $@ | sed 's/[^0-9]*//g') -resize 32x $@
build/portal-b%.png: build/portal-b.png
convert $^ -distort ScaleRotateTranslate $(shell echo $@ | sed 's/[^0-9]*//g') -resize 32x $@
build/portal-c%.png: build/portal-c.png
convert $^ -distort ScaleRotateTranslate $(shell echo $@ | sed 's/[^0-9]*//g') -resize 32x $@
build/portal-d%.png: build/portal-d.png
convert $^ -distort ScaleRotateTranslate $(shell echo $@ | sed 's/[^0-9]*//g') -resize 32x $@
public/assets/portal-a-anim.png: $(PORTAL_A_ANIM)
convert $^ -append $@
public/assets/portal-b-anim.png: $(PORTAL_B_ANIM)
convert $^ -append $@
public/assets/portal-c-anim.png: $(PORTAL_C_ANIM)
convert $^ -append $@
public/assets/portal-d-anim.png: $(PORTAL_D_ANIM)
convert $^ -append $@
2020-03-25 14:57:20 +00:00
public/assets/%.json: assets/%.json
2020-03-23 19:11:39 +00:00
cp $^ $@
2020-03-24 09:46:01 +00:00
public/css/snek.css: src/less/snek.less $(wildcard src/less/*.less)
node_modules/.bin/lessc $< $@
2020-03-24 09:46:01 +00:00
public/js/snek.js: $(wildcard src/js/*.js)
node mergejs.js $^ > $@
2020-03-23 19:11:39 +00:00
clean:
2020-03-26 18:26:47 +00:00
rm -f build/*.*
2020-03-23 19:11:39 +00:00
rm -f $(OUTPUT)