Makefile 4.55 KB
Newer Older
1
2
3
NATIVE = true
PROFILE = false
PXP_WLEX = false
4

5
6
7
8
9
10
PACKAGES = -package "pxp-engine pxp-lex-iso88591 wlexing camlp4 num cgi"
ifeq ($(PXP_WLEX), true)
  PACKAGES += -package pxp-wlex-utf8
else
  PACKAGES += -package pxp-lex-utf8
endif
11

12
SYNTAX = camlp4o pa_extend.cmo
13

14
15
VERSION = 0.0.9 (alpha)

16
17
18
19
20
21
22
23
24
25
ifeq ($(PROFILE), true)
	CAMLC_P = ocamlcp -p a
	CAMLOPT_P = ocamlopt -p
	SYNTAX_PARSER = 
else
	CAMLC_P = ocamlc
	CAMLOPT_P = ocamlopt
	SYNTAX_PARSER = -pp '$(SYNTAX)'
endif

26
27
28
OPT = -warn-error A
CAMLC = ocamlfind $(CAMLC_P) $(OPT) $(PACKAGES)
CAMLOPT = ocamlfind $(CAMLOPT_P) $(OPT) $(PACKAGES)
29
30
31
32
33
34
35
36
37
38

ifeq ($(NATIVE), true)
	EXTENSION = cmx
	LINK = $(CAMLOPT) -linkpkg gramlib.cmxa
else
	EXTENSION = cmo
	LINK = $(CAMLC) -custom -linkpkg gramlib.cma
endif

all: cduce dtd2cduce local_website
39

40
# Source directories 
41

42
43
DIRS = misc parser typing types runtime driver
CLEAN_DIRS = $(DIRS) tools tests
44

45
# Objects to build
46

47
48
49
50
51
52
OBJECTS = \
 misc/state.cmo misc/pool.cmo misc/encodings.cmo misc/bool.cmo \
 misc/pretty.cmo \
 \
 types/sortedList.cmo types/boolean.cmo types/ident.cmo \
 types/intervals.cmo types/chars.cmo types/atoms.cmo types/normal.cmo \
53
 types/types.cmo types/patterns.cmo types/sequence.cmo \
54
 types/sample.cmo \
55
56
57
58
59
60
61
62
 \
 parser/location.cmo parser/wlexer.cmo parser/ast.cmo parser/parser.cmo \
 \
 typing/typed.cmo typing/typer.cmo \
 \
 runtime/value.cmo runtime/load_xml.cmo runtime/run_dispatch.cmo \
 runtime/print_xml.cmo runtime/eval.cmo \
 \
63
 types/builtin.cmo driver/cduce.cmo
64
65

WEBIFACE  = $(OBJECTS) driver/examples.cmo driver/webiface.cmo
66
DTD2CDUCE = tools/dtd2cduce.cmo
67

68
69
70
71
DEPEND = $(DIRS:=/*.ml) $(DIRS:=/*.mli)
INCLUDES = $(DIRS:%=-I %)

PREPRO = $(SYNTAX) pr_o.cmo
72

73
cduce: $(OBJECTS:.cmo=.$(EXTENSION)) driver/run.ml
74
	sed -e 's|%%VERSION%%|$(VERSION)|' \
75
            -e 's|%%BUILD_DATE%%|$(shell date +%Y-%m-%d)|' \
76
77
            -e 's|%%NATIVE%%|$(NATIVE)|' \
            misc/cduce_config.mlp > misc/cduce_config.ml
78
	$(LINK) $(INCLUDES) -o $@ misc/cduce_config.ml $^
79
	rm misc/cduce_config.ml
80

81
82
webiface: $(WEBIFACE:.cmo=.$(EXTENSION))
	$(LINK) -o $@ $^
83

84
85
dtd2cduce: $(DTD2CDUCE:.cmo=.$(EXTENSION))
	$(LINK) -o $@ $^
86

87
.PHONY: compute_depend
88
89
compute_depend:
	@echo "Computing dependencies ..."
90
	ocamldep $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) > depend
91

92
93
94
parser/wlexer.ml: parser/wlexer.mll
	wlex parser/wlexer.mll

95
clean:
96
	for i in $(CLEAN_DIRS); do \
97
98
	(cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *~); \
	done
99
	rm -f `find -name "*~"`
100
	rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.o *~
101
	rm -f cduce ocamlprof.dump
102
	rm -f dtd2cduce pool webiface
103
	rm -Rf prepro package
104
	rm -f web/www/*.php web/www/*.html web/*~
105

106
107
108
109

.SUFFIXES: .ml .mli .cmo .cmi .cmx

.ml.cmo:
110
	$(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<
111

112
.ml.cmx:
113
	$(CAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<
114
115

.mli.cmi:
116
	$(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<
117

118
include depend
119

120
# CDuce-generated files
121

122
driver/examples.ml: cduce web/examples/build.cd web/examples/examples.xml
123
	(cd web/examples; ../../cduce --quiet build.cd)
124

125
web/files: cduce web/site.cd
126
	(cd web; ../cduce --quiet site.cd --arg -php site.xml)
127

128
# Packaging
129
130
131
132
133
134
135

write_header:
	headache -h header $(DEPEND)

remove_header:
	headache -r $(DEPEND)

136
137
# For development

138
139
pull: tools/pull.$(EXTENSION)
	$(LINK) -o $@ $^
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154

profile:
	rm -Rf prepro
	mkdir prepro
	for i in $(DIRS); do \
	mkdir prepro/$$i; \
	for j in $$i/*.ml $$i/*.mli; do \
	if [ -f "$$j" ]; then \
	 echo $$j; \
	 $(PREPRO) $$j -o prepro/$$j; \
	fi; \
	done; \
	done
	cp parser/wlexer.mll prepro/parser/
	cp Makefile depend prepro/
155
	(cd prepro;  make cduce PROFILE=true SYNTAX_PARSER= NATIVE=false)
156

157
# Site-specific installation
158
159

cedre_build:
160
	rsh cedre ". .env; cd IMPLEM/CDUCE; make webiface; make web/files"
161
install_web:
162
	scp web/www/*.php web/cduce.css cduce@iris:public_html/
163
	scp webiface cduce@iris:cgi-bin/cduce
164
165
	ssh cduce@iris "chmod +s cgi-bin/cduce"

166
167
168
169
170
171
172
173
#
# Customize the following variables to match the settings
# of your local web server
#
WEB_PREFIX = /var/www
CGI_DIR = $(WEB_PREFIX)/cgi-bin
CDUCE_HTML_DIR = $(WEB_PREFIX)/html

174
175
176
177
178
179
180
install_web_local:web/files webiface
	cp  web/www/*.php web/cduce.css  $(CDUCE_HTML_DIR)/
	cp webiface $(CGI_DIR)/
	if test ! -d "$(CDUCE_HTML_DIR)/img" ; then \
	  mkdir $(CDUCE_HTML_DIR)/img; \
	fi;  
	cp web/img/*.*  $(CDUCE_HTML_DIR)/img
181

182
website: web/files
183
	scp web/www/*.php web/cduce.css cduce@iris:public_html/
184

185
local_website: cduce
186
	(cd web; ../cduce --quiet site.cd --arg site.xml)
187

188
189
# Distribution

190
191
DISTRIB = $(DIRS) tools web depend INSTALL CHANGES LICENSE README Makefile

192
193
194
195
196
.PHONY: package
package:
	rm -Rf package
	mkdir package
	cp -R $(DISTRIB) package/
197
	(cd package; headache -h ../header $(DEPEND); rm -Rf `find -name "CVS"`)
198