Initial packaging
[pkg-ocaml-eliom.git] / tests / Makefile
blobf5130f39737532a7427ffa584e4da0ef8bead307
1 include ../Makefile.config
3 ## Use local files
4 ## (tests do not require global installation of Eliom)
5 export OCAMLPATH := ${SRC}/src/files:${OCAMLPATH}
6 export PATH := ${SRC}/src/tools:${PATH}
8 ELIOMC := eliomc${BYTEDBG}
9 ELIOMOPT := eliomopt ${OPTDBG}
10 ELIOMDEP := eliomdep
11 JS_OF_ELIOM := js_of_eliom
13 ifeq "${NATDYNLINK}" "YES"
14 all: byte opt
15 else
16 all: byte
17 endif
19 #### Main site : eliom_testsuite ####
21 SERVER_PACKAGE :=
22 CLIENT_PACKAGE :=
24 SERVER_FILES := eliom_testsuite1.ml \
25 eliom_testsuite2.ml \
26 eliom_testsuite3.eliom \
27 eliom_testsuite.ml \
29 CLIENT_FILES := eliom_testsuite3.eliom \
31 STATICDIR := ../local/var/www/tests
33 byte:: eliom_testsuite.cma ${STATICDIR}/eliom_testsuite.js
34 opt:: eliom_testsuite.cmxs ${STATICDIR}/eliom_testsuite.js
36 #### Server side #######
38 SERVER_INC := ${addprefix -package ,${SERVER_PACKAGE}}
40 SERVER_OBJS := $(patsubst %.eliom,_server/%.cmo, \
41 $(patsubst %.ml,_server/%.cmo,${SERVER_FILES}))
43 eliom_testsuite.cma: ${SERVER_OBJS}
44 ${ELIOMC} -a -o $@ $^
45 eliom_testsuite.cmxa: ${SERVER_OBJS:.cmo=.cmx}
46 ${ELIOMOPT} -a -o $@ $^
48 _server/%.type_mli: %.eliom
49 ${ELIOMC} -infer ${SERVER_INC} -o $@ $<
51 _server/%.cmi: %.mli
52 ${ELIOMC} -c ${SERVER_INC} $<
54 _server/%.cmo: %.ml
55 ${ELIOMC} -c ${SERVER_INC} $<
56 _server/%.cmo: %.eliom
57 ${ELIOMC} -c -noinfer ${SERVER_INC} $<
59 _server/%.cmx: %.ml
60 ${ELIOMOPT} -c ${SERVER_INC} $<
61 _server/%.cmx: %.eliom
62 ${ELIOMOPT} -c -noinfer ${SERVER_INC} $<
64 %.cmxs: %.cmxa
65 $(ELIOMOPT) -shared -linkall -o $@ $<
67 ##### Client side ####
69 CLIENT_LIBS := ${addprefix -package ,${CLIENT_PACKAGE}}
70 CLIENT_INC := ${addprefix -package ,${CLIENT_PACKAGE}}
72 CLIENT_OBJS := $(patsubst %.eliom,_client/%.cmo, \
73 $(patsubst %.ml,_client/%.cmo,${CLIENT_FILES}))
75 ${STATICDIR}/eliom_testsuite.js: ${CLIENT_OBJS}
76 ${JS_OF_ELIOM} -o $@ -jsopt -pretty -jsopt -noinline ${CLIENT_LIBS} $^
78 _client/%.cmi: %.mli
79 ${JS_OF_ELIOM} -c ${CLIENT_INC} $<
81 _client/%.cmo: %.eliom
82 ${JS_OF_ELIOM} -c ${CLIENT_INC} $<
83 _client/%.cmo: %.ml
84 ${JS_OF_ELIOM} -c ${CLIENT_INC} $<
86 ####### Aux site: Ocamlduce #######
88 ifeq "${OCAMLDUCE}" "YES"
89 byte:: ocamlduce.byte
90 opt:: ocamlduce.opt
91 endif
93 ocamlduce.byte: _server/eliom_testsuite1.cmo
94 $(MAKE) -C ocamlduce byte
96 ocamlduce.opt: _server/eliom_testsuite1.cmx
97 $(MAKE) -C ocamlduce opt
99 ####### Aux site: miniwiki #######
101 byte:: miniwiki.byte
102 opt:: miniwiki.opt
104 miniwiki.byte:
105 $(MAKE) --no-print-directory -C miniwiki byte
107 miniwiki.opt:
108 $(MAKE) --no-print-directory -C miniwiki opt
110 ############
112 ## Clean up
114 clean: clean.local
115 ${MAKE} -C ocamlduce clean
116 ${MAKE} -C miniwiki clean
117 clean.local:
118 -rm -f *.cm[ioax] *.cmxa *.cmxs *.o *.a *.annot
119 -rm -f *.type_mli
120 -rm -f ${STATICDIR}/eliom_testsuite.js
121 -rm -rf _client/* _server/*
123 distclean: clean.local
124 -rm -f *~ \#* .\#*
125 ${MAKE} -C ocamlduce distclean
126 ${MAKE} -C miniwiki distclean
128 ## Dependencies
130 depend:
131 ifeq "${OCAMLDUCE}" "YES"
132 ${MAKE} -C ocamlduce depend
133 endif
134 ${MAKE} -C miniwiki depend
135 $(ELIOMDEP) -server ${SERVER_INC} ${SERVER_FILES} > .depend
136 $(ELIOMDEP) -client ${CLIENT_INC} ${CLIENT_FILES} >> .depend
138 include .depend
140 ## Dependencies towards *.eliom are not handled by eliomdep.
141 eliom_testsuite.cmo: eliom_testsuite3.cmo
142 eliom_testsuite.cmx: eliom_testsuite3.cmx
144 ## TODO
146 # %.wiki: %.ml
147 # cat $< | sed '1,/(\*wiki\*/d' | sed '/%<||2>%/,$$ d' | /bin/sh ./tutomake.sh > $@