Makefile to install, and License GNU GPLv3
This commit is contained in:
74
Makefile
Normal file
74
Makefile
Normal file
@@ -0,0 +1,74 @@
|
||||
# **************************************************************************
|
||||
# * (C)opyright 2026 by Ruben Carlo Benante *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU General Public License as published by *
|
||||
# * the Free Software Foundation, either version 3 of the License, or *
|
||||
# * (at your option) any later version. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU General Public License *
|
||||
# * along with this program. If not, see http://www.gnu.org/licenses/. *
|
||||
# * *
|
||||
# * Contact author at: *
|
||||
# * Ruben Carlo Benante *
|
||||
# * rcb@beco.cc *
|
||||
# **************************************************************************
|
||||
|
||||
# Makefile for zettelclean - build and install into an Obsidian vault on this machine.
|
||||
#
|
||||
# Usage:
|
||||
# make # build main.js
|
||||
# make install # build, then copy the plugin files into your vault
|
||||
# make copy # copy only (no rebuild)
|
||||
# make uninstall # remove the plugin folder from your vault
|
||||
#
|
||||
# Set your vault once below, or override per call:
|
||||
# make install VAULT=/home/beco/notes/MyVault
|
||||
|
||||
PLUGIN_ID := zettelclean
|
||||
|
||||
# EDIT THIS: absolute path to your Obsidian vault (the folder that contains .obsidian).
|
||||
VAULT ?= /path/to/your/ObsidianVault
|
||||
|
||||
PLUGIN_DIR := $(VAULT)/.obsidian/plugins/$(PLUGIN_ID)
|
||||
|
||||
# Files that actually ship. styles.css is included only if it exists.
|
||||
FILES := main.js manifest.json
|
||||
ifneq ("$(wildcard styles.css)","")
|
||||
FILES += styles.css
|
||||
endif
|
||||
|
||||
.PHONY: all build install copy uninstall clean check-vault
|
||||
|
||||
all: build
|
||||
|
||||
build:
|
||||
npm run build
|
||||
|
||||
install: build copy
|
||||
|
||||
copy: check-vault
|
||||
mkdir -p "$(PLUGIN_DIR)"
|
||||
cp $(FILES) "$(PLUGIN_DIR)/"
|
||||
@echo "Installed $(PLUGIN_ID) -> $(PLUGIN_DIR)"
|
||||
@echo "Now: reload Obsidian (Settings -> Community plugins -> refresh) and enable Zettelclean."
|
||||
|
||||
uninstall: check-vault
|
||||
rm -rf "$(PLUGIN_DIR)"
|
||||
@echo "Removed $(PLUGIN_DIR)"
|
||||
|
||||
clean:
|
||||
rm -f main.js
|
||||
|
||||
# Fail early with a clear message if the vault path is wrong or unset.
|
||||
check-vault:
|
||||
@test -d "$(VAULT)/.obsidian" || { \
|
||||
echo "ERROR: '$(VAULT)' is not an Obsidian vault (no .obsidian folder)."; \
|
||||
echo "Edit VAULT in the Makefile, or run: make install VAULT=/abs/path/to/vault"; \
|
||||
exit 1; \
|
||||
}
|
||||
Reference in New Issue
Block a user