Commit 3fbd7abb authored by Delisa Mason's avatar Delisa Mason

build: Check file changes before packaging

parent 69474534
all: build
# Won't work if bash is old af:
SHELL=/usr/bin/env bash -O globstar
SRCS=LICENSE main.lua conf.lua $(shell ls {game,lib}/{**/,}*.*)
TILED:=~/bin/apps/Tiled.app/Contents/MacOS/Tiled
LOVE:=/usr/local/bin/love
# ~ Packaging:
WINLOVE:=../love-win32/love.exe
TARGET=target
WINLOVEDIR:=../love-win32
WINLOVE=$(WINLOVEDIR)/love.exe
WINLIBS=$(patsubst $(WINLOVEDIR)/%,$(TARGET)/%,$(wildcard $(WINLOVEDIR)/*.dll))
MACLOVE:=~/bin/apps/love.app
GAME=$(shell perl -lne 'print $$1 if /title = "(.*)"/' conf.lua)
space :=
space +=
SAFEGAME=$(subst $(space),-,$(GAME))
BUNDLEID=me.delisa.$(SAFEGAME)
TARGET=target
ZIPFILE=$(TARGET)/$(SAFEGAME).love
WINZIPFILE=$(TARGET)/$(SAFEGAME)_win.zip
MACZIPFILE=$(TARGET)/$(SAFEGAME)_mac.zip
$(ZIPFILE): package-zip
$(ZIPFILE): $(SRCS)
@mkdir -p $(TARGET)
@zip -9rq "$@" $^
$(TARGET)/%.dll: $(WINLOVEDIR)/%.dll
@install $< $@
$(TARGET)/$(SAFEGAME).exe: $(ZIPFILE)
@cat $(WINLOVE) "$(ZIPFILE)" > $@
......@@ -29,16 +39,18 @@ $(TARGET)/$(SAFEGAME).app: $(ZIPFILE)
@/usr/libexec/PlistBuddy -c "Set CFBundleName '$(GAME)'" $@/Contents/Info.plist
@/usr/libexec/PlistBuddy -c "Set CFBundleIdentifier $(BUNDLEID)" $@/Contents/Info.plist
$(WINZIPFILE): $(TARGET)/$(SAFEGAME).exe
@cp $(shell dirname $(WINLOVE))/*.dll $(TARGET)
# See the guide for more info, etc:
# https://love2d.org/wiki/Game_Distribution#Linux_.2F_OS_X
$(WINZIPFILE): $(TARGET)/$(SAFEGAME).exe $(WINLIBS)
@cd $(TARGET) && zip -9rq "$(shell basename $(WINZIPFILE))" *.dll $(SAFEGAME).exe
$(MACZIPFILE): $(TARGET)/$(SAFEGAME).app
@cd $(TARGET) && zip -9rqy "$(SAFEGAME)_mac.zip" "$(SAFEGAME).app"
@cd $(TARGET) && zip -9rqy "$(shell basename $(MACZIPFILE))" "$(SAFEGAME).app"
# ~ end Packaging
.PHONY: run build add-map add-state add-system help test tiled-run tiled-edit-hooks package
.PHONY: run build add-map add-state add-system help test tiled-run \
tiled-edit-hooks package package-win package-mac package-zip
run: build
......@@ -54,17 +66,13 @@ help: ## Show help text
test: ## Lint and run tests
@luacheck game/
package-zip: ## Generate .love game file
@mkdir -p $(TARGET)
@zip -9rq "$(ZIPFILE)" .
package-zip: $(ZIPFILE) ## Generate .love game file
# See the guide for more info, etc:
# https://love2d.org/wiki/Game_Distribution#Linux_.2F_OS_X
package-win: $(WINZIPFILE) ## Generate windows executable
package-mac: $(MACZIPFILE) ## Generate mac app
package: package-mac package-win package-zip ## Generate distribution binaries
package: package-zip package-win package-mac ## Generate distribution binaries
add-map: ## Create a new map asset
ifeq ($(name),)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment