2024-10-02 14:50:51 +00:00
|
|
|
# Requires GNU Make
|
|
|
|
export LC_ALL = C.UTF-8
|
|
|
|
export PLEROMA_BUILD_BRANCH = $(shell git rev-parse --abbrev-ref HEAD)
|
|
|
|
|
|
|
|
QUILT ::= quilt --quiltrc ../quiltrc
|
|
|
|
|
2024-10-03 19:02:20 +00:00
|
|
|
SUBMODULE_NAME ::= akkoma
|
2024-10-02 14:50:51 +00:00
|
|
|
|
|
|
|
.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"
|
2024-10-03 19:02:20 +00:00
|
|
|
@if [ ! -f $(SUBMODULE_NAME)/.git ] || \
|
2024-10-02 14:50:51 +00:00
|
|
|
[ ! -f $@ ] || \
|
2024-10-03 19:02:20 +00:00
|
|
|
git submodule status $(SUBMODULE_NAME) | grep -qE '^\+' ; then \
|
2024-10-02 14:50:51 +00:00
|
|
|
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
|
2024-10-08 02:00:07 +00:00
|
|
|
@cd $(SUBMODULE_NAME) && { \
|
|
|
|
$(QUILT) pop -qfa; \
|
|
|
|
git reset --hard && \
|
|
|
|
$(QUILT) push -a; \
|
|
|
|
}
|
2024-10-02 14:50:51 +00:00
|
|
|
@touch $@
|
|
|
|
|
|
|
|
|
|
|
|
# cleaning
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
|
|
|
rm -f *.stamp
|
|
|
|
rm -f patches/000_plant-a-forest.patch
|
|
|
|
|
|
|
|
.PHONY: reset
|
|
|
|
reset: clean
|
2024-10-03 19:02:20 +00:00
|
|
|
git -C $(SUBMODULE_NAME) reset --hard
|
|
|
|
|
|
|
|
.PHONY: reset-harder
|
|
|
|
reset-harder: clean
|
|
|
|
rm -fr $(SUBMODULE_NAME)/
|
2024-10-02 14:50:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
# mix command proxies
|
|
|
|
.PHONY: build
|
|
|
|
build: patch
|
2024-10-03 19:02:20 +00:00
|
|
|
cd $(SUBMODULE_NAME) && \
|
2024-10-02 14:50:51 +00:00
|
|
|
mix deps.get && \
|
|
|
|
mix deps.compile && \
|
|
|
|
mix compile
|
|
|
|
|
|
|
|
.PHONY: compile
|
|
|
|
compile: patch
|
2024-10-03 19:02:20 +00:00
|
|
|
cd $(SUBMODULE_NAME) && \
|
2024-10-02 14:50:51 +00:00
|
|
|
mix compile
|
|
|
|
|
|
|
|
.PHONY: migrate
|
|
|
|
migrate: patch
|
2024-10-03 19:02:20 +00:00
|
|
|
cd $(SUBMODULE_NAME) && \
|
2024-10-02 14:50:51 +00:00
|
|
|
mix ecto.migrate
|
|
|
|
|
|
|
|
.PHONY: server
|
|
|
|
server: patch
|
2024-10-03 19:02:20 +00:00
|
|
|
cd $(SUBMODULE_NAME) && \
|
2024-10-02 14:50:51 +00:00
|
|
|
mix phx.server
|