diff --git a/Makefile b/Makefile index d56d7be4..e0ff6a86 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ all: subtitleoctopus subtitleoctopus: dist +include functions.mk + # Fribidi build/lib/fribidi/configure: lib/fribidi $(wildcard $(BASE_DIR)build/patches/fribidi/*.patch) rm -rf build/lib/fribidi @@ -368,49 +370,10 @@ git-checkout: git submodule sync --recursive && \ git submodule update --init --recursive +SUBMODULES := brotli expat fontconfig freetype fribidi harfbuzz libass +git-smreset: $(addprefix git-, $(SUBMODULES)) + +$(foreach subm, $(SUBMODULES), $(eval $(call TR_GIT_SM_RESET,$(subm)))) + server: # Node http server npm i -g http-server http-server - -git-update: git-freetype git-fribidi git-fontconfig git-expat git-harfbuzz git-libass git-brotli - -git-brotli: - cd lib/brotli && \ - git reset --hard && \ - git clean -dfx && \ - git pull origin master - -git-freetype: - cd lib/freetype && \ - git reset --hard && \ - git clean -dfx && \ - git pull origin master - -git-fribidi: - cd lib/fribidi && \ - git reset --hard && \ - git clean -dfx && \ - git pull origin master - -git-fontconfig: - cd lib/fontconfig && \ - git reset --hard && \ - git clean -dfx && \ - git pull origin master - -git-expat: - cd lib/expat && \ - git reset --hard && \ - git clean -dfx && \ - git pull origin master - -git-harfbuzz: - cd lib/harfbuzz && \ - git reset --hard && \ - git clean -dfx && \ - git pull origin master - -git-libass: - cd lib/libass && \ - git reset --hard && \ - git clean -dfx && \ - git pull origin master diff --git a/functions.mk b/functions.mk new file mode 100644 index 00000000..65ae2016 --- /dev/null +++ b/functions.mk @@ -0,0 +1,20 @@ +# For inclusion in toplevel Makefile +# Defines some useful macros and variables for building etc +# If arguments are expected (macro) it needs to be invoked with $(call ...), +# if no arguments are supported the definition is aregular avariable and can be used as such. +# Special macros of the name TR_... create targets (and always take arguments) +# and thus also need to be $(eval ...)'ed + + +## Clean and git related + +# @arg1: submodule name +define TR_GIT_SM_RESET +git-$(1): + cd lib/$(1) && \ + git reset --hard && \ + git clean -dfx + git submodule update --force lib/$(1) + +.PHONY: git-$(1) +endef