CORE/Makefile

55 lines
3.6 KiB
Makefile

#!/bin/make
CORE=$(shell pwd)
DOCSCONF=$(COREDIR)/mkdocs.yml
DOCSOUT=$(COREDIR)/docs_out
TESTPROJECT=/tmp/core_devproject
dist: help
help:
@echo "Available tasks: docs-deps (installs the docs dependencies via pip)"
@echo " docs-deps-paru (install the docs dependencies via paru)"
@echo " docs-serve (starts development server)"
@echo " docs-build (export prod ready documentation as html)"
@echo " docs-clean (removes the built documentation)"
@echo " mkdevprj (creates a dev project for development)"
@echo " rmdevprj (removes the dev project)"
docs-deps:
@echo ":: Installing documentation dependencies"
@echo " This may take a few minutes"
@pip install -r requirements.txt
docs-deps-paru:
@echo ":: Installing documentation dependencies"
@echo " This may take a few minutes"
@paru -Sy --needed python-pyyaml-env-tag python-mergedeep python-six python-smmap python-gitdb python-urllib3 python-idna python-dateutil python-pytz python-babel python-requests python-regex python-pygments python-colorama python-watchdog python-packaging python-ghp-import python-click python-jinja python-yaml python-gitpython python-markupsafe pymdown-extensions mkdocs-material-pymdownx-extras mkdocs-git-revision-date-localized-plugin mkdocs-material mkdocs
docs-serve:
@echo ":: Serving documentation, press CTRL+C to exit"
# prevent make from terminating
@bash -c "mkdocs serve --dirtyreload --config-file "$(DOCSCONF)";exit 0"
docs-build:
@make docs-clean
@echo ":: Building documentation"
@mkdocs build --site-dir "$(DOCSOUT)" --config-file "$(DOCSCONF)"
docs-clean:
@echo ":: Removing built documentation"
@rm -rf "$(DOCSOUT)"
mkdevprj:
@echo ":: Creating development project"
@mkdir -p $(TESTPROJECT)
@echo -e "config_version=5\n[application]\nconfig/name=\"CORE development project\"\nrun/main_scene=\"res://CORE/coreinit.tscn\"\nconfig/use_custom_user_dir=true\nconfig/custom_user_dir_name=\"core_devproject\"\nconfig/features=PackedStringArray(\"4.1\", \"GL Compatibility\")\nboot_splash/bg_color=Color(0, 0, 0, 1)\nboot_splash/show_image=false\nconfig/icon=\"res://CORE/soscore.png\"\n[autoload]\nLogger=\"*res://CORE/logger.gd\"\nPreprocessor=\"*res://CORE/preprocessor.gd\"\n[display]\nwindow/size/viewport_width=960\nwindow/size/viewport_height=540\n[rendering]\nrenderer/rendering_method=\"gl_compatibility\"\nrenderer/rendering_method.mobile=\"gl_compatibility\"" > "$(TESTPROJECT)/project.godot"
@echo -e "extends Node\n\n@onready\nvar core = get_node(\"/root/core\")\n\nfunc _ready() -> void:\n core.welcome()" > "$(TESTPROJECT)/init.gd"
@echo -e "extends Node\nvar core_startscript = \"res://init.gd\"\nvar wmgr_size_x = 960\nvar wmgr_size_y = 540\nvar wmgr_title = \"CORE development project\"\nvar wmgr_mode = 0\nvar splash_enabled = false\nvar splash_image = \"res://CORE/soscore.png\"\nvar splash_image_size = 256\nvar splash_color = \"000000\"" > config.gd
@ln -s $(CORE) $(TESTPROJECT)/CORE
@echo ":: Development project created."
@echo " You can now launch Godot and open '$(TESTPROJECT)'."
@echo " Don't forget to save and execute 'make rmdevprj' when you're finished."
rmdevprj:
@echo ":: Removing development project"
@echo ":: Killing all open programs"
@bash -c "lsof | grep '$(TESTPROJECT)'||exit 0 | awk '{print $2}'||exit 0 | xargs kill||exit 0;exit 0" &> /dev/null
@echo ":: Removing directory"
@rm -rf $(TESTPROJECT)
@rm -rf config.gd
@echo ":: Removing .import files"
@bash -c "rm -rf *.import||exit 0;exit 0"
@echo ":: Removing 'uid://' strings"
@bash -c "for file in *.tscn; do cat \"\$$file\"|sed -E 's/\ uid=\"[^\"]*\"//g'|tee \$$file;done &> /dev/null"