@@ -47,7 +47,7 @@ all byte opt:: ${VOLATILE_SCHEMA}
4747
4848DIST_FILES = $(ELIOMSTATICDIR)/ $(PROJECT_NAME).js $(LIBDIR)/ $(PROJECT_NAME).cma
4949
50- .PHONY: test.byte test.opt staticfiles
50+ .PHONY: test.byte test.opt staticfiles byte opt
5151
5252test.byte:: byte | $(addprefix $(TEST_PREFIX), $(DIST_DIRS)) staticfiles
5353 @echo "==== The website is available at http://localhost:$(TEST_PORT) ===="
@@ -56,30 +56,52 @@ test.opt:: opt | $(addprefix $(TEST_PREFIX),$(DIST_DIRS)) staticfiles
5656 @echo "==== The website is available at http://localhost:$(TEST_PORT) ===="
5757 $(OCSIGENSERVER.OPT) $(RUN_DEBUG) - c $(patsubst % .conf.in, $(TEST_PREFIX)$(ETCDIR)/%- test.conf, $(CONF_IN))
5858
59+ test.static.byte: static.byte | $(addprefix $(TEST_PREFIX), $(DIST_DIRS)) staticfiles
60+ @echo "==== The website is available at http://localhost:$(TEST_PORT) ===="
61+ dune exec ./ $(PROJECT_NAME)_main.bc
62+ test.static.opt: static.opt | $(addprefix $(TEST_PREFIX), $(DIST_DIRS)) staticfiles
63+ @echo "==== The website is available at http://localhost:$(TEST_PORT) ===="
64+ dune exec ./ $(PROJECT_NAME)_main.exe
65+
5966$(addprefix $(TEST_PREFIX), $(DIST_DIRS)):
6067 mkdir - p $@
6168
6269staticfiles:
6370 cp - rf $(LOCAL_STATIC_CSS) $(LOCAL_STATIC_IMAGES) $(LOCAL_STATIC_FONTS) $(TEST_PREFIX)$(ELIOMSTATICDIR)
6471
72+ ##----------------------------------------------------------------------
73+ ## Static executable
74+
75+ static.byte: byte
76+ dune build $(PROJECT_NAME)_main.bc
77+
78+ static.opt: opt
79+ dune build $(PROJECT_NAME)_main.exe
80+
6581##----------------------------------------------------------------------
6682## Installing & Running
6783
68- .PHONY: install install.byte install.byte install.opt install.static install.etc install.lib install.lib.byte install.lib.opt run.byte run.opt
84+ .PHONY: install install.exe install. byte install.byte install.opt install.static install.etc install.lib install.lib.byte install.lib.opt run.byte run.opt
6985install: install.byte install.opt
86+ install.exe: install.etc install.static
87+ dune install
7088install.byte: install.lib.byte install.etc install.static | $(addprefix $(PREFIX), $(DATADIR) $(LOGDIR) $(shell dirname $(CMDPIPE)))
7189install.opt: install.lib.opt install.etc install.static | $(addprefix $(PREFIX), $(DATADIR) $(LOGDIR) $(shell dirname $(CMDPIPE)))
7290install.lib: install.lib.byte install.lib.opt
73- install.lib.byte: $(TEST_PREFIX)$(LIBDIR) / $(PROJECT_NAME).cma | $(PREFIX)$(LIBDIR)
74- install $< $(PREFIX)$(LIBDIR)
75- install.lib.opt: $(TEST_PREFIX)$(LIBDIR) / $(PROJECT_NAME).cmxs | $(PREFIX)$(LIBDIR)
76- install $< $(PREFIX)$(LIBDIR)
91+ install.lib.byte: byte | $(PREFIX)$(LIBDIR)
92+ install $(TEST_PREFIX)$(LIBDIR) / $(PROJECT_NAME).cma $(PREFIX)$(LIBDIR)
93+ install.lib.opt: opt | $(PREFIX)$(LIBDIR)
94+ install $(TEST_PREFIX)$(LIBDIR) / $(PROJECT_NAME).cmxs $(PREFIX)$(LIBDIR)
7795install.static: $(TEST_PREFIX)$(ELIOMSTATICDIR)/ $(PROJECT_NAME).js | $(PREFIX)$(STATICDIR) $(PREFIX)$(ELIOMSTATICDIR)
78- cp - r $(LOCAL_STATIC_CSS) $(PREFIX)$(FILESDIR)
7996 cp - r $(LOCAL_STATIC_IMAGES) $(PREFIX)$(FILESDIR)
8097 cp - r $(LOCAL_STATIC_FONTS) $(PREFIX)$(FILESDIR)
8198 [ - z $(WWWUSER) ] || chown - R $(WWWUSER) $(PREFIX)$(FILESDIR)
82- install $(addprefix - o , $(WWWUSER)) $< $(PREFIX)$(ELIOMSTATICDIR)
99+ HASH= `md5sum _build/ default/ client/ $(PROJECT_NAME).bc.js | cut - d ' ' - f 1 ` && \
100+ install $(addprefix - o , $(WWWUSER)) $(JS_PREFIX)_$$HASH.js $(PREFIX)$(ELIOMSTATICDIR) && \
101+ ln - sf $(PROJECT_NAME)_$$HASH.js $(PREFIX)$(ELIOMSTATICDIR)/ $(PROJECT_NAME).js
102+ HASH= `cat $(LOCAL_CSS) | md5sum | cut - d ' ' - f 1 ` && \
103+ install $(addprefix - o , $(WWWUSER)) $(CSS_PREFIX)_$$HASH.css $(PREFIX)$(ELIOMSTATICDIR)/ css && \
104+ ln - sf $(PROJECT_NAME)_$$HASH.css $(PREFIX)$(ELIOMSTATICDIR)/ css/ $(PROJECT_NAME).css
83105install.etc: $(TEST_PREFIX)$(ETCDIR)/ $(PROJECT_NAME).conf | $(PREFIX)$(ETCDIR)
84106 install $< $(PREFIX)$(ETCDIR)/ $(PROJECT_NAME).conf
85107
@@ -95,12 +117,19 @@ $(addprefix $(PREFIX),$(DATADIR) $(LOGDIR) $(ELIOMSTATICDIR) $(shell dirname $(C
95117 install $(addprefix - o , $(WWWUSER)) - d $@
96118
97119run.byte:
120+ @echo "==== Running ocsigenserver with configuration file ===="
98121 @echo "==== The website is available at http://localhost:$(PORT) ===="
99122 $(OCSIGENSERVER) $(RUN_DEBUG) - c ${PREFIX}${ETCDIR}/ ${PROJECT_NAME}.conf
100123run.opt:
124+ @echo "==== Running ocsigenserver with configuration file ===="
101125 @echo "==== The website is available at http://localhost:$(PORT) ===="
102126 $(OCSIGENSERVER.OPT) $(RUN_DEBUG) - c ${PREFIX}${ETCDIR}/ ${PROJECT_NAME}.conf
103127
128+ run.static:
129+ @echo "==== Running static executable ===="
130+ @echo "==== The website is available at http://localhost:$(PORT) ===="
131+ ${PROJECT_NAME}
132+
104133##----------------------------------------------------------------------
105134
106135##----------------------------------------------------------------------
@@ -155,7 +184,7 @@ $(TEST_CONFIG_FILES): $(TEST_PREFIX)$(ETCDIR)/%-test.conf: %.conf.in $(JS_AND_CS
155184##----------------------------------------------------------------------
156185## Compilation
157186
158- .PHONY: gen - dune config- files
187+ .PHONY: config- files
159188
160189config- files: | $(TEST_PREFIX)$(ELIOMSTATICDIR) $(TEST_PREFIX)$(LIBDIR)
161190 HASH= `md5sum _build/ default/ client/ $(PROJECT_NAME).bc.js | cut - d ' ' - f 1 ` && \
@@ -164,20 +193,17 @@ config-files: | $(TEST_PREFIX)$(ELIOMSTATICDIR) $(TEST_PREFIX)$(LIBDIR)
164193 cp - f _build/ default/ $(PROJECT_NAME).cm* $(TEST_PREFIX)$(LIBDIR)/
165194 $(MAKE) $(CONFIG_FILES) $(TEST_CONFIG_FILES) PROJECT_NAME= $(PROJECT_NAME)
166195
167- all:: gen - dune
196+ all::
168197 $(ENV_PSQL) dune build $(DUNE_OPTIONS) @install @$(PROJECT_NAME) $(PROJECT_NAME).cmxs
169198
170- byte:: gen - dune
199+ byte::
171200 $(ENV_PSQL) dune build $(DUNE_OPTIONS) @$(PROJECT_NAME)
172201 make config- files PROJECT_NAME= $(PROJECT_NAME)
173202
174- opt:: gen - dune
203+ opt::
175204 $(ENV_PSQL) dune build $(DUNE_OPTIONS) $(PROJECT_NAME).cmxs @$(PROJECT_NAME)
176205 make config- files PROJECT_NAME= $(PROJECT_NAME)
177206
178- gen- dune:
179- @ocaml tools/ gen_dune.ml > client/ dune.client
180-
181207##----------------------------------------------------------------------
182208
183209##----------------------------------------------------------------------
0 commit comments