Fix outstanding bugs
[pkg-ocaml-ocsigen.git] / Makefile
blob3d7772a949d0b8da4caa9702327846d0c2587ac3
1 include Makefile.config
3 VERSION := $(shell head -n 1 VERSION)
5 DOCPREF=./
7 # sed commands used for generation of META files
8 SED_COMMAND_FOR_META =
9 SED_COMMAND_FOR_META += -e "s/_VERSION_/$(VERSION)/"
10 SED_COMMAND_FOR_META += -e "s/_CAMLZIPNAME_/$(CAMLZIPNAME)/"
11 SED_COMMAND_FOR_META += -e "s@_DIRECTORY_@$(MODULEINSTALLDIR)/$(OCSIGENNAME)@"
13 ifeq "$(OCAMLDUCE)" "YES"
14 DUCECMA=eliom/eliom_duce.cma
15 DUCECMO=
16 #eliom/eliom_duce.cma
17 # eliom/ocsigenrss.cma
18 DUCECMI=eliom/eliom_duce.cmi eliom/xhtmltypes_duce.cmi eliom/eliom_duce_tools.cmi
19 # eliom/rss2.cmi eliom/ocsigenrss.cmi
20 DUCEEXAMPLES=examples/ocamlduce/exampleduce.cmo
21 # examples/ocamlduce/examplerss.cmo
22 DUCEDOC=$(DOCPREF)eliom/eliom_duce.mli $(DOCPREF)eliom/xhtmltypes_duce.ml $(DOCPREF)eliom/eliom_duce_tools.ml
23 CAMLDOC = $(OCAMLDUCEFIND) ocamldoc $(LIB)
24 DUCEPACK=,ocamlduce
25 else
26 DUCECMA=
27 DUCECMO=
28 DUCECMI=
29 DUCEEXAMPLES=
30 DUCEDOC=
31 CAMLDOC = $(OCAMLFIND) ocamldoc $(LIB)
32 DUCEPACK=
33 endif
35 ifeq "$(LOGDIR)" ""
36 LOGDIR = "error"
37 endif
38 ifeq "$(STATICPAGESDIR)" ""
39 STATICPAGESDIR = "error"
40 endif
41 ifeq "$(DATADIR)" ""
42 DATADIR = "error"
43 endif
45 ifeq "$(OCSIPERSISTSQLITE)" "YES"
46 SQLITECMATOINSTALL= extensions/ocsipersist-sqlite.cma
47 else
48 endif
50 ifeq "$(CAMLZIP)" "YES"
51 DEFLATEMODCMOTOINSTALL= extensions/deflatemod.cmo
52 else
53 endif
55 ifeq "$(OCSIPERSISTDBM)" "YES"
56 DBMCMATOINSTALL= extensions/ocsipersist-dbm/ocsipersist-dbm.cma
57 else
58 endif
60 DOC= $(DOCPREF)eliom/eliom_mkforms.mli $(DOCPREF)eliom/eliom_mkreg.mli \
61 $(DOCPREF)eliom/eliom_predefmod.mli \
62 $(DOCPREF)eliom/eliom_common.mli \
63 $(DOCPREF)eliom/eliom_parameters.mli \
64 $(DOCPREF)eliom/eliom_services.mli \
65 $(DOCPREF)eliom/eliom_sessions.mli \
66 $(DOCPREF)eliom/eliom_extensions.mli \
67 $(DOCPREF)server/ocsigen_extensions.mli \
68 $(DOCPREF)server/ocsigen_parseconfig.mli \
69 $(DOCPREF)server/ocsigen_server.mli \
70 $(DOCPREF)xmlp4/xhtmlpretty_streams.mli \
71 $(DOCPREF)xmlp4/xhtmlcompact_streams.mli \
72 $(DOCPREF)xmlp4/xhtmlpretty.mli \
73 $(DOCPREF)xmlp4/xhtmlcompact.mli \
74 $(DOCPREF)xmlp4/ohl-xhtml/xHTML.mli \
75 $(DOCPREF)baselib/ocsigen_messages.mli \
76 $(DOCPREF)http/ocsigen_headers.mli \
77 $(DOCPREF)server/ocsigen_http_client.mli \
78 $(DOCPREF)http/ocsigen_http_frame.mli \
79 $(DOCPREF)http/ocsigen_http_com.mli \
80 $(DOCPREF)http/ocsigen_charset_mime.mli \
81 $(DOCPREF)http/ocsigen_senders.mli \
82 $(DOCPREF)baselib/ocsigen_stream.mli \
83 $(DOCPREF)eliom/eliom_tools_common.mli \
84 $(DOCPREF)eliom/eliom_tools.mli \
85 $(DOCPREF)eliom/eliom_obrowser.mli \
86 $(DOCPREF)baselib/polytables.mli \
87 $(DOCPREF)baselib/ocsigen_cache.mli \
88 $(DOCPREF)extensions/ocsipersist.mli \
89 $(DOCPREF)extensions/authbasic.mli \
90 $(DOCPREF)extensions/ocsigen_LocalFiles.mli \
91 $(DOCPREF)baselib/ocsigen_getcommandline.mli \
92 $(DOCPREF)xmlp4/newocaml/pp/simplexmlparser.mli \
93 $(DOCPREF)xmlp4/newocaml/pp/xhtmltypes.ml \
94 $(DUCEDOC)
96 METAS = files/META files/META.ocsigen_xhtml files/META.ocsigen files/META.eliom_examples files/META.eliom_examples.global
99 INSTALL = install
100 TARGETSBYTE = baselib.byte xmlp4.byte http.byte server.byte extensions.byte eliom.byte examples.byte
102 # plugins are cma (and cmxs) that can be loaded dynamically by the server
103 PLUGINSCMATOINSTALL = $(SQLITECMATOINSTALL) $(DBMCMATOINSTALL) \
104 eliom/eliom.cma $(DEFLATEMODCMATOINSTALL) $(DUCECMA) \
105 baselib/parsecommandline.cma baselib/donotparsecommandline.cma
106 PLUGINSCMOTOINSTALL = \
107 $(SQLITECMOTOINSTALL) $(DBMCMOTOINSTALL) $(DEFLATEMODCMOTOINSTALL) \
108 extensions/staticmod.cmo extensions/cgimod.cmo \
109 extensions/revproxy.cmo extensions/userconf.cmo \
110 extensions/outputfilter.cmo extensions/authbasic.cmo \
111 extensions/redirectmod.cmo extensions/rewritemod.cmo \
112 extensions/accesscontrol.cmo extensions/extendconfiguration.cmo \
113 baselib/polytables.cmo $(DUCECMO)
114 PLUGINSCMITOINSTALL = extensions/ocsipersist.cmi \
115 eliom/eliom_mkforms.cmi eliom/eliom_mkreg.cmi \
116 eliom/eliom_tools_common.cmi eliom/eliom_tools.cmi \
117 eliom/eliom_obrowser.cmi \
118 $(DUCECMI) \
119 eliom/eliom_sessions.cmi eliom/eliom_parameters.cmi \
120 eliom/eliom_services.cmi eliom/eliom_predefmod.cmi \
121 eliom/eliommod.cmi eliom/eliom_common.cmi eliom/eliom_extensions.cmi \
122 extensions/accesscontrol.cmi extensions/extendconfiguration.cmi \
123 baselib/polytables.cmi
125 # Put here only those which do not have cmxs (Vincent: Why?)
126 CMATOINSTALL = xmlp4/xhtmlsyntax.cma xmlp4/xhtmlpretty.cma \
127 xmlp4/ohl-xhtml/xhtml.cma server/ocsigen.cma
128 CMOTOINSTALL = server/server_main.cmo
129 CMITOINSTALL = baselib/ocsigen_getcommandline.cmi \
130 server/ocsigen_extensions.cmi server/ocsigen_parseconfig.cmi \
131 server/ocsigen_server.cmi server/ocsigen_http_client.cmi \
132 xmlp4/xhtmlpretty.cmi xmlp4/xhtmlpretty_streams.cmi \
133 xmlp4/xhtmlcompact.cmi xmlp4/ohl-xhtml/xHTML.cmi \
134 xmlp4/ohl-xhtml/xML.cmi xmlp4/xhtmltypes.cmi \
135 xmlp4/simplexmlparser.cmi http/ocsigen_charset_mime.cmi \
136 http/ocsigen_senders.cmi http/framepp.cmi \
137 http/ocsigen_http_com.cmi http/http_headers.cmi \
138 baselib/ocsigen_cache.cmi \
139 baselib/ocsigen_lib.cmi baselib/ocsigen_config.cmi \
140 http/ocsigen_http_frame.cmi http/ocsigen_headers.cmi \
141 baselib/ocsigen_stream.cmi baselib/ocsigen_messages.cmi \
142 extensions/ocsigen_LocalFiles.cmi files/META
143 EXAMPLESCMO = examples/tutoeliom.cmo examples/monitoring.cmo \
144 examples/miniwiki/miniwiki.cmo $(DUCEEXAMPLES)
146 EXAMPLESCMI = examples/tutoeliom.cmi
148 ifeq "$(BYTECODE)" "YES"
149 TOINSTALLBYTE=$(CMATOINSTALL) $(CMOTOINSTALL)\
150 $(PLUGINSCMATOINSTALL) $(PLUGINSCMOTOINSTALL)
151 PLUGINSTOINSTALLBYTE=$(PLUGINSCMATOINSTALL) $(PLUGINSCMOTOINSTALL)
152 EXAMPLESBYTE=$(EXAMPLESCMO)
153 BYTE=byte
154 else
155 TOINSTALLBYTE=
156 PLUGINSTOINSTALLBYTE=
157 EXAMPLESBYTE=
158 BYTE=
159 endif
161 ifeq "$(NATDYNLINK)" "YES"
162 CMXS=$(PLUGINSCMOTOINSTALL:.cmo=.cmxs) $(PLUGINSCMATOINSTALL:.cma=.cmxs)
163 EXAMPLECMXS=$(EXAMPLESCMO:.cmo=.cmxs)
164 else
165 CMXS=
166 EXAMPLECMXS=
167 endif
169 ifeq "$(NATIVECODE)" "YES"
170 PLUGINSTOINSTALLX=$(CMXS)
172 TOINSTALLXTEMP=$(CMAOTOINSTALL:.cmo=.cmx)
173 TOINSTALLX=$(CMATOINSTALL:.cma=.cmxa) \
174 $(CMATOINSTALL:.cma=.a) \
175 $(CMOTOINSTALL:.cmo=.cmx) \
176 $(CMOTOINSTALL:.cmo=.o) \
177 $(PLUGINSCMOTOINSTALL:.cmo=.cmx) \
178 $(PLUGINSCMOTOINSTALL:.cmo=.o) \
179 $(PLUGINSCMATOINSTALL:.cma=.cmxa) \
180 $(PLUGINSCMATOINSTALL:.cma=.a)
181 EXAMPLESOPT=$(EXAMPLECMXS)
182 OPT=opt
183 DEPOPT=xmlp4pre.opt
184 else
185 TOINSTALLX=
186 PLUGINSTOINSTALLX=
187 EXAMPLESOPT=
188 OPT=
189 endif
191 STATICSTUBS = server/lib$(OCSIGENNAME).a
193 PLUGINSTOINSTALL=$(PLUGINSTOINSTALLBYTE) $(PLUGINSTOINSTALLX)
194 TOINSTALL=$(TOINSTALLBYTE) $(TOINSTALLX) $(CMITOINSTALL) $(PLUGINSCMITOINSTALL) $(PLUGINSTOINSTALL) $(STATICSTUBS) eliom/pa_eliom_obrowser.cmo eliom/obrowser/_build/eliom_obrowser_client.cma eliom/obrowser/_build/eliom_obrowser_client.cmi eliom/obrowser/_build/lwt_obrowser.cmi eliom/obrowser/eliom_obrowser.js
195 EXAMPLES=$(EXAMPLESBYTE) $(EXAMPLESOPT) $(EXAMPLESCMI)
197 REPS=$(TARGETSBYTE:.byte=)
198 STD_METAS_DIR=$(MODULEINSTALLDIR)
200 all: $(BYTE) $(OPT) $(OCSIGENNAME).conf.local $(METAS)
202 byte: xmlp4pre.byte $(TARGETSBYTE)
204 opt: xmlp4pre.opt $(TARGETSBYTE:.byte=.opt)
206 .PHONY: $(REPS) clean distclean
209 baselib: baselib.byte
211 baselib.byte:
212 $(MAKE) -C baselib byte
214 baselib.opt:
215 $(MAKE) -C baselib opt
217 xmlp4: xmlp4.byte
219 xmlp4.byte:
220 # touch xmlp4/.depend
221 # $(MAKE) -C xmlp4 depend
222 $(MAKE) -C xmlp4 byte
224 xmlp4pre.byte:
225 # $(MAKE) -C xmlp4 depend
226 $(MAKE) -C xmlp4 xmlp4pre.byte
228 xmlp4pre.opt:
229 $(MAKE) -C xmlp4 xmlp4pre.opt
231 xmlp4.opt:
232 # touch xmlp4/.depend
233 # $(MAKE) -C xmlp4 depend
234 $(MAKE) -C xmlp4 opt
236 http: http.byte
238 http.byte:
239 $(MAKE) -C http byte
241 http.opt:
242 $(MAKE) -C http opt
244 extensions: extensions.byte
246 extensions.byte:
247 $(MAKE) -C extensions byte
249 extensions.opt:
250 $(MAKE) -C extensions opt
252 eliom: eliom.byte
254 eliom.byte:
255 $(MAKE) -C eliom byte
257 eliom.opt:
258 $(MAKE) -C eliom opt
260 examples: examples.byte
262 examples.byte:
263 $(MAKE) -C examples byte
265 examples.opt:
266 $(MAKE) -C examples opt
268 server: server.byte
270 server.byte:
271 $(MAKE) -C server byte
273 server.opt:
274 $(MAKE) -C server opt
276 doc:
277 $(CAMLDOC) -package lwt.ssl,netstring$(DUCEPACK) $(LIBDIRS3) -I `$(CAMLP4) -where` -I +threads -intro files/indexdoc -d doc -html $(DOC)
279 doc/index.html: doc
281 files/META: files/META.in VERSION
282 sed $(SED_COMMAND_FOR_META) < $< > $@
284 files/META.ocsigen_xhtml: files/META.ocsigen_xhtml.in VERSION
285 sed $(SED_COMMAND_FOR_META) < $< > $@
287 files/META.ocsigen: files/META.in VERSION
288 -ln -sf ../eliom/eliom.cma extensions
289 -ln -sf ../eliom/eliom_duce.cma extensions
290 -ln -sf ../eliom/obrowser/_builde/eliom_obrowser_client.cma extensions
291 -ln -sf ../eliom/obrowser/_build/lwt_obrowser.cmo extensions
292 -ln -sf ../xmlp4/ohl-xhtml/xhtml.cma extensions
293 -ln -sf ../xmlp4/xhtmlpretty.cma extensions
294 -ln -sf ../xmlp4/xhtmlsyntax.cma extensions
295 -ln -sf ../eliom/eliom.cmxa extensions
296 -ln -sf ../eliom/eliom_duce.cmxa extensions
297 -ln -sf ../xmlp4/ohl-xhtml/xhtml.cmxa extensions
298 -ln -sf ../xmlp4/xhtmlpretty.cmxa extensions
299 -ln -sf ../xmlp4/xhtmlsyntax.cmxa extensions
300 -ln -sf ../eliom/eliom.cmxs extensions
301 -ln -sf ../eliom/eliom_duce.cmxs extensions
302 -ln -sf ../xmlp4/ohl-xhtml/xhtml.cmxs extensions
303 -ln -sf ../xmlp4/xhtmlpretty.cmxs extensions
304 -ln -sf ../xmlp4/xhtmlsyntax.cmxs extensions
305 -ln -sf ../baselib/parsecommandline.cma extensions
306 -ln -sf ../baselib/donotparsecommandline.cma extensions
307 echo directory = \"$(SRC)/extensions\" > $@
308 sed $(SED_COMMAND_FOR_META) -e "s%_MODULEINSTALLDIR_%$(SRC)/extensions%g" < $< >> $@
309 # sed "s%\"xhtml\" (%\"xhtml\" (\n directory = \"$(SRC)/xmlp4/ohl-xhtml/\"%g" >> $@
311 files/META.eliom_examples: files/META.eliom_examples.in VERSION
312 sed $(SED_COMMAND_FOR_META) -e "s%_EXAMPLESINSTALLDIR_%$(SRC)/examples%g" < $< > $@
314 files/META.eliom_examples.global: files/META.eliom_examples.in VERSION
315 sed $(SED_COMMAND_FOR_META) -e "s%_EXAMPLESINSTALLDIR_%$(EXAMPLESINSTALLDIR)%g"< $< > $@
317 $(OCSIGENNAME).conf.local: Makefile.config files/ocsigen.conf.in
318 cat files/ocsigen.conf.in \
319 | sed s%\<port\>80\</port\>%\<port\>8080\</port\>%g \
320 | sed s%_LOGDIR_%$(SRC)/var/log%g \
321 | sed s%_STATICPAGESDIR_%$(SRC)/files%g \
322 | sed s%_CONFIGDIR_%$(SRC)/etc/ocsigen%g \
323 | sed s%_DATADIR_%$(SRC)/var/lib%g \
324 | sed s%_EXTRALIBDIR_%$(SRC)/extensions/ocsipersist-dbm%g \
325 | sed s%_UP_%$(SRC)/tmp%g \
326 | sed s%_OCSIGENUSER_%%g \
327 | sed s%_OCSIGENGROUP_%%g \
328 | sed s%_OCSIGENNAME_%$(OCSIGENNAME)%g \
329 | sed s%_COMMANDPIPE_%$(SRC)/var/run/ocsigen_command%g \
330 | sed s%_MIMEFILE_%$(SRC)/files/mime.types%g \
331 | sed s%_MODULEINSTALLDIR_%$(SRC)/extensions%g \
332 | sed s%_ELIOMINSTALLDIR_%$(SRC)/eliom%g \
333 | sed s%_EXAMPLESINSTALLDIR_%$(SRC)/examples%g \
334 | sed s%_METADIR_%$(SRC)/files%g \
335 | sed s%_CAMLZIPNAME_%$(CAMLZIPNAME)%g \
336 | sed s%files/miniwiki%examples/miniwiki/files%g \
337 | sed s%var/lib/miniwiki%examples/miniwiki/wikidata%g \
338 | sed s%\<\!--\ \<commandpipe%\<commandpipe%g \
339 | sed s%\</commandpipe\>%\</commandpipe\>\ \<\!--%g \
340 | sed s%\<\!--\ \<mimefile%\<mimefile%g \
341 | sed s%\</mimefile\>%\</mimefile\>\ \<\!--%g \
342 | sed s%ocsipersist-dbm.cma%ocsipersist-dbm/ocsipersist-dbm.cma%g \
343 | sed s%store\ dir=\"$(SRC)/var/lib\"%store\ dir=\"$(SRC)/var/lib/ocsipersist\"%g \
344 > $(OCSIGENNAME).conf.local
345 cat $(OCSIGENNAME).conf.local \
346 | sed s%[.]cmo%.cmxs%g \
347 | sed s%[.]cma%.cmxs%g \
348 | sed s%sist-dbm/ocsidbm\"%sist-dbm/ocsidbm.opt\"%g \
349 | sed s%sqlite3.cmxs\"/\>%sqlite3.cmxs\"/\>\ \<\!--\ Create\ sqlite3.cmxs\ using:\ ocamlopt\ -shared\ -linkall\ -I\ \<path\ to\ ocaml\'s\ sqlite3\ directory\>\ -o\ sqlite3.cmxs\ \<path\ to\>/libsqlite3_stubs.a\ \<path\ to\>/sqlite3.cmxa\ --\>%g \
350 > $(OCSIGENNAME).conf.opt.local
352 clean:
353 -@for i in $(REPS) ; do $(MAKE) -C $$i clean ; done
354 -rm -f $(OCSIGENNAME).conf.local $(OCSIGENNAME).conf.opt.local
355 -rm -f $(METAS) $(OCSIGENNAME)-*.tar.gz
356 -find . -name "*~" -delete
358 distclean: clean
359 -find . -name "*depend" -delete
360 -find doc -type f -delete
361 -rm -f Makefile.config
363 depend:
364 $(MAKE) -C xmlp4 depend
365 $(MAKE) -C xmlp4 xmlp4pre.byte $(DEPOPT)
366 # @for i in $(REPS) ; do touch "$$i"/.depend; $(MAKE) -C $$i depend ; done
367 @for i in $(REPS) ; do $(MAKE) -C $$i depend ; done
370 .PHONY: partialinstall install doc docinstall installnodoc logrotate dist
371 partialinstall:
372 mkdir -p $(TEMPROOT)$(MODULEINSTALLDIR)
373 mkdir -p $(TEMPROOT)$(EXAMPLESINSTALLDIR)
374 mkdir -p $(TEMPROOT)$(EXTRALIBDIR)/METAS
375 mkdir -p $(TEMPROOT)$(EXTRALIBDIR)/extensions
376 mkdir -p $(TEMPROOT)$(STD_METAS_DIR)
377 $(MAKE) -C server install
378 mkdir -p "$(TEMPROOT)$(MODULEINSTALLDIR)"
379 $(OCAMLFIND) install $(OCSIGENNAME) -destdir "$(TEMPROOT)$(MODULEINSTALLDIR)" $(TOINSTALL)
380 $(INSTALL) -m 644 $(EXAMPLES) $(TEMPROOT)$(EXAMPLESINSTALLDIR)
381 # $(INSTALL) -m 644 $(PLUGINSTOINSTALL) $(TEMPROOT)$(EXTRALIBDIR)/extensions
382 -$(INSTALL) -m 755 extensions/ocsipersist-dbm/ocsidbm $(TEMPROOT)$(EXTRALIBDIR)/extensions
383 [ ! -f extensions/ocsipersist-dbm/ocsidbm.opt ] || \
384 $(INSTALL) -m 755 extensions/ocsipersist-dbm/ocsidbm.opt $(TEMPROOT)$(EXTRALIBDIR)/extensions
385 # $(INSTALL) -m 644 META.ocsigen_ext.global $(TEMPROOT)$(EXTRALIBDIR)/METAS/META.ocsigen_ext
386 $(INSTALL) -m 644 files/META.eliom_examples.global $(TEMPROOT)$(EXTRALIBDIR)/METAS/META.eliom_examples
387 $(INSTALL) -m 644 files/META.ocsigen_xhtml $(TEMPROOT)$(STD_METAS_DIR)
388 chmod a+rx $(TEMPROOT)$(MODULEINSTALLDIR)/$(OCSIGENNAME)
389 chmod a+r $(TEMPROOT)$(MODULEINSTALLDIR)/$(OCSIGENNAME)/*
390 chmod a+rx $(TEMPROOT)$(MODULEINSTALLDIR)
391 chmod a+rx $(TEMPROOT)$(EXAMPLESINSTALLDIR)
392 chmod a+rx $(TEMPROOT)$(EXTRALIBDIR)
393 chmod a+rx $(TEMPROOT)$(EXTRALIBDIR)/METAS
394 chmod a+rx $(TEMPROOT)$(EXTRALIBDIR)/extensions
395 chmod a+rx "$(TEMPROOT)$(MODULEINSTALLDIR)"
397 docinstall: doc/index.html
398 mkdir -p $(TEMPROOT)$(DOCDIR)
399 $(INSTALL) -m 644 doc/* $(TEMPROOT)$(DOCDIR)
400 chmod a+rx $(TEMPROOT)$(DOCDIR)
401 chmod a+r $(TEMPROOT)$(DOCDIR)/*
403 installnodoc: partialinstall
404 mkdir -p $(TEMPROOT)$(CONFIGDIR)
405 mkdir -p $(TEMPROOT)$(CONFIGDIR)/conf.d
406 mkdir -p $(TEMPROOT)$(STATICPAGESDIR)
407 mkdir -p $(TEMPROOT)$(STATICPAGESDIR)/miniwiki
408 mkdir -p $(TEMPROOT)$(STATICPAGESDIR)/tutorial
409 mkdir -p $(TEMPROOT)$(STATICPAGESDIR)/ocsigenstuff
410 mkdir -p $(TEMPROOT)$(DATADIR)
411 mkdir -p $(TEMPROOT)$(DATADIR)/miniwiki
412 mkdir -p `dirname $(TEMPROOT)$(COMMANDPIPE)`
413 [ -p $(TEMPROOT)$(COMMANDPIPE) ] || { mkfifo $(TEMPROOT)$(COMMANDPIPE); \
414 chmod 660 $(TEMPROOT)$(COMMANDPIPE); \
415 $(CHOWN) -R $(OCSIGENUSER):$(OCSIGENGROUP) $(TEMPROOT)$(COMMANDPIPE);}
416 # -mv $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf.old
417 cat files/ocsigen.conf.in \
418 | sed s%_LOGDIR_%$(LOGDIR)%g \
419 | sed s%_STATICPAGESDIR_%$(STATICPAGESDIR)%g \
420 | sed s%_CONFIGDIR_%$(CONFIGDIR)%g \
421 | sed s%_DATADIR_%$(DATADIR)%g \
422 | sed s%_BINDIR_%$(BINDIR)%g \
423 | sed s%_EXTRALIBDIR_%$(EXTRALIBDIR)/extensions%g \
424 | sed s%_UP_%$(UPLOADDIR)%g \
425 | sed s%_OCSIGENUSER_%$(OCSIGENUSER)%g \
426 | sed s%_OCSIGENGROUP_%$(OCSIGENGROUP)%g \
427 | sed s%_OCSIGENNAME_%$(OCSIGENNAME)%g \
428 | sed s%_COMMANDPIPE_%$(COMMANDPIPE)%g \
429 | sed s%_MIMEFILE_%$(CONFIGDIR)/mime.types%g \
430 | sed s%_MODULEINSTALLDIR_%$(MODULEINSTALLDIR)/$(OCSIGENNAME)%g \
431 | sed s%_ELIOMINSTALLDIR_%$(MODULEINSTALLDIR)/$(OCSIGENNAME)%g \
432 | sed s%_EXAMPLESINSTALLDIR_%$(EXAMPLESINSTALLDIR)%g \
433 | sed s%_METADIR_%$(EXTRALIBDIR)/METAS%g \
434 | sed s%_CAMLZIPNAME_%$(CAMLZIPNAME)%g \
435 > $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf.sample
436 cat $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf.sample \
437 | sed s%[.]cmo%.cmxs%g \
438 | sed s%[.]cma%.cmxs%g \
439 > $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf.opt.sample
440 -mv $(TEMPROOT)$(CONFIGDIR)/mime.types $(TEMPROOT)$(CONFIGDIR)/mime.types.old
441 cp -f files/mime.types $(TEMPROOT)$(CONFIGDIR)
442 mkdir -p $(TEMPROOT)$(LOGDIR)
443 chmod u+rwx $(TEMPROOT)$(LOGDIR)
444 chmod a+rx $(TEMPROOT)$(CONFIGDIR)
445 chmod a+rx $(TEMPROOT)$(CONFIGDIR)/conf.d
446 [ -f $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf ] || \
447 { cp $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf.sample \
448 $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf; \
449 chmod a+r $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf; }
450 chmod a+r $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf.sample
451 [ -f $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf ] || \
452 { cp $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf.opt.sample \
453 $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf.opt; \
454 chmod a+r $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf.opt; }
455 chmod a+r $(TEMPROOT)$(CONFIGDIR)/$(OCSIGENNAME).conf.opt.sample
456 chmod a+r $(TEMPROOT)$(CONFIGDIR)/mime.types
457 $(INSTALL) -m 644 files/tutorial/style.css $(TEMPROOT)$(STATICPAGESDIR)/tutorial
458 $(INSTALL) -m 644 files/tutorial/bulles-bleues.png $(TEMPROOT)$(STATICPAGESDIR)/tutorial
459 $(INSTALL) -m 644 files/tutorial/ocsigen5.png $(TEMPROOT)$(STATICPAGESDIR)/tutorial
460 $(INSTALL) -m 644 files/ocsigenstuff/* $(TEMPROOT)$(STATICPAGESDIR)/ocsigenstuff
461 $(INSTALL) -m 644 examples/miniwiki/files/style.css $(TEMPROOT)$(STATICPAGESDIR)/miniwiki
462 $(INSTALL) -m 644 examples/miniwiki/wikidata/* $(TEMPROOT)$(DATADIR)/miniwiki
463 $(CHOWN) -R $(OCSIGENUSER):$(OCSIGENGROUP) $(TEMPROOT)$(LOGDIR)
464 $(CHOWN) -R $(OCSIGENUSER):$(OCSIGENGROUP) $(TEMPROOT)$(STATICPAGESDIR)
465 $(CHOWN) -R $(OCSIGENUSER):$(OCSIGENGROUP) $(TEMPROOT)$(DATADIR)
466 chmod 750 $(TEMPROOT)$(DATADIR)
467 $(INSTALL) -d -m 755 $(TEMPROOT)$(MANDIR)
468 $(INSTALL) -m 644 files/ocsigen.1 $(TEMPROOT)$(MANDIR)
470 logrotate:
471 [ -d /etc/logrotate.d ] && \
472 { mkdir -p $(TEMPROOT)/etc/logrotate.d ; \
473 cat files/logrotate.in \
474 | sed s%LOGDIR%$(LOGDIR)%g \
475 | sed s%USER%$(OCSIGENUSER)%g \
476 | sed s%GROUP%$(OCSIGENGROUP)%g \
477 | sed s%_COMMANDPIPE_%$(COMMANDPIPE)%g \
478 > $(TEMPROOT)/etc/logrotate.d/$(OCSIGENNAME); }
480 dist:
481 DARCS_REPO=$(PWD) darcs dist -d $(OCSIGENNAME)-$(VERSION)
483 install: docinstall installnodoc
486 .PHONY: uninstall fulluninstall
487 uninstall:
488 -rm -Rf $(TEMPROOT)$(DOCDIR)
489 -rm -Rf $(TEMPROOT)$(EXTRALIBDIR)
490 -$(MAKE) -C server uninstall
491 -$(OCAMLFIND) remove $(OCSIGENNAME) -destdir "$(TEMPROOT)$(MODULEINSTALLDIR)"
493 fulluninstall: uninstall
494 # dangerous
495 # rm -f $(CONFIGDIR)/$(OCSIGENNAME).conf
496 # rm -f $(LOGDIR)/$(OCSIGENNAME).log
497 # rm -rf $(MODULEINSTALLDIR)