refactor: remove redundant make file commands

This commit is contained in:
2026-02-24 19:55:28 +00:00
parent 5523310914
commit cb5c44a0b1
2 changed files with 34 additions and 56 deletions
+29 -49
View File
@@ -16,15 +16,11 @@ help:
@echo "KDE Plasma 6 Widget Developer Tools"
@echo ""
@echo "Usage:"
@echo " make test Run widget in plasmoidviewer (default)"
@echo " make test-local Run widget directly from local package path"
@echo " make test-panel Run in horizontal panel mode"
@echo " make test-desktop Run as a floating desktop widget"
@echo " make test-hidpi Run with 2x DPI scaling"
@echo " make dev Run widget in plasmoidviewer from local package (MODE=panel|desktop|hidpi)"
@echo " make watch Start Development Mode with Hot Reload"
@echo " make cpp-build Build the C++ QML bridge module"
@echo " make cpp-clean Remove C++ bridge build artifacts"
@echo " make install Install/upgrade widget (converts dev symlink)"
@echo " make install Install/upgrade widget in local Plasma package store"
@echo " make uninstall Remove widget from local system"
@echo " make package Build .plasmoid file for distribution"
@echo " make clean Remove build artifacts"
@@ -57,30 +53,24 @@ cpp-clean:
rm -rf $(CPP_BUILD_DIR) $(CPP_MODULE_DIR)
# Testing Targets
# Run plasmoidviewer using the installed widget ID from metadata.
.PHONY: test
test: cpp-build
plasmoidviewer -a $(WIDGET_ID)
# Run plasmoidviewer directly from the local package directory.
.PHONY: test-local
test-local: cpp-build
plasmoidviewer -a $(PACKAGE_DIR)
# Run widget in panel simulation (top edge, horizontal form factor).
.PHONY: test-panel
test-panel: cpp-build
plasmoidviewer -a $(WIDGET_ID) -l topedge -f horizontal
# Run widget in desktop simulation (floating, planar form factor).
.PHONY: test-desktop
test-desktop: cpp-build
plasmoidviewer -a $(WIDGET_ID) -l floating -f planar
# Run widget with HiDPI scaling enabled (2x scale factor).
.PHONY: test-hidpi
test-hidpi: cpp-build
QT_SCALE_FACTOR=2 plasmoidviewer -a $(WIDGET_ID)
# Run plasmoidviewer from the local package directory.
# Optional MODE values: panel, desktop, hidpi (omit MODE for default).
.PHONY: dev
dev: cpp-build
@mode="$(MODE)"; \
case "$$mode" in \
""|default) \
plasmoidviewer -a $(PACKAGE_DIR) ;; \
panel) \
plasmoidviewer -a $(PACKAGE_DIR) -l topedge -f horizontal ;; \
desktop) \
plasmoidviewer -a $(PACKAGE_DIR) -l floating -f planar ;; \
hidpi) \
QT_SCALE_FACTOR=2 plasmoidviewer -a $(PACKAGE_DIR) ;; \
*) \
echo "Invalid MODE='$$mode'. Allowed: panel, desktop, hidpi (or omit MODE)."; \
exit 1 ;; \
esac
# Development Tools
# Start file watcher for iterative development and reload workflow.
@@ -154,15 +144,10 @@ lint-prettier:
lint: lint-qml-format lint-qml lint-cpp lint-prettier
# Installation
# Install/upgrade widget in local Plasma package store and replace any dev symlink.
# Install/upgrade widget in local Plasma package store.
.PHONY: install
install: cpp-build
@install_path="$(HOME)/.local/share/plasma/plasmoids/$(WIDGET_ID)"; \
if [ -L "$$install_path" ]; then \
echo "Replacing development symlink with installed package: $$install_path"; \
rm -f "$$install_path"; \
fi; \
if kpackagetool6 --type Plasma/Applet --show $(WIDGET_ID) >/dev/null 2>&1; then \
@if kpackagetool6 --type Plasma/Applet --show $(WIDGET_ID) >/dev/null 2>&1; then \
echo "Upgrading existing package: $(WIDGET_ID)"; \
kpackagetool6 --type Plasma/Applet --upgrade $(PACKAGE_DIR); \
else \
@@ -170,25 +155,20 @@ install: cpp-build
kpackagetool6 --type Plasma/Applet --install $(PACKAGE_DIR); \
fi
# Symlink local package into Plasma directory for live development updates.
.PHONY: dev-install
dev-install: cpp-build
@echo "Creating symlink for development..."
mkdir -p $(HOME)/.local/share/plasma/plasmoids/
ln -sfn $(abspath $(PACKAGE_DIR)) $(HOME)/.local/share/plasma/plasmoids/$(WIDGET_ID)
@echo "Linked $(WIDGET_ID) -> $(PACKAGE_DIR)"
@echo "You can now use 'make test' or the Reload button in plasmoidviewer!"
# Upgrade an already installed widget package with local changes.
.PHONY: upgrade
upgrade: cpp-build
kpackagetool6 --type Plasma/Applet --upgrade $(PACKAGE_DIR)
# Remove both dev symlink and installed widget package from local system.
# Remove installed widget package from local system.
.PHONY: uninstall
uninstall:
rm -f $(HOME)/.local/share/plasma/plasmoids/$(WIDGET_ID)
kpackagetool6 --type Plasma/Applet --remove $(WIDGET_ID)
@if kpackagetool6 --type Plasma/Applet --show $(WIDGET_ID) >/dev/null 2>&1; then \
echo "Removing package registration: $(WIDGET_ID)"; \
kpackagetool6 --type Plasma/Applet --remove $(WIDGET_ID); \
else \
echo "Package not registered: $(WIDGET_ID)"; \
fi
# Packaging
# Create distributable .plasmoid archive from current package contents.