Makefile.distrib 4.32 KB
Newer Older
1
2
include Makefile.conf
VERSION = 0.0.91
3

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

11
12
13
SYNTAX = camlp4o -I misc/ pa_extend.cmo \
  q_symbol.cmo \
  -symbol cduce_version=\"$(VERSION)\" \
14
15
  -symbol build_date=\"$(shell date +%Y-%m-%d)\" \
  -symbol session_dir=\"$(SESSION_DIR)\"
16
17
18
19
20
21

ifeq ($(NATIVE), true)
	SYNTAX += -symbol ocaml_compiler=\"native\"
else
	SYNTAX += -symbol ocaml_compiler=\"bytecode\"
endif
22

23
ifeq ($(EXPAT), true)
24
	PACKAGES += expat
25
26
27
	SYNTAX += -symbol EXPAT=
endif

28
29
30
SYNTAX_PARSER = -pp '$(SYNTAX)'

CAMLC_P = ocamlc
31
32
ifeq ($(PROFILE), true)
	CAMLOPT_P = ocamlopt -p
33
34
35
	ifeq ($(NATIVE), false) 
         CAMLC_P = ocamlcp -p a
         SYNTAX_PARSER = 
36
	endif
37
else
38
	CAMLOPT_P = ocamlopt -inline 25
39
40
endif

41
42
43
44
45
46
47
48
ifeq ($(PHP), true)
   PHP_ARG = -php
   WEB_EXT = .php
else
   PHP_ARG =
   WEB_EXT = .html
endif

49
OPT = -warn-error FPS
50
51
CAMLC = ocamlfind $(CAMLC_P) $(OPT) -package "$(PACKAGES)"
CAMLOPT = ocamlfind $(CAMLOPT_P) $(OPT) -package "$(PACKAGES)"
52
53
54

ifeq ($(NATIVE), true)
	EXTENSION = cmx
55
	LINK = $(CAMLOPT) -linkpkg gramlib.cmxa
56
57
else
	EXTENSION = cmo
58
	LINK = $(CAMLC) -custom -linkpkg gramlib.cma
59
60
endif

61
62
# all: cduce dtd2cduce local_website
all: cduce dtd2cduce local_website validate
63
64
65

# Source directories 

66
DIRS = misc parser schema typing types runtime driver
67
68
69
70
71
72
CLEAN_DIRS = $(DIRS) tools tests

# Objects to build

OBJECTS = \
 misc/state.cmo misc/pool.cmo misc/encodings.cmo misc/bool.cmo \
73
 misc/pretty.cmo misc/ns.cmo \
74
75
 \
 types/sortedList.cmo types/boolean.cmo types/ident.cmo \
76
77
 types/intervals.cmo types/chars.cmo types/atoms.cmo \
 types/normal.cmo \
78
 types/types.cmo types/patterns.cmo types/sequence.cmo \
79
80
81
82
83
84
 types/sample.cmo types/builtin_defs.cmo \
 \
 runtime/value.cmo \
 \
 schema/schema_types.cmo schema/schema_xml.cmo schema/schema_builtin.cmo \
 schema/schema_validator.cmo schema/schema_parser.cmo \
85
86
87
88
89
 \
 parser/location.cmo parser/wlexer.cmo parser/ast.cmo parser/parser.cmo \
 \
 typing/typed.cmo typing/typer.cmo \
 \
90
 runtime/load_xml.cmo runtime/run_dispatch.cmo \
91
92
93
94
95
96
97
98
 runtime/print_xml.cmo runtime/eval.cmo \
 \
 types/builtin.cmo driver/cduce.cmo

CDUCE = $(OBJECTS) driver/run.cmo
WEBIFACE  = $(OBJECTS) driver/examples.cmo driver/webiface.cmo
DTD2CDUCE = tools/dtd2cduce.cmo

99
100
101
102
103
104
105
ALL_OBJECTS = $(OBJECTS) \
 driver/run.cmo driver/examples.cmo driver/webiface.cmo \
 tools/dtd2cduce.cmo

DEPEND = $(ALL_OBJECTS:.cmo=.ml) $(ALL_OBJECTS:.cmo=.mli)

# DEPEND = $(DIRS:=/*.ml) $(DIRS:=/*.mli)
106
107
INCLUDES = $(DIRS:%=-I %)

108
109
110
111
cduce: $(CDUCE:.cmo=.$(EXTENSION))
	$(LINK) $(INCLUDES) -o $@ $^

webiface: $(WEBIFACE:.cmo=.$(EXTENSION))
112
	$(LINK) $(INCLUDES) -o $@ $^
113
114

dtd2cduce: $(DTD2CDUCE:.cmo=.$(EXTENSION))
115
	$(LINK) $(INCLUDES) -o $@ $^
116

117
118
119
validate: $(OBJECTS:.cmo=.$(EXTENSION)) tools/validate.ml
	$(LINK) $(INCLUDES) -o $@ $^

120
.PHONY: compute_depend
121
compute_depend: misc/q_symbol.cmo
122
	@echo "Computing dependencies ..."
123
124
	ocamldep $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) | \
        sed -e "s|: |: misc/q_symbol.cmo |" > depend
125
126
127
128
129
130
131
132

parser/wlexer.ml: parser/wlexer.mll
	wlex parser/wlexer.mll

clean:
	for i in $(CLEAN_DIRS); do \
	(cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *~); \
	done
133
	(cd expat; make clean)
134
	rm -f `find . -name "*~"`
135
136
	rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.o *~
	rm -f cduce ocamlprof.dump
137
	rm -f dtd2cduce pool webiface validate
138
139
140
141
142
143
	rm -Rf prepro package
	rm -f web/www/*.php web/www/*.html web/*~


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

144
misc/q_symbol.cmo: misc/q_symbol.ml
145
	$(CAMLC) -c -pp 'camlp4o pa_extend.cmo q_MLast.cmo' $<
146

147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
.ml.cmo:
	$(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<

.ml.cmx:
	$(CAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<

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

include depend

# CDuce-generated files

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

web/files: cduce web/site.cd
164
	(cd web; ../cduce --quiet site.cd --arg $(PHP_ARG) site.xml)
165

166
167


168
169

install_web_local:web/files webiface
170
	cp  web/www/*$(WEB_EXT) web/cduce.css  $(HTML_DIR)/
171
	cp webiface $(CGI_DIR)/cduce
172
173
	if test ! -d "$(HTML_DIR)/img" ; then \
	  mkdir $(HTML_DIR)/img; \
174
	fi;  
175
	cp web/img/*.*  $(HTML_DIR)/img
176
177


178
179
#local_website: cduce webiface
#	(cd web; ../cduce --quiet site.cd --arg site.xml)
180
181
#	cp  web/www/*.html web/cduce.css  $(CDUCE_HTML_DIR)/
#	cp webiface $(CGI_DIR)/cduce