CORE/Makefile
JeremyStarTM ab5b3ade52 Backup before I nuke the project
- Rewrote mkdevprj/rmdevprj in Makefile
- Add MOAM modloader
- Add core.exception()
- Add protection mode
- Rewrote module initialization
- Add experimental markdown parser
- Many more very small changes
2023-08-07 14:49:12 +02:00

68 lines
4.9 KiB
Makefile

#!/bin/make
CORE=$(shell pwd)
DOCSCONF=$(CORE)/mkdocs.yml
DOCSOUT=$(CORE)/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)/mods/testmod/
@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: Node = 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\"\nvar moam_loadpath = \"res://mods/\"\nvar moam_wanted_name = \"coredevprj\"\nvar moam_wanted_version = 1\nvar moam_wanted_api = 1" > config.gd
@echo -e "{\n\"wanted\": {\n\"min_version\": 1,\n\"max_version\": 1,\n\"min_api\": 1,\n\"max_api\": 1\n},\n\"mod\": {\n\"name\": \"CORE Test Mod\",\n\"version\": 1,\n\"version_friendly\": "1.0",\n\"authors\": [\n\"The CORE Team\"\n],\n\"license\": \"GNU General Public License v3\",\n\"entrypoint\": \"testmod.gd\"\n}\n}" > "$(TESTPROJECT)/mods/testmod/coredevprj.coremod"
@echo -e "extends Node\n@onready\nvar core: Node = get_node(\"/root/core\")\nfunc _start() -> String:\n await get_tree().create_timer(0).timeout\n Logger.info(\"testmod\",\"_start() has been called.\")\n return \"\"\nfunc _stop() -> void:\n await get_tree().create_timer(0).timeout\n Logger.info(\"testmod\",\"_stop() has been called.\")" > "$(TESTPROJECT)/mods/testmod/testmod.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 ":: !!!!!!!!!!!!!!!!!!!!!!!!!!!!"
@echo ":: ! IMPORTANT WARNING !"
@echo ":: !!!!!!!!!!!!!!!!!!!!!!!!!!!!"
@echo ":: ! Please remove the CORE !"
@echo ":: ! development project from !"
@echo ":: ! your project list or you !"
@echo ":: ! will experience bugs if !"
@echo ":: ! you edit the dev project !"
@echo ":: ! again in the future! !"
@echo ":: !!!!!!!!!!!!!!!!!!!!!!!!!!!!"
@echo ":: If you have done that, press [ENTER]."
@read -rs
@echo ":: Removing directory"
@rm -rf $(TESTPROJECT)
@rm -rf config.gd
@echo ":: Removing 'uid://' strings"
@#bash -c "for file in *.tscn; do cat \"\$$file\"|sed -E 's/\ uid=\"[^\"]*\"//g'|tee \$$file;done &> /dev/null"
@echo ":: Please open all .tscn files and remove all 'uid=uid://' strings"
@echo ":: If you have done that, press [ENTER]."
@read -rs