wf_akkoma-fe/Makefile

58 lines
1.2 KiB
Makefile

# Requires GNU Make
export LC_ALL = C.UTF-8
QUILT ::= quilt --quiltrc ../quiltrc
# redefine via `make YARN=yarn` if named differently
YARN ::= yarnpkg
SUBMODULE_NAME ::= akkoma-fe
.PHONY: build
build: patch.stamp
@# yarn doesn't seem to do incremental builds anyway
@# but garbage may accumulate from `yarnpkg dev` testing inbetween
cd $(SUBMODULE_NAME) && \
$(YARN) && \
rm -fr dist && \
$(YARN) build
wf_akkoma-fe.zip: build
rm -f $@
cd $(SUBMODULE_NAME) && \
zip -r ../$@ dist
submodule.stamp:
@echo "Ensure submodule is up-to-date"
@if [ ! -f $(SUBMODULE_NAME)/.git ] || \
[ ! -f $@ ] || \
git submodule status $(SUBMODULE_NAME) | grep -qE '^\+' ; then \
git submodule sync && \
git submodule update --init && \
touch $@ ; \
fi
.PHONY: patch
patch: patch.stamp
patch.stamp: submodule.stamp patches/series $(wildcard patches/*.patch)
@echo "Applying patches"
@# `pop -a` return 2 if currently no patches applied, thus ignore exit code
@cd $(SUBMODULE_NAME) && \
$(QUILT) pop -qfa; \
$(QUILT) push -a
@touch $@
# cleaning
.PHONY: clean
clean:
rm -f *.stamp
.PHONY: reset
reset: clean
git -C $(SUBMODULE_NAME)/ reset --hard
.PHONY: reset-harder
reset-harder: clean
rm -fr $(SUBMODULE_NAME)/