Options are implemented and fft2d.dsp test success.
[Faustine.git] / interpretor / Makefile
1 ########################## User's variables #####################
2 #
3 # The Caml sources (including camlyacc and camllex source files)
4
5 SOURCES = types.ml parser.mly lexer.mll basic.ml symbol.ml aux.ml value.ml signal.ml beam.ml process.ml faustio.ml preprocess.ml main.ml preprocess_stubs.cpp
6
7 # The executable file to generate
8
9 EXEC = faustine
10
11 # Path to ocaml include header files
12 export OCAML_INCLUDE_PATH
13
14 # Path to sndfile library
15 #SNDFILE_PATH = /home/wang/Desktop/libsndfile-ocaml
16 export SNDFILE_PATH
17
18 # Path to Faust.mr2
19 FAUST_PATH = faust-0.9.47mr3
20
21 # Path to preprocessor library
22 PREPROCESSOR_PATH = $(FAUST_PATH)/compiler
23
24 # Path to preprocessor header files
25 PREPROCESSOR_INCLUDE_PATH = $(PREPROCESSOR_PATH)/headers
26
27 # Path to the interpretor documentation
28 OCAML_DOC_PATH = ../documentation
29
30 ########################## Advanced user's variables #####################
31 #
32 # The Caml compilers.
33 # You may fix here the path to access the Caml compiler on your machine
34 # You may also have to add various -I options.
35 CAMLC = ocamlc
36 CAMLOPT = ocamlopt
37 CAMLDEP = ocamldep
38 CAMLLEX = ocamllex
39 CAMLYACC = ocamlyacc
40 CAMLDOC = ocamldoc
41 CC = g++
42
43 # The list of Caml libraries needed by the program
44 # For instance:
45 # LIBS=$(WITHGRAPHICS) $(WITHUNIX) $(WITHSTR) $(WITHNUMS) $(WITHTHREADS)\
46 # $(WITHDBM)
47
48 LIBS = $(WITHSNDFILE) $(WITHUNIX) $(WITHSTR)
49
50 # Should be set to -INCLUDE if you use any of the libraries above
51 # or if any C code have to be linked with your program
52 # (irrelevant for ocamlopt)
53
54 # INCLUDE=-INCLUDE
55
56 INCLUDE = -I $(SNDFILE_PATH)
57
58 # Default setting of the WITH* variables. Should be changed if your
59 # local libraries are not found by the compiler.
60 #WITHGRAPHICS =graphics.cma -cclib -lgraphics -cclib -L/usr/X11R6/lib -cclib -lX11
61
62 #WITHUNIX =unix.cma -cclib -lunix
63
64 #WITHSTR =str.cma -cclib -lstr
65
66 #WITHNUMS =nums.cma -cclib -lnums
67
68 #WITHTHREADS =threads.cma -cclib -lthreads
69
70 #WITHDBM =dbm.cma -cclib -lmldbm -cclib -lndbm
71
72 WITHUNIX =unix.cma
73
74 WITHSNDFILE = sndfile.cma
75
76 WITHSTR = str.cma
77
78 # c++ wrap options
79 GPP_CALL = -cc "g++"
80
81 # The list of options for each compiler
82 CAMLC_OPTIONS = $(GPP_CALL) $(INCLUDE) $(LIBS)
83
84 CAMLOPT_OPTIONS = -p $(GPP_CALL) $(INCLUDE) $(LIBS:.cma=.cmxa)
85
86 CAMLDOC_OPTIONS = -d $(OCAML_DOC_PATH) -html $(INCLUDE)
87 CC_OPTIONS = -c -I$(PREPROCESSOR_INCLUDE_PATH) -I$(OCAML_INCLUDE_PATH)
88
89 ################ End of user's variables #####################
90
91
92 ##############################################################
93 ################ This part should be generic
94 ################ Nothing to set up or fix here
95 ##############################################################
96
97 all:: .depend.input .depend preprocessor $(EXEC)
98
99 opt : .depend.input .depend preprocessor $(EXEC).opt
100
101 doc : document
102
103 #ocamlc -INCLUDE other options graphics.cma other files -cclib -lgraphics -cclib -lX11
104 #ocamlc -thread -INCLUDE other options threads.cma other files -cclib -lthreads
105 #ocamlc -INCLUDE other options str.cma other files -cclib -lstr
106 #ocamlc -INCLUDE other options nums.cma other files -cclib -lnums
107 #ocamlc -INCLUDE other options unix.cma other files -cclib -lunix
108 #ocamlc -INCLUDE other options dbm.cma other files -cclib -lmldbm -cclib -lndbm
109
110 SMLIY = $(SOURCES:.mly=.ml)
111 SMLIYL = $(SMLIY:.mll=.ml)
112 SMLYL = $(filter %.ml, $(SMLIYL))
113 OBJS = $(SMLYL:.ml=.cmo)
114 OPTOBJS = $(OBJS:.cmo=.cmx)
115
116 CSOURCES = $(filter %.cpp, $(SOURCES))
117 COBJS = $(CSOURCES:.cpp=.o)
118 CLIBS = $(PREPROCESSOR_PATH)/preprocess.a
119
120 PARSER_MLY = $(filter %.mly, $(SOURCES))
121 LEXER_MLL = $(filter %.mll, $(SOURCES))
122 MIDDLE_ML = $(PARSER_MLY:.mly=.ml) $(LEXER_MLL:.mll=.ml)
123
124 preprocessor:
125 @(cd $(FAUST_PATH) && $(MAKE))
126
127 $(EXEC): $(OBJS) $(COBJS)
128 $(CAMLC) $(CAMLC_OPTIONS) -o $(EXEC) $(OBJS) $(COBJS) $(CLIBS)
129
130 $(EXEC).opt: $(OPTOBJS) $(COBJS)
131 $(CAMLOPT) $(CAMLOPT_OPTIONS) -o $(EXEC) $(OPTOBJS) $(COBJS) $(CLIBS)
132
133 document: $(SMLYL) $(OBJS)
134 $(CAMLDOC) $(CAMLDOC_OPTIONS) $(SMLYL)
135
136 main.cmo: main.ml
137 $(CAMLC) $(INCLUDE) -c $<
138
139 main.cmx: main.ml
140 $(CAMLOPT) $(INCLUDE) -c $<
141
142 preprocess.cmo: preprocess.ml
143 $(CAMLC) $(GPP_CALL) -c $<
144
145 preprocess.cmx: preprocess.ml
146 $(CAMLOPT) $(GPP_CALL) -c $<
147
148 preprocess_stubs.o: preprocess_stubs.cpp
149 $(CC) $(CC_OPTIONS) $<
150
151 faustio.cmo: faustio.ml
152 $(CAMLC) $(INCLUDE) $(LIBS) -c $<
153
154 faustio.cmx: faustio.ml
155 $(CAMLOPT) $(INCLUDE) $(LIBS:.cma=.cmxa) -c $<
156
157 .SUFFIXES: .ml .mli .cmo .cmi .cmx .mll .mly
158
159 .ml.cmo:
160 $(CAMLC) -c $<
161
162 .mli.cmi:
163 $(CAMLC) -c $<
164
165 .ml.cmx:
166 $(CAMLOPT) -c $<
167
168 .mll.cmo:
169 $(CAMLLEX) $<
170 $(CAMLC) -c $*.ml
171
172 .mll.cmx:
173 $(CAMLLEX) $<
174 $(CAMLOPT) -c $*.ml
175
176 .mly.cmo:
177 $(CAMLYACC) $<
178 $(CAMLC) -c $*.mli
179 $(CAMLC) -c $*.ml
180
181 .mly.cmx:
182 $(CAMLYACC) $<
183 $(CAMLOPT) -c $*.mli
184 $(CAMLOPT) -c $*.ml
185
186 .mly.cmi:
187 $(CAMLYACC) $<
188 $(CAMLC) -c $*.mli
189
190 .mll.ml:
191 $(CAMLLEX) $<
192
193 .mly.ml:
194 $(CAMLYACC) $<
195
196 clean::
197 rm -f *.cm[iox] *~ .*~ #*#
198 rm -f $(MIDDLE_ML) *.o *.mli .depend*
199
200 mrproper: clean
201 rm -f $(EXEC)*
202
203 .depend.input: Makefile
204 @echo -n '--Checking Ocaml input files: '
205 @(ls $(SMLIY) $(SMLIY:.ml=.mli) 2>/dev/null || true) \
206 > .depend.new
207 @diff .depend.new .depend.input 2>/dev/null 1>/dev/null && \
208 (echo 'unchanged'; rm -f .depend.new) || \
209 (echo 'changed'; mv .depend.new .depend.input)
210
211 depend: .depend
212
213 .depend:: $(SMLIY) .depend.input
214 @echo '--Re-building dependencies'
215 $(CAMLDEP) $(SMLIY) $(SMLIY:.ml=.mli) > .depend
216
217 include .depend