-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile.in
182 lines (143 loc) · 5.4 KB
/
Makefile.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
CURRENT_DIR := $(shell pwd)
GENERATOR_DIR = @GENERATOR_DIR@
OPAMSHAREDIR = @OPAMSHAREDIR@
OPAMBINDIR = @OPAMBINDIR@
OPAMLIBDIR = @OPAMLIBDIR@
OPAM = @OPAM@
JSEXP_OPAM_SHARE_DIR := $(OPAMSHAREDIR)/jsexplain
######################################
NAME := jsexplain
GIT_REPO := https://github.com/jscert/$(NAME).git
GIT_BRANCH := $$(git rev-parse --abbrev-ref HEAD)
TMP_DIR := /tmp
TMP_NAME := $(TMP_DIR)/$(NAME)
VERSION := 1.0
TGZ := $(NAME)-$(VERSION).tar.gz
MD5TXT := $(TGZ).md5sum.txt
OPAM_REPO_GIT := ~/git/opam-repository
DATE_ARCHIVE := $(shell date +%Y-%m-%d-%H-%M-%S)
TGZ_ARCHIVE := $(NAME)-$(VERSION)-$(DATE_ARCHIVE).tar.gz
HTDOCS_DIR := /home/groups/jsexplain/htdocs
OPAM_PROD_DIR := $(HTDOCS_DIR)/opam/$(NAME)
CURRENT_COMMIT := $(NAME)_current_commit
######################################
all: mljsjsref
# Build Stages
mljsjsref:
cd $(CURRENT_DIR)/jsref ; autoconf ; ./configure
ifeq ($(GENERATOR_DIR),no)
@read -p "Please fill path to GENERATOR_DIR (root of fjs_of_fml project):" g;\
$(MAKE) -C jsref jsjsref GENERATOR_DIR=$$g STDLIB_DIR=$$g/src/stdlib_fml;\
$(MAKE) -C jsref mljsref GENERATOR_DIR=$$g STDLIB_DIR=$$g/src/stdlib_fml
else
$(MAKE) -C jsref jsjsref; $(MAKE) -C jsref mljsref
endif
# Test Stages
test_init: test/data/test262
test: test_jsjsref test_init
npm :
npm install
test_jsjsref: mljsjsref npm
node_modules/.bin/mocha
test/data/test262: FORCE
git submodule update --init test/data/test262
test/data/test262/%: FORCE
git submodule update --init test/data/test262
# Documentation
doc: doc/jsref
esdocgen:
$(MAKE) -C tools/esdocgen
doc/jsref: esdocgen
$(MAKE) -C jsref doc
rm -rf $@ || true
mv jsref/doc_build $@
# Publication Stages
PUB_FILES=driver.html driver.css js/libraries js/jquery-ui-1.11.4.custom js/jquery_scroll \
jsref/displayed_sources.js js/tools.js node_modules/esprima/esprima.js \
js/esprima-to-ast.js jsref/lineof.js js/navig-driver.js js/codemirror-tabs.js \
jsref/assembly.js doc/documentation.html doc/screenshots doc/jsref \
test/data/*.js test/data/test262/harness/*.js jsref/JsInterpreter.url.js
dist: mljsjsref $(PUB_FILES)
mkdir -p $@
rsync -Rrv $(PUB_FILES) $@
publish: dist
# /./ syntax tells rsync where to start relative paths from
rsync -azR --no-p --rsh=ssh -O $^/./ gf:/home/groups/ajacs/htdocs/jsexplain/
publish-github: dist
tools/upload-github-pages.sh dist
.PHONY: publish publish-github
# Opam Install
OPAM_FILES=$(PUB_FILES)
opam_install : all $(OPAM_FILES)
ifeq ($(OPAM),opam)
ifneq ($(OPAMBINDIR),)
ifneq ($(OPAMLIBDIR),)
@mkdir -p $(JSEXP_OPAM_SHARE_DIR)
@rsync -Rrv --ignore-errors $(OPAM_FILES) $(JSEXP_OPAM_SHARE_DIR)
endif
endif
endif
######################################
# Forge Install : Push current branch a current state ->
# WARNING : could be asynchronous with .tgz file
# Website : http://jsexplain.gforge.inria.fr
# http://jsexplain.gforge.inria.fr/index.html is a symbolic link on
# http://jsexplain.gforge.inria.fr/driver.html
forge_install : all $(OPAM_FILES)
git rev-parse HEAD > $(CURRENT_COMMIT); \
read -p "User ?" FORGE_USER; \
rsync -Rarve ssh $(OPAM_FILES) $(CURRENT_COMMIT) [email protected]:$(HTDOCS_DIR)
######################################
# Deployment
# Inria gorge : https://gforge.inria.fr/
# INFO : ssh connexion can be done this way ssh scm.gforge.inria.fr -l <LOGIN>
# files are in /home/groups/jsexplain
# Caution : One could say that these commands should be remove from the Makefile for security
# reasons.
# WARNING : Archive file is based on current branch !
$(TGZ) :
rm -rf $(TMP_NAME) $(TGZ)
mkdir $(TMP_NAME)
git clone $(GIT_REPO) $(TMP_NAME)
git -C $(TMP_NAME)/ checkout $(GIT_BRANCH)
rm -rf $(TMP_NAME)/.git
tar -cvzf $(TGZ) -C $(TMP_DIR) $(NAME)
md5sum $(TGZ) > $(MD5TXT)
package : $(TGZ)
######################################
# WARNING : md5sum of opam file in the tgz archive won't ever be the same
# as the one in opam-repository.
# This should not be an issue since the md5sum checked is the one in
# in Opam repository not the one in the archive.
# And it's done only at dowload time, not when the package is pinned.
opam_file_update : package
sed -i -r 's|^(\schecksum: "md5\s*=\s*).*"|\1'$$(cat *.txt | cut -d" " -f 1)'"|' opam
cp opam $(OPAM_REPO_GIT)/packages/$(NAME)/$(NAME).$(VERSION)
######################################
# WARNING/FIXME : On version upgrade archive will fail.
# Manual backup on forge will be needed.
# scp copy could be based on $(NAME)-*.tar.gz but deletion would still remain a problem ...
deploy : opam_file_update
read -p "User ?" FORGE_USER; \
scp -p [email protected]:$(OPAM_PROD_DIR)/$(TGZ) $(TMP_DIR)/$(TGZ_ARCHIVE); \
scp -p $(TMP_DIR)/$(TGZ_ARCHIVE) [email protected]:$(OPAM_PROD_DIR)/old/$(TGZ_ARCHIVE); \
scp -p $(TGZ) [email protected]:$(OPAM_PROD_DIR)
# Development support
open: mljsjsref
xdg-open driver.html &
opendoc: doc
xdg-open doc/jsref/index.html &
.merlin: FORCE
echo "FLG -ppx $(GENERATOR_DIR)/monad_ppx.byte" > $@
.PHONY: open opendoc
# Clean stages
clean:
$(MAKE) -C jsref clean
$(MAKE) -C tools/esdocgen clean
rm -Rf doc/jsref || true
rm -Rf dist || true
rm -Rf jsref/autom4te.cache jsref/config.status jsref/configure jsref/Makefile $(JSEXP_OPAM_SHARE_DIR) $(CURRENT_COMMIT)
rm -Rf autom4te.cache config.status configure *.log *.tar.gz *.md5sum.txt
FORCE:
.PHONY: mljsjsref test_init test doc esdocgen clean package
.NOTPARALLEL: