Skip to content

Commit

Permalink
Fix makefile
Browse files Browse the repository at this point in the history
Former-commit-id: 43f3a72
Former-commit-id: cb52da77a06b4a17d5166ab6a520664c14251256
  • Loading branch information
Nexela committed Apr 8, 2018
1 parent 2abc24d commit 7faabe6
Showing 1 changed file with 11 additions and 45 deletions.
56 changes: 11 additions & 45 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,21 @@ MODS_DIRECTORY := ../.mods.15
##MOD_LINK := $(shell find $(MODS_DIRECTORY)/$(OUTPUT_NAME) -mindepth 1 -maxdepth 1 -type d)
PARSER := ". | map(select(.tag_name == \"$(VERSION_STRING)\"))[0].assets | map(select(.name == \"$(OUTPUT_NAME).zip\"))[0].id"

PKG_COPY := $(wildcard *.md) $(wildcard changelog.txt) $(wildcard graphics) $(wildcard locale) $(wildcard sounds)
PKG_COPY := $(wildcard *.md) $(wildcard .*.md) $(wildcard graphics) $(wildcard locale) $(wildcard sounds)

SED_FILES := $(shell find . -iname '*.json' -type f -not -path "./.*/*") $(shell find . -iname '*.lua' -type f -not -path "./.*/*")
PNG_FILES := $(shell find ./graphics -iname '*.png' -type f)

OUT_FILES := $(SED_FILES:%=$(OUTPUT_DIR)/%)

SED_EXPRS := -e 's/{{MOD_NAME}}/$(PACKAGE_NAME)/g'
SED_EXPRS += -e 's/{{VERSION}}/$(VERSION_STRING)/g'

##@luac -p $@
##@luacheck $@
SED_EXPRS := -e 's/{{_MOD_NAME_}}/$(PACKAGE_NAME)/g'
SED_EXPRS += -e 's/{{_MOD_VERSION_}}/$(VERSION_STRING)/g'

all: clean

release: clean check package

optimized-release: clean check optimize-package

git: tag
git checkout master
git merge develop master
git checkout develop
git push --all
git push --tags

github-release:
curl --data '{"tag_name": "v$(VERSION_STRING)","target_commitish": "master","name": "v$(VERSION_STRING)","body": "Release of version $(VERSION_STRING)","draft": false,"prerelease": false}' https://api.github.com/repos/pyanodon/pYCoalprocesing/releases?access_token=$(TOKEN);
#curl 'https://api.github.com/repos/pyanodon/pYCoalprocesing/releases/v$(VERSION_STRING)/assets?access_token=$(TOKEN)&name=$(OUTPUT_NAME).zip' --header 'Content-Type: application/zip' --upload-file $(BUILD_DIR)/$(OUTPUT_NAME).zip -X POST;
optimized-release: clean check tag optimize-package

package-copy: $(PKG_DIRS) $(PKG_FILES)
@mkdir -p $(OUTPUT_DIR)
Expand All @@ -49,38 +35,20 @@ $(OUTPUT_DIR)/%.lua: %.lua
@mkdir -p $(@D)
@sed $(SED_EXPRS) $< > $@


$(OUTPUT_DIR)/%: %
@mkdir -p $(@D)
@sed $(SED_EXPRS) $< > $@

link2:
([ -d "$(MODS_DIRECTORY)/$(OUTPUT_NAME)" ] && \
echo "Junction does not need updating.") || \
@[ -d "$(MODS_DIRECTORY)/$(PACKAGE_NAME)*" ] && \
echo "Updating Junction" && \
mv $(MODS_DIRCTORY)/$(PACKAGE_NAME)* $(MODS_DIRECTORY)/$(OUTPUT_NAME)

link:
if test -d $(MODS_DIRECTORY)/$(PACKAGE_NAME)*; then \
if test -d $(MODS_DIRECTORY)/$(OUTPUT_NAME); then \
echo "Dont Update"; \
else \
echo "DO STUFF"; \
fi \
else \
echo "No Target to Link"; \
fi
update-stdlib:
#copy stdlib-files from branch
git add stdlib/
git commit -m "STDLIB Update"

tag:
git tag -f v$(VERSION_STRING)
git push --tags -f

optimize1:
for name in $(PNG_FILES); do \
optipng -o8 $(OUTPUT_DIR)'/'$$name; \
done

optimize2:
optimize:
@echo Please wait, Optimizing Graphics.
@for name in $(PNG_FILES); do \
pngquant --skip-if-larger -q --strip --ext .png --force $(OUTPUT_DIR)'/'$$name; \
Expand All @@ -98,12 +66,10 @@ check:
@luacheck . -q --codes

package: package-copy $(OUT_FILES) nodebug
@cp -r stdlib $(BUILD_DIR)/$(OUTPUT_NAME)/stdlib
@cd $(BUILD_DIR) && zip -rq $(OUTPUT_NAME).zip $(OUTPUT_NAME)
@echo $(OUTPUT_NAME).zip ready

optimize-package: package-copy $(OUT_FILES) nodebug optimize2
@cp -r stdlib $(BUILD_DIR)/$(OUTPUT_NAME)/stdlib
optimize-package: package-copy $(OUT_FILES) nodebug optimize tag
@cd $(BUILD_DIR) && zip -rq $(OUTPUT_NAME).zip $(OUTPUT_NAME)
@echo $(OUTPUT_NAME).zip ready

Expand Down

0 comments on commit 7faabe6

Please sign in to comment.