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