80 lines
1.6 KiB
Makefile
80 lines
1.6 KiB
Makefile
# Requires GNU Make
|
|
export LC_ALL = C.UTF-8
|
|
export PLEROMA_BUILD_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
|
|
|
|
QUILT ::= quilt --quiltrc ../quiltrc
|
|
|
|
|
|
.PHONY: patch
|
|
patch: patch.stamp
|
|
|
|
|
|
GIT_HASH ::= $(shell git rev-parse --short=8 HEAD)
|
|
GIT_HASH_OLD ::= $(shell cat git.stamp 2>/dev/null || :)
|
|
ifneq ($(GIT_HASH), $(GIT_HASH_OLD))
|
|
.PHONY: git.stamp
|
|
endif
|
|
git.stamp:
|
|
@echo "Collecting buld info"
|
|
@echo $(GIT_HASH) > $@
|
|
|
|
patches/000_plant-a-forest.patch: patches/000_plant-a-forest.patch.in git.stamp
|
|
@echo "Encoding build info"
|
|
@number="$$(git rev-list --count HEAD)" && \
|
|
hash="$$(git rev-parse --short=8 HEAD)" && \
|
|
sed -e 's/%COMMIT_NUMBER%/'"$$number"'/g' \
|
|
-e 's/%COMMIT_HASH%/'"$$hash"'/g' \
|
|
$< > $@
|
|
|
|
submodule.stamp:
|
|
@echo "Ensure submodule is up-to-date"
|
|
@if [ ! -f akkoma/.git ] || \
|
|
[ ! -f $@ ] || \
|
|
git submodule status akkoma | grep -qE '^\+' ; then \
|
|
git submodule sync && \
|
|
git submodule update --init && \
|
|
touch $@ ; \
|
|
fi
|
|
|
|
patch.stamp: submodule.stamp patches/series patches/000_plant-a-forest.patch $(wildcard patches/*.patch)
|
|
@echo "Applying patches"
|
|
@# `pop -a` return 2 if currently no patches applied, thus ignore exit code
|
|
@cd akkoma && \
|
|
$(QUILT) pop -qfa; \
|
|
$(QUILT) push -a
|
|
@touch $@
|
|
|
|
|
|
# cleaning
|
|
.PHONY: clean
|
|
clean:
|
|
rm -f *.stamp
|
|
rm -f patches/000_plant-a-forest.patch
|
|
|
|
.PHONY: reset
|
|
reset: clean
|
|
rm -fr akkoma/
|
|
|
|
|
|
# mix command proxies
|
|
.PHONY: build
|
|
build: patch
|
|
cd akkoma && \
|
|
mix deps.get && \
|
|
mix deps.compile && \
|
|
mix compile
|
|
|
|
.PHONY: compile
|
|
compile: patch
|
|
cd akkoma && \
|
|
mix compile
|
|
|
|
.PHONY: migrate
|
|
migrate: patch
|
|
cd akkoma && \
|
|
mix ecto.migrate
|
|
|
|
.PHONY: server
|
|
server: patch
|
|
cd akkoma && \
|
|
mix phx.server
|