eqemu-docs/Makefile
2025-02-27 17:49:36 -06:00

82 lines
No EOL
2 KiB
Makefile

#----------------------
# Parse makefile arguments
#----------------------
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS))
$(eval $(RUN_ARGS):;@:)
#----------------------
# Silence GNU Make
#----------------------
ifndef VERBOSE
MAKEFLAGS += --no-print-directory
endif
#----------------------
# Load .env file
#----------------------
ifneq ("$(wildcard .env)","")
include .env
export
else
endif
#----------------------
# Terminal
#----------------------
GREEN := $(shell tput -Txterm setaf 2)
WHITE := $(shell tput -Txterm setaf 7)
YELLOW := $(shell tput -Txterm setaf 3)
RESET := $(shell tput -Txterm sgr0)
#------------------------------------------------------------------
# - Add the following 'help' target to your Makefile
# - Add help text after each target name starting with '\#\#'
# - A category can be added with @category
#------------------------------------------------------------------
.PHONY: build test
HELP_FUN = \
%help; \
while(<>) { \
push @{$$help{$$2 // 'options'}}, [$$1, $$3] if /^([a-zA-Z\-]+)\s*:.*\#\#(?:@([a-zA-Z\-]+))?\s(.*)$$/ }; \
print "\n"; \
for (sort keys %help) { \
print "${WHITE}$$_${RESET \
}\n"; \
for (@{$$help{$$_}}) { \
$$sep = " " x (32 - length $$_->[0]); \
print " ${YELLOW}$$_->[0]${RESET}$$sep${GREEN}$$_->[1]${RESET}\n"; \
}; \
print ""; \
}
help: ##@other Show this help.
@perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
#----------------------
# dev
#----------------------
watch: ##@dev Run mkdocs watch
python -m mkdocs serve --dirtyreload
install: ##@dev Install
pip install mkdocs-material
pip install mkdocs-git-committers-plugin
pip install mkdocs-git-revision-date-localized-plugin
pip install mkdocs-glightbox
generate: ##dev Generate docs
go run main.go doc:quest-api-doc-generate
go run main.go doc:db-schema-generate
go run main.go doc:bot-commands
go run main.go doc:gm-commands
go run main.go doc:server-rules
build:
mkdocs build
rm public -rf
mv site public
go run main.go