From 74c97c90a9fa10ebad46ec00061da9e2578b33a7 Mon Sep 17 00:00:00 2001 From: Miruna Paun Date: Fri, 7 Apr 2017 12:27:55 +0200 Subject: Updated ENFV (COSNOS) Installation Guide COSNOSCR-318 seeking to complete first time push --- init.mk | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 init.mk (limited to 'init.mk') diff --git a/init.mk b/init.mk new file mode 100644 index 0000000..1c3035c --- /dev/null +++ b/init.mk @@ -0,0 +1,63 @@ +# ver R1.00/2017-03-16 Creation of this file +# ver R2.00/2017-04-05 Updated the docbuild.git clone command. + +ifeq ($(VERBOSE),yes) +VERB := +else +VERB := @ +endif + +#Git repositories to be cloned +REPO_DOCBUILD := build/docbuild.git +NAME_DOCBUILD := docbuild + +GLOBALTMPCLONEROOT = ../../tmpcommon +ifeq ($(BOOK_GLOBALCLONEROOT),) + TMPCLONEROOT := tmpcommon +else + ifeq ($(BOOK_GLOBALCLONEROOT),yes) + TMPCLONEROOT := $(GLOBALTMPCLONEROOT) + else + TMPCLONEROOT := $(BOOK_GLOBALCLONEROOT)/tmpcommon + endif +endif +DIR_TMPCLONEROOT := $(dir $(TMPCLONEROOT)) +ifeq ($(wildcard $(DIR_TMPCLONEROOT)),) +$(error Parent of selected clone root does not exist ($(DIR_TMPCLONEROOT))) +endif + +.PHONY: initbuild usageinit cleaninit +# Keep usageinit as default target here to avoid init by mistake + +usageinit: docusage + @echo 'make initbuild Create s_docbuild and if it does not exist, clone docbuild.git' + @echo ' Default clone in tmpcommon' + @echo ' BOOK_GLOBALCLONEROOT=yes Clone in $(GLOBALTMPCLONEROOT)' + @echo ' BOOK_GLOBALCLONEROOT=parentdir Clone in parentdir/tmpcommon' + + @echo 'make pullbuild git pull in s_docbuild' + @echo 'make cleaninit Delete all s_* symlinks and local tmpcommon/' + + +initbuild: s_docbuild +pullbuild: + $(VERB)if [ ! -d s_docbuild ]; then echo "ERROR: No s_docbuild exists?" ; exit 10 ; fi + $(VERB)cd s_docbuild ; git pull +s_docbuild: $(TMPCLONEROOT)/$(NAME_DOCBUILD) + $(VERB)rm s_docbuild 2>/dev/null; ln -s $(TMPCLONEROOT)/$(NAME_DOCBUILD) s_docbuild + +$(TMPCLONEROOT)/$(NAME_DOCBUILD): + $(VERB)if [ ! -d "$(TMPCLONEROOT)" ] ; then mkdir -p "$(TMPCLONEROOT)" ; fi + $(VERB)if [ -d "$(TMPCLONEROOT)/$(NAME_DOCBUILD)" ] ; then \ + echo "Already exists $(TMPCLONEROOT)/$(NAME_DOCBUILD)" ; \ + echo "Doing git pull instead"; cd $(TMPCLONEROOT)/$(NAME_DOCBUILD) ; git pull ; \ + else \ + echo "Cloning $(REPO_DOCBUILD) in $(TMPCLONEROOT)" ; \ + cd "$(TMPCLONEROOT)" ; \ + git clone -b master git@git.enea.se:$(REPO_DOCBUILD) $(NAME_DOCBUILD) ; \ + fi + +cleaninit: + @echo "Clean only local tmpcommon/ and all local temporary symlinks s_docbuild etc." + $(VERB)rm -rf tmpcommon 2>/dev/null ; true + $(VERB)rm s_* 2>/dev/null ; true -- cgit v1.2.3-54-g00ecf