Clean Makefile

This commit is contained in:
Romain Vigier
2021-08-17 19:15:25 +02:00
parent a0f6a508d2
commit aaf94fe8c1
4 changed files with 31 additions and 63 deletions
+7 -45
View File
@@ -1,9 +1,6 @@
# SPDX-FileCopyrightText: 2019-2021 Romain Vigier <contact AT romainvigier.fr>
# SPDX-License-Identifier: GPL-3.0-or-later
COPYRIGHT_YEAR = 2019-2021
AUTHOR_NAME = Romain Vigier
AUTHOR_EMAIL =
NAME = $(shell grep '"name"' ./src/metadata.json | sed 's/\s"name":\s"\(.\+\)",\?/\1/')
UUID = $(shell grep '"uuid"' ./src/metadata.json | sed 's/\s"uuid":\s"\(.\+\)",\?/\1/')
@@ -11,9 +8,10 @@ VERSION = $(shell grep '"version"' ./src/metadata.json | sed 's/\s"version":\s\(
.PHONY: build
build: build-clean
build:
mkdir -p ./build
gnome-extensions pack \
--force \
--extra-source=../LICENSE \
--extra-source=./config.js \
--extra-source=./utils.js \
@@ -27,70 +25,34 @@ build: build-clean
--out-dir=./build \
./src
.PHONY: build-clean
.PHONY: clean
build-clean:
-rm -rf ./build
find ./src/ -type f -name "*.ui~" -delete
.PHONY: install
install: uninstall
gnome-extensions install ./build/$(UUID).shell-extension.zip
gnome-extensions install --force ./build/$(UUID).shell-extension.zip
.PHONY: uninstall
uninstall:
-gnome-extensions uninstall $(UUID)
.PHONY: clean
clean: build-clean deps-clean
.PHONY: test
test: test-lint test-variants
.PHONY: test-lint
test-lint:
npx eslint .
.PHONY: test-variants
test-variants:
cat ./src/modules/GtkVariants.js ./tests/gtk_themes/_variants.js.template > ./tests/gtk_themes/_variants.js
cat ./src/modules/ShellVariants.js ./tests/shell_themes/_variants.js.template > ./tests/shell_themes/_variants.js
test:
reuse lint
npm run test
.PHONY: deps-install
deps-install:
npm install
.PHONY: deps-clean
deps-clean:
-rm -rf ./node_modules
.PHONY: pot
pot:
mkdir -p ./src/po
xgettext \
--from-code=UTF-8 \
--keyword=_ \
--package-name="$(NAME)" \
--package-version="$(VERSION)" \
--output=./src/po/$(UUID).pot \
./src/*.js ./src/**/*.js ./src/schemas/*.xml ./src/preferences/ui/*.ui
sed -i '1,4s/SOME DESCRIPTIVE TITLE./$(NAME)/g' ./src/po/$(UUID).pot
sed -i '1,4s/YEAR/$(COPYRIGHT_YEAR)/' ./src/po/$(UUID).pot
sed -i "1,4s/THE PACKAGE'S COPYRIGHT HOLDER/$(AUTHOR_NAME)/" ./src/po/$(UUID).pot
sed -i "1,4s/FIRST AUTHOR/$(AUTHOR_NAME)/" ./src/po/$(UUID).pot
sed -i "1,4s/EMAIL@ADDRESS/$(AUTHOR_EMAIL)/" ./src/po/$(UUID).pot
.PHONY: add-po
add-po:
ifdef LANGUAGE_CODE
msginit --no-translator --input=src/po/$(UUID).pot --output=src/po/$(LANGUAGE_CODE).po --locale=$(LANGUAGE_CODE)
else
@echo "Please specify the code of the language you want to add, for example:"
@echo " make add-po LANGUAGE_CODE=fr"
endif
.PHONY: update-po
update-po:
for po_file in $(wildcard ./src/po/*.po); do \
msgmerge --update --no-fuzzy-matching --backup=none $$po_file src/po/$(UUID).pot; \
msgmerge --update $$po_file src/po/$(UUID).pot; \
done