Commit 0a65b108 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

simplify makefile : user features moved to max.sh

parent a6addcee
Loading
Loading
Loading
Loading
+2 −79
Original line number Diff line number Diff line
@@ -60,88 +60,12 @@ package: install ## Construction d'une version distribuable de MaX
	@cp -r $(SRC_DIR)/main/core package/.max/basex/webapp/max/
	@cp -r $(SRC_DIR)/main/bundles/max-dev package/.max/basex/webapp/max/bundles/
	@cp -r $(SRC_DIR)/main/bundles/max-export package/.max/basex/webapp/max/bundles/
	@cp -r $(SRC_DIR)/scripts/max.sh package/
# génération d'un fichier VERSION
	@git rev-parse HEAD >> package/VERSION
	@echo 'Package disponible dans le dossier package.'	
# création du Makefile (les cibles de dev sont supprimées)
	@echo -n "SRC_DIR=$$" > package/Makefile
	@echo "{CURDIR}/.max/src" >> package/Makefile
	@awk '/.PHONY: package/ {p=1;next}p' Makefile >> package/Makefile
.PHONY: package

demo:  ## Installation d'une édition de démo
	@if [ ! -d '.max/basex' ]; then\
		echo 'Installation de MaX manquante, veuillez lancer : make install.';\
	else\
		cp -r .max/fixtures/max .max/basex/data/;\
		cp -r .max/fixtures/content_html .;\
		cp -r .max/fixtures/templates .;\
		cp -r .max/fixtures/autoroute .;\
		cp -r .max/fixtures/config.xml .;\
		cp -r .max/fixtures/locales .;\
		$(MAKE) init ;\
		echo 'Demo installée avec succès.';\
	fi
.PHONY: demo

check: ## vérification de la configuration
	@if [ -f 'config.xml' ]; then\
		.max/basex/bin/basex -q"validate:rng('config.xml', '.max/resources/max-configuration.rng')" || false;\
		echo 'MaX : Fichier config.xml valide.';\
	else\
  		echo 'MaX : Fichier de configuration manquant : config.xml';\
  		exit 1;\
  	fi
.PHONY: check

run:  check ## Lancement de MaX
	@.max/basex/bin/basexhttpstop || true
	@.max/basex/bin/basexhttp -h1234
.PHONY: run

build:	run ## Construction de la version statique dans le répertoire dist/
	@if [ -d dist ]; then\
		rm -rf dist;\
	fi
	sleep 5
	@echo "Statification..." ; \
	wget -P dist -nH --mirror --page-requisites --html-extension --convert-links 'http://127.0.0.1:1234/fr/pages/index.html' ; \
	echo "Version statique construite dans le répertoire dist/"
.PHONY: build

clean: ## Supprime l'installation de MaX et les fichiers du projet
	@read -p "Êtes-vous sûr? [o/N] " ans && ans=$${ans:-N} ; \
    if [ $${ans} = o ] || [ $${ans} = O ]; then \
		rm -rf content_html;\
		rm -rf templates;\
		rm -rf autoroute;\
		rm -rf locales;\
		rm config.xml;\
		if [ ! -f VERSION ]; then rm -rf .max; fi;\
    else\
        echo "Opération annulée" ; \
    fi
.PHONY: clean


feed: ## Insertion de sources XML
	@if [ -z $(path) ]; then\
  		echo "USAGE : make feed path=/path/to/dir/";\
  		exit 1;\
	elif [ ! -d $(path) ]; then\
  		echo "Dossier "$(path)" introuvable !";\
  		echo "USAGE : make feed path=/path/to/dir/"; \
  		exit 1;\
  	fi;\
    $(shell .max/basex/bin/basex -c"OPEN max; ADD "$(path))\
    echo $(path)" ajouté à la base 'max'."
.PHONY: feed


init: check ## Initialisation à partir du fichier de configuration courant
	$(shell .max/basex/bin/basex -Q".max/resources/bundles-installer.xq")
.PHONY: init



help: ## Affiche cette aide
@@ -149,4 +73,3 @@ help: ## Affiche cette aide
	@grep -E '^[0-9a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "  \033[0;36m%-12s\033[m %s\n", $$1, $$2}'
	@echo ""
.PHONY: help