forked from geneweb/geneweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
216 lines (185 loc) · 6.24 KB
/
Makefile
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
ifneq ($(MAKECMDGOALS),ci)
Makefile.config: configure.ml
@if [ -e "$@" ]; then \
echo "configure file has changed. Please rerun ocaml ./configure.ml"; exit 1; \
else \
echo "Please run ocaml ./configure.ml first"; exit 1; \
fi
include Makefile.config
endif
-include Makefile.local
# Variables for packagers.
PREFIX=/usr
DISTRIB_DIR=distribution
BUILD_DIR=_build/default
###### [BEGIN] Generated files section
lib/gwlib.ml:
@echo -n "Generating $@..."
@echo "let prefix =" > $@
@echo " try Sys.getenv \"GWPREFIX\"" >> $@
@echo " with Not_found -> \"$(PREFIX)\"" | sed -e 's|\\|/|g' >> $@
@echo " Done!"
CPPO_D=$(GWDB_D) $(OS_D) $(SYSLOG_D)
ifeq ($(DUNE_PROFILE),dev)
CPPO_D+= -D DEBUG
endif
%/dune: %/dune.in Makefile.config
@echo -n "Generating $@..." \
&& cat $< \
| cppo -n $(CPPO_D) \
| sed \
-e "s/%%%CPPO_D%%%/$(CPPO_D)/g" \
-e "s/%%%SOSA_PKG%%%/$(SOSA_PKG)/g" \
-e "s/%%%GWDB_PKG%%%/$(GWDB_PKG)/g" \
-e "s/%%%SYSLOG_PKG%%%/$(SYSLOG_PKG)/g" \
-e "s/%%%DUNE_DIRS_EXCLUDE%%%/$(DUNE_DIRS_EXCLUDE)/g" \
> $@ \
&& echo " Done!"
bin/gwrepl/.depend:
@echo -n "Generating $@..."
@pwd > $@
@dune top bin/gwrepl >> $@
@echo " Done!"
dune-workspace: dune-workspace.in Makefile.config
cat $< | sed -e "s/%%%DUNE_PROFILE%%%/$(DUNE_PROFILE)/g" > $@
hd/etc/version.txt:
@echo -n "Generating $@..."
@echo "GeneWeb[:] [compiled on %s from commit %s:::" > $@
@echo "$$(date '+%Y-%m-%d'):" >> $@
@echo "$$(git show -s --date=short --pretty=format:'<a href="https://github.com/geneweb/geneweb/commit/%h">%h (%cd)</a>')]" >> $@
@echo " Done!"
.PHONY:hd/etc/version.txt
###### [End] Generated files section
GENERATED_FILES_DEP = \
dune-workspace \
hd/etc/version.txt \
lib/dune \
lib/gwdb/dune \
lib/core/dune \
lib/gwdb-legacy-x-arangodb/dune \
lib/gwlib.ml \
lib/util/dune \
benchmark/dune \
bin/connex/dune \
bin/consang/dune \
bin/fixbase/dune \
bin/ged2gwb/dune \
bin/gwb2ged/dune \
bin/gwc/dune \
bin/gwd/dune \
bin/gwdiff/dune \
bin/gwgc/dune \
bin/gwrepl/dune \
bin/gwrepl/.depend \
bin/gwu/dune \
bin/setup/dune \
bin/update_nldb/dune \
plugins/api/dune \
test/dune \
generated: $(GENERATED_FILES_DEP)
install uninstall build: $(GENERATED_FILES_DEP)
###### [BEGIN] Installation / Distribution section
build:
dune build -p geneweb
.DEFAULT_GOAL = build
install:
dune build @install
dune install
uninstall:
dune build @install
dune uninstall
BUILD_DISTRIB_DIR=$(BUILD_DIR)/bin/
distrib: build
$(RM) -r $(DISTRIB_DIR)
mkdir $(DISTRIB_DIR)
mkdir -p $(DISTRIB_DIR)/bases
cp CHANGES $(DISTRIB_DIR)/CHANGES.txt
cp LICENSE $(DISTRIB_DIR)/LICENSE.txt
cp etc/README.txt $(DISTRIB_DIR)/.
cp etc/LISEZMOI.txt $(DISTRIB_DIR)/.
cp etc/START.htm $(DISTRIB_DIR)/.
if test $(OS_TYPE) = "Win"; then \
cp etc/Windows/gwd.bat $(DISTRIB_DIR); \
cp etc/Windows/gwsetup.bat $(DISTRIB_DIR); \
cp -f etc/Windows/README.txt $(DISTRIB_DIR)/README.txt; \
cp -f etc/Windows/LISEZMOI.txt $(DISTRIB_DIR)/LISEZMOI.txt; \
elif test $(OS_TYPE) = "Darwin"; then \
cp etc/gwd $(DISTRIB_DIR)/gwd.command; \
cp etc/gwsetup $(DISTRIB_DIR)/gwsetup.command; \
cp etc/macOS/geneweb.command $(DISTRIB_DIR); \
else \
cp etc/gwd $(DISTRIB_DIR); \
cp etc/gwsetup $(DISTRIB_DIR); \
fi
mkdir $(DISTRIB_DIR)/gw
cp etc/a.gwf $(DISTRIB_DIR)/gw/.
echo "-setup_link" > $(DISTRIB_DIR)/gw/gwd.arg
cp $(BUILD_DISTRIB_DIR)connex/connex.exe $(DISTRIB_DIR)/gw/connex$(EXT);
cp $(BUILD_DISTRIB_DIR)consang/consang.exe $(DISTRIB_DIR)/gw/consang$(EXT);
cp $(BUILD_DISTRIB_DIR)fixbase/gwfixbase.exe $(DISTRIB_DIR)/gw/gwfixbase$(EXT);
cp $(BUILD_DISTRIB_DIR)ged2gwb/ged2gwb.exe $(DISTRIB_DIR)/gw/ged2gwb$(EXT);
cp $(BUILD_DISTRIB_DIR)gwb2ged/gwb2ged.exe $(DISTRIB_DIR)/gw/gwb2ged$(EXT);
cp $(BUILD_DISTRIB_DIR)gwc/gwc.exe $(DISTRIB_DIR)/gw/gwc$(EXT);
cp $(BUILD_DISTRIB_DIR)gwd/gwd.exe $(DISTRIB_DIR)/gw/gwd$(EXT);
cp $(BUILD_DISTRIB_DIR)gwdiff/gwdiff.exe $(DISTRIB_DIR)/gw/gwdiff$(EXT);
if test -f $(BUILD_DISTRIB_DIR)gwrepl/gwrepl.bc ; then cp $(BUILD_DISTRIB_DIR)gwrepl/gwrepl.bc $(DISTRIB_DIR)/gw/gwrepl$(EXT); fi
cp $(BUILD_DISTRIB_DIR)gwu/gwu.exe $(DISTRIB_DIR)/gw/gwu$(EXT);
cp $(BUILD_DISTRIB_DIR)setup/setup.exe $(DISTRIB_DIR)/gw/gwsetup$(EXT);
cp $(BUILD_DISTRIB_DIR)update_nldb/update_nldb.exe $(DISTRIB_DIR)/gw/update_nldb$(EXT);
mkdir $(DISTRIB_DIR)/gw/setup
cp bin/setup/intro.txt $(DISTRIB_DIR)/gw/setup/
mkdir $(DISTRIB_DIR)/gw/setup/lang
cp bin/setup/setup.gwf $(DISTRIB_DIR)/gw/setup/
cp bin/setup/setup.css $(DISTRIB_DIR)/gw/setup/
cp bin/setup/lang/*.htm $(DISTRIB_DIR)/gw/setup/lang/
cp bin/setup/lang/lexicon.txt $(DISTRIB_DIR)/gw/setup/lang/
cp bin/setup/lang/intro.txt $(DISTRIB_DIR)/gw/setup/lang/
cp -R hd/* $(DISTRIB_DIR)/gw/
mkdir $(DISTRIB_DIR)/gw/plugins
for P in $(shell ls plugins); do \
if [ -f $(BUILD_DIR)/plugins/$$P/plugin_$$P.cmxs ] ; then \
mkdir $(DISTRIB_DIR)/gw/plugins/$$P; \
cp $(BUILD_DIR)/plugins/$$P/plugin_$$P.cmxs $(DISTRIB_DIR)/gw/plugins/$$P/; \
if [ -d plugins/$$P/assets ] ; then \
cp -R $(BUILD_DIR)/plugins/$$P/assets $(DISTRIB_DIR)/gw/plugins/$$P/; \
fi; \
if [ -f $(BUILD_DIR)/plugins/$$P/META ] ; then \
cp $(BUILD_DIR)/plugins/$$P/META $(DISTRIB_DIR)/gw/plugins/$$P/; \
fi; \
fi; \
done
.PHONY: install uninstall distrib
###### [END] Installation / Distribution section
doc: | $(GENERATED_FILES_DEP)
dune build @doc
.PHONY: doc
test: | $(GENERATED_FILES_DEP)
dune build @runtest
.PHONY: test
bench: | $(GENERATED_FILES_DEP)
dune build @runbench
.PHONY: bench
BENCH_FILE ?= /tmp/geneweb-bench.bin
bench-marshal: | $(GENERATED_FILES_DEP)
ifdef BENCH_NAME
dune exec benchmark/bench.exe -- --marshal --name ${BENCH_NAME} ${BENCH_FILE}
else
$(error BENCH_NAME variable is empty)
endif
.PHONY: bench-marshal
bench-tabulate: | $(GENERATED_FILES_DEP)
dune exec benchmark/bench.exe -- --tabulate ${BENCH_FILE}
.PHONY: bench-tabulate
clean:
@echo -n "Cleaning..."
@$(RM) $(GENERATED_FILES_DEP) lib/*_piqi*.ml
@$(RM) -r $(DISTRIB_DIR)
@dune clean
@echo " Done!"
.PHONY: clean
ci:
@ocaml ./configure.ml && BENCH_NAME=vanilla $(MAKE) -s clean test bench-marshal clean
@ocaml ./configure.ml --sosa-num && BENCH_NAME=num $(MAKE) -s clean test bench-marshal clean
@ocaml ./configure.ml --sosa-zarith && BENCH_NAME=zarith $(MAKE) -s clean test bench-marshal clean
@$(MAKE) -s bench-tabulate
.PHONY: ci