Makefile.distrib 4.64 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 -g
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 compile 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
 compile/lambda.cmo \
96
 \
97
 runtime/load_xml.cmo runtime/run_dispatch.cmo \
98
 runtime/explain.cmo \
99
 runtime/print_xml.cmo runtime/eval.cmo \
100
 compile/compile.cmo \
101
 compile/operators.cmo \
102 103 104 105 106 107 108
 \
 types/builtin.cmo driver/cduce.cmo

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

109 110 111 112 113 114
ALL_OBJECTS = $(OBJECTS) \
 driver/run.cmo driver/examples.cmo driver/webiface.cmo \
 tools/dtd2cduce.cmo

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

115 116
INCLUDES = $(DIRS:%=-I %)

117 118 119
cduce: $(CDUCE:.cmo=.$(EXTENSION))
	$(LINK) $(INCLUDES) -o $@ $^

120 121 122
bug: $(OBJECTS) bug.cmo
	$(LINK) $(INCLUDES) -o $@ $^

123
webiface: $(WEBIFACE:.cmo=.$(EXTENSION))
124 125 126
	$(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)
127 128

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

131 132 133
validate: $(OBJECTS:.cmo=.$(EXTENSION)) tools/validate.ml
	$(LINK) $(INCLUDES) -o $@ $^

134
.PHONY: compute_depend
135
compute_depend: $(DEPEND_OCAMLDEP)
136
	@echo "Computing dependencies ..."
137
	ocamlfind ocamldep -package "$(PACKAGES)" $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) | \
138
        sed -e "s|: |: misc/q_symbol.cmo |" > depend
139 140 141 142 143

clean:
	for i in $(CLEAN_DIRS); do \
	(cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *~); \
	done
144
	(cd expat; $(MAKE) clean)
145
	rm -f `find . -name "*~"`
146 147
	rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.o *~
	rm -f cduce ocamlprof.dump
148
	rm -f dtd2cduce pool webiface validate
149
	rm -Rf prepro package
150
	rm -f web/www/*.html web/*~
151 152 153 154


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

155
misc/q_symbol.cmo: misc/q_symbol.ml
156
	$(CAMLC) -c -pp 'camlp4o pa_extend.cmo q_MLast.cmo' $<
157

158
.ml.cmo:
159
	$(CAMLC) -c $(INCLUDES) $(SYNTAX_PARSER) $<
160 161 162 163 164 165 166 167 168 169 170 171

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

174
webpages: cduce web/site.cd
175
	(cd web; ../cduce --quiet site.cd --arg site.xml)
176

177
website: webpages webiface
178

179
install_web: website
180
	cp  web/www/*.html web/cduce.css  $(HTML_DIR)/
181
	cp CHANGES $(HTML_DIR)/
182
	cp webiface $(CGI_DIR)/cduce
183 184
	if test ! -d "$(HTML_DIR)/img" ; then \
	  mkdir $(HTML_DIR)/img; \
185
	fi;  
186
	cp web/img/*.*  $(HTML_DIR)/img