Makefile.distrib 4.48 KB
Newer Older
1
include Makefile.conf
2
VERSION = 0.2.0
3

4
PACKAGES = pxp-engine pxp-lex-iso88591 ulex 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
SYNTAX = -I misc/ pa_extend.cmo q_symbol.cmo \
12
  -symbol cduce_version=\"$(VERSION)\" \
13
14
  -symbol build_date=\"$(shell date +%Y-%m-%d)\" \
  -symbol session_dir=\"$(SESSION_DIR)\"
15
16
17
18
19
20

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

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

27
SYNTAX_PARSER = -syntax camlp4o $(SYNTAX:%=-ppopt %)
28
29

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

42
OPT = -warn-error FPS
43
44
45
OCAMLFIND = ocamlfind
CAMLC = $(OCAMLFIND) $(CAMLC_P) $(OPT) -package "$(PACKAGES)"
CAMLOPT = $(OCAMLFIND) $(CAMLOPT_P) $(OPT) -package "$(PACKAGES)"
46
47
48

ifeq ($(NATIVE), true)
	EXTENSION = cmx
49
	LINK = $(CAMLOPT) -linkpkg gramlib.cmxa
50
51
else
	EXTENSION = cmo
52
	LINK = $(CAMLC) -custom -linkpkg gramlib.cma
53
54
endif

55
all: cduce dtd2cduce 
56

57
58
59
60

install: all
	mkdir -p $(PREFIX)/bin/
	mkdir -p $(PREFIX)/man/man1/
61
	install -m755 cduce dtd2cduce $(PREFIX)/bin/
62
63
64
	install -m644 doc/cduce.1 $(PREFIX)/man/man1/

uninstall:
65
	rm  $(PREFIX)/bin/cduce $(PREFIX)/bin/dtd2cduce $(PREFIX)/man/man1/cduce.1
66

67
68
# Source directories 

69
DIRS = misc parser schema typing types runtime driver module
70
71
72
73
74
CLEAN_DIRS = $(DIRS) tools tests

# Objects to build

OBJECTS = \
75
 misc/stats.cmo \
76
 misc/serialize.cmo misc/custom.cmo \
77
 misc/state.cmo misc/pool.cmo misc/encodings.cmo misc/bool.cmo \
78
 misc/pretty.cmo misc/ns.cmo \
79
80
 \
 types/sortedList.cmo types/boolean.cmo types/ident.cmo \
81
82
 types/intervals.cmo types/chars.cmo types/atoms.cmo \
 types/normal.cmo \
83
 types/types.cmo types/patterns.cmo types/sequence.cmo \
84
85
86
87
88
89
 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 \
90
 \
91
 parser/location.cmo parser/ulexer.cmo parser/ast.cmo parser/parser.cmo \
92
93
94
 \
 typing/typed.cmo typing/typer.cmo \
 \
95
 runtime/load_xml.cmo runtime/run_dispatch.cmo \
96
97
98
99
100
101
102
103
 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

104
105
106
107
108
109
ALL_OBJECTS = $(OBJECTS) \
 driver/run.cmo driver/examples.cmo driver/webiface.cmo \
 tools/dtd2cduce.cmo

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

110
111
INCLUDES = $(DIRS:%=-I %)

112
113
114
115
cduce: $(CDUCE:.cmo=.$(EXTENSION))
	$(LINK) $(INCLUDES) -o $@ $^

webiface: $(WEBIFACE:.cmo=.$(EXTENSION))
116
117
118
	$(LINK) $(INCLUDES) -o $@ $^ -ccopt -static
# webiface is made static to be able to move it more easily
# (to compile it on a machine which is not the web server)
119
120

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

123
124
125
validate: $(OBJECTS:.cmo=.$(EXTENSION)) tools/validate.ml
	$(LINK) $(INCLUDES) -o $@ $^

126
.PHONY: compute_depend
127
compute_depend: $(DEPEND_OCAMLDEP)
128
	@echo "Computing dependencies ..."
129
	ocamlfind ocamldep -package "$(PACKAGES)" $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) | \
130
        sed -e "s|: |: misc/q_symbol.cmo |" > depend
131
132
133
134
135

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


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

147
misc/q_symbol.cmo: misc/q_symbol.ml
148
	$(CAMLC) -c -pp 'camlp4o pa_extend.cmo q_MLast.cmo' $<
149

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

.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
164
	(cd web/examples; ../../cduce --quiet build.cd --arg examples.xml)
165

166
webpages: cduce web/site.cd
167
	(cd web; ../cduce --quiet site.cd --arg site.xml)
168

169
website: webpages webiface
170

171
install_web: website
172
	cp  web/www/*.html web/cduce.css  $(HTML_DIR)/
173
	cp CHANGES $(HTML_DIR)/
174
	cp webiface $(CGI_DIR)/cduce
175
176
	if test ! -d "$(HTML_DIR)/img" ; then \
	  mkdir $(HTML_DIR)/img; \
177
	fi;  
178
	cp web/img/*.*  $(HTML_DIR)/img