summaryrefslogtreecommitdiffstats
path: root/init.mk
diff options
context:
space:
mode:
authorMiruna Paun <Miruna.Paun@enea.com>2017-04-07 12:27:55 +0200
committerMiruna Paun <Miruna.Paun@enea.com>2017-04-07 12:27:55 +0200
commit74c97c90a9fa10ebad46ec00061da9e2578b33a7 (patch)
tree9a6169d87c2b9ff598e83ae218c54c8400cefb78 /init.mk
downloaddoc-enea-nfv-74c97c90a9fa10ebad46ec00061da9e2578b33a7.tar.gz
Updated ENFV (COSNOS) Installation Guide
COSNOSCR-318 seeking to complete first time push
Diffstat (limited to 'init.mk')
-rw-r--r--init.mk63
1 files changed, 63 insertions, 0 deletions
diff --git a/init.mk b/init.mk
new file mode 100644
index 0000000..1c3035c
--- /dev/null
+++ b/init.mk
@@ -0,0 +1,63 @@
1# ver R1.00/2017-03-16 Creation of this file
2# ver R2.00/2017-04-05 Updated the docbuild.git clone command.
3
4ifeq ($(VERBOSE),yes)
5VERB :=
6else
7VERB := @
8endif
9
10#Git repositories to be cloned
11REPO_DOCBUILD := build/docbuild.git
12NAME_DOCBUILD := docbuild
13
14GLOBALTMPCLONEROOT = ../../tmpcommon
15ifeq ($(BOOK_GLOBALCLONEROOT),)
16 TMPCLONEROOT := tmpcommon
17else
18 ifeq ($(BOOK_GLOBALCLONEROOT),yes)
19 TMPCLONEROOT := $(GLOBALTMPCLONEROOT)
20 else
21 TMPCLONEROOT := $(BOOK_GLOBALCLONEROOT)/tmpcommon
22 endif
23endif
24DIR_TMPCLONEROOT := $(dir $(TMPCLONEROOT))
25ifeq ($(wildcard $(DIR_TMPCLONEROOT)),)
26$(error Parent of selected clone root does not exist ($(DIR_TMPCLONEROOT)))
27endif
28
29.PHONY: initbuild usageinit cleaninit
30# Keep usageinit as default target here to avoid init by mistake
31
32usageinit: docusage
33 @echo 'make initbuild Create s_docbuild and if it does not exist, clone docbuild.git'
34 @echo ' Default clone in tmpcommon'
35 @echo ' BOOK_GLOBALCLONEROOT=yes Clone in $(GLOBALTMPCLONEROOT)'
36 @echo ' BOOK_GLOBALCLONEROOT=parentdir Clone in parentdir/tmpcommon'
37
38 @echo 'make pullbuild git pull in s_docbuild'
39 @echo 'make cleaninit Delete all s_* symlinks and local tmpcommon/'
40
41
42initbuild: s_docbuild
43pullbuild:
44 $(VERB)if [ ! -d s_docbuild ]; then echo "ERROR: No s_docbuild exists?" ; exit 10 ; fi
45 $(VERB)cd s_docbuild ; git pull
46s_docbuild: $(TMPCLONEROOT)/$(NAME_DOCBUILD)
47 $(VERB)rm s_docbuild 2>/dev/null; ln -s $(TMPCLONEROOT)/$(NAME_DOCBUILD) s_docbuild
48
49$(TMPCLONEROOT)/$(NAME_DOCBUILD):
50 $(VERB)if [ ! -d "$(TMPCLONEROOT)" ] ; then mkdir -p "$(TMPCLONEROOT)" ; fi
51 $(VERB)if [ -d "$(TMPCLONEROOT)/$(NAME_DOCBUILD)" ] ; then \
52 echo "Already exists $(TMPCLONEROOT)/$(NAME_DOCBUILD)" ; \
53 echo "Doing git pull instead"; cd $(TMPCLONEROOT)/$(NAME_DOCBUILD) ; git pull ; \
54 else \
55 echo "Cloning $(REPO_DOCBUILD) in $(TMPCLONEROOT)" ; \
56 cd "$(TMPCLONEROOT)" ; \
57 git clone -b master git@git.enea.se:$(REPO_DOCBUILD) $(NAME_DOCBUILD) ; \
58 fi
59
60cleaninit:
61 @echo "Clean only local tmpcommon/ and all local temporary symlinks s_docbuild etc."
62 $(VERB)rm -rf tmpcommon 2>/dev/null ; true
63 $(VERB)rm s_* 2>/dev/null ; true