forked from geneweb/geneweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
247 lines (215 loc) · 7.32 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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
Makefile.config: configure
@if [ -e "$@" ]; then \
echo "configure file has changed. Please rerun ./configure"; exit 1; \
else \
echo "Please run ./configure first"; exit 1; \
fi
include Makefile.config
-include Makefile.local
# Variables for packagers.
PREFIX=/usr
DISTRIB_DIR=distribution
BUILD_DIR=_build/default
###### [BEGIN] Executables list
INSTALL_EXE = \
src/gwc1 \
src/gwc2 \
src/mk_consang \
src/gwd \
src/gwu \
src/update_nldb \
ged2gwb/ged2gwb \
ged2gwb/ged2gwb2 \
gwb2ged/gwb2ged \
setup/setup
DISTRIB_EXE = $(INSTALL_EXE) gwtp/gwtp
ALL_EXE = \
$(INSTALL_EXE) \
gwtp/gwtp \
gui/gui \
contrib/gwpublic/gwpublic1 \
contrib/gwpublic/gwpublic2 \
contrib/gwpublic/gwpublic2priv \
contrib/gwpublic/gwprivate \
contrib/gwpublic/gwiftitles \
contrib/gwFix/gwFixBase \
contrib/gwFix/gwFixFromFile \
contrib/gwFix/gwFixFromFileDomicile \
contrib/gwFix/gwFixFromFileAlias \
contrib/gwFix/gwFixBurial \
contrib/gwFix/gwFixEvtSrc \
contrib/gwFix/gwFixColon \
contrib/gwFix/gwFindCpl \
contrib/gwFix/gwFixY \
contrib/gwdiff/gwdiff \
contrib/gwbase/etc/public \
contrib/gwbase/etc/public2 \
contrib/history/convert_hist \
contrib/history/fix_hist \
contrib/history/is_gw_plus \
contrib/lex/lex_utils \
contrib/misc/lower_string \
contrib/oneshot/gwRemoveImgGallery \
contrib/oneshot/gwBaseCompatiblePlus \
contrib/oneshot/gwFixDateText \
contrib/oneshot/gwExportAscCSV
EVERYTHING_EXE = \
$(ALL_EXE) \
contrib/gwbase/etc/geneanet \
contrib/gwbase/etc/clavier \
contrib/gwbase/etc/connex \
contrib/gwbase/etc/hist \
contrib/gwbase/etc/selroy \
contrib/gwbase/etc/chkimg \
contrib/gwbase/etc/consmoy \
contrib/gwbase/etc/lune \
contrib/gwbase/etc/titres \
contrib/gwbase/etc/gwck \
contrib/gwbase/etc/nbdesc \
contrib/gwbase/etc/probot \
contrib/oneshot/gwFixAddEvent \
contrib/oneshot/gwMostAsc \
contrib/dag2html/main \
gwtp/recover \
src/check_base \
src/i18n_check
###### [END] Executables list
###### [BEGIN] Generated files section
CAMLP5_PA_EXTEND_FILES = \
ged2gwb/ged2gwb \
ged2gwb/ged2gwb2 \
src/pr_transl \
lib/templ \
lib/update \
setup/setup
CAMLP5_Q_MLAST_FILES = \
src/pr_transl \
lib/templ
CAMLP5_FILES = $(sort $(CAMLP5_Q_MLAST_FILES) $(CAMLP5_PA_EXTEND_FILES))
$(CAMLP5_PA_EXTEND_FILES:=.ml): CAMLP5_OPT += pa_extend.cmo
$(CAMLP5_Q_MLAST_FILES:=.ml): CAMLP5_OPT += q_MLast.cmo
%.ml: CAMLP5_OPT=
%.ml: %.camlp5
@([ -z "$(CAMLP5_OPT)" ] \
|| false \
&& echo "ERROR generating $@: CAMLP5_OPT variable must be defined") \
|| (echo -n "Generating $@..." \
&& echo "(* DO NOT EDIT *)" > $@ \
&& echo "(* This file was generated from $< *)" >> $@ \
&& camlp5o pr_o.cmo $(CAMLP5_OPT) -impl $< >> $@ \
&& sed -i.bak -E 's/[(]\* (\[@.+\]) \*[)]/\1/g' $@ \
&& sed -i.bak -E 's/[(]\* (#[^\*]+) \*[)]/\1/g' $@ \
&& rm [email protected] \
&& echo " Done!")
lib/gwlib.ml:
echo "let prefix =" > $@
echo " try Sys.getenv \"GWPREFIX\"" >> $@
echo " with Not_found -> \"$(PREFIX)\"" | sed -e 's|\\|/|g' >> $@
lib/compilation.ml:
echo "let scan_dmy s =" > $@
echo "let open Adef in" >> $@
echo "Scanf.sscanf s \"%d %d %d\" @@ fun day month year ->" >> $@
echo "Dgreg({day;month;year;prec=Sure;delta=0},Dgregorian)" >> $@
echo "let compilation_time = scan_dmy \"$$(date "+%d %m %Y")\"" >> $@
echo "let commit = \"$$(git show -s --pretty=format:%h)\"" >> $@
echo "let commit_date = scan_dmy \"$$(git show -s --pretty=format:%cd --date=format:'%d %m %Y')\"" >> $@
.PHONY:lib/compilation.ml
%/dune: %/dune.in
sed -e "s/%%%API%%%/$(API)/g" -e "s/%%%API_DEP%%%/$(API_DEP)/g" $< > $@
###### [End] Generated files section
GENERATED_FILES_DEP = lib/gwlib.ml $(CAMLP5_FILES:=.ml) lib/dune lib/compilation.ml
ifdef API
piqi:
$(foreach p, $(wildcard lib/*.proto), \
piqi of-proto --normalize $(p) ; \
piqic-ocaml -C lib/ --ext $(p).piqi ; \
)
$(RM) lib/*.piqi
else
piqi:
endif
.PHONY: piqi
geneweb.install:
dune build @install
.PHONY: geneweb.install
install-exe:
dune build $(INSTALL_EXE:=.exe)
distrib-exe:
dune build $(DISTRIB_EXE:=.exe)
exe:
dune build $(ALL_EXE:=.exe)
everything-exe:
dune build $(EVERYTHING_EXE:=.exe)
.DEFAULT_GOAL = exe
geneweb.install install-exe distrib-exe exe everything-exe: $(GENERATED_FILES_DEP) piqi
###### [BEGIN] Installation / Distribution section
install: geneweb.install
dune install geneweb
uninstall: geneweb.install
dune uninstall geneweb
distrib: distrib-exe
$(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 "127.0.0.1" > $(DISTRIB_DIR)/gw/only.txt
echo "-setup_link" > $(DISTRIB_DIR)/gw/gwd.arg
cp $(BUILD_DIR)/src/gwc1.exe $(DISTRIB_DIR)/gw/gwc$(EXE); \
cp $(BUILD_DIR)/src/gwc1.exe $(DISTRIB_DIR)/gw/gwc1$(EXE); \
cp $(BUILD_DIR)/src/gwc2.exe $(DISTRIB_DIR)/gw/gwc2$(EXE); \
cp $(BUILD_DIR)/src/mk_consang.exe $(DISTRIB_DIR)/gw/mk_consang$(EXE); \
cp $(BUILD_DIR)/src/mk_consang.exe $(DISTRIB_DIR)/gw/consang$(EXE); \
cp $(BUILD_DIR)/src/gwd.exe $(DISTRIB_DIR)/gw/gwd$(EXE); \
cp $(BUILD_DIR)/src/gwu.exe $(DISTRIB_DIR)/gw/gwu$(EXE); \
cp $(BUILD_DIR)/ged2gwb/ged2gwb.exe $(DISTRIB_DIR)/gw/ged2gwb$(EXE); \
cp $(BUILD_DIR)/ged2gwb/ged2gwb2.exe $(DISTRIB_DIR)/gw/ged2gwb2$(EXE); \
cp $(BUILD_DIR)/gwb2ged/gwb2ged.exe $(DISTRIB_DIR)/gw/gwb2ged$(EXE); \
cp $(BUILD_DIR)/contrib/gwbase/etc/connex.exe $(DISTRIB_DIR)/gw/connex$(EXE); \
cp $(BUILD_DIR)/contrib/gwdiff/gwdiff.exe $(DISTRIB_DIR)/gw/gwdiff$(EXE); \
cp $(BUILD_DIR)/setup/setup.exe $(DISTRIB_DIR)/gw/gwsetup$(EXE); \
cp $(BUILD_DIR)/src/update_nldb.exe $(DISTRIB_DIR)/gw/update_nldb$(EXE); \
mkdir $(DISTRIB_DIR)/gw/gwtp_tmp
mkdir $(DISTRIB_DIR)/gw/gwtp_tmp/lang
cp gwtp/README $(DISTRIB_DIR)/gw/gwtp_tmp/.
cp $(BUILD_DIR)/gwtp/gwtp.exe $(DISTRIB_DIR)/gw/gwtp_tmp/gwtp$(EXE)
cp gwtp/lang/*.txt $(DISTRIB_DIR)/gw/gwtp_tmp/lang/.
mkdir $(DISTRIB_DIR)/gw/setup
cp setup/intro.txt $(DISTRIB_DIR)/gw/setup/
mkdir $(DISTRIB_DIR)/gw/setup/lang
cp setup/setup.gwf $(DISTRIB_DIR)/gw/setup/
cp setup/setup.css $(DISTRIB_DIR)/gw/setup/
cp setup/lang/*.htm $(DISTRIB_DIR)/gw/setup/lang/
cp setup/lang/lexicon.txt $(DISTRIB_DIR)/gw/setup/lang/
cp setup/lang/intro.txt $(DISTRIB_DIR)/gw/setup/lang/
cp -R hd/* $(DISTRIB_DIR)/gw/
$(RM) $(DISTRIB_DIR)/exe-version.txt
echo "Commit: `git log -1 | grep commit | cut -c8-15`, `date`" > $(DISTRIB_DIR)/commit.txt
echo "`ocaml -version`" >> $(DISTRIB_DIR)/commit.txt
echo "`camlp5 -v 2>&1`" >> $(DISTRIB_DIR)/commit.txt
echo "-----" >> $(DISTRIB_DIR)/commit.txt
.PHONY: install uninstall distrib
###### [END] Installation / Distribution section
clean:
$(RM) $(GENERATED_FILES_DEP) lib/*_piqi*.ml
$(RM) -r distribution
dune clean
.PHONY: clean