1 # Faustine interpreter Makefile.
3 ########################## User's variables #####################
5 # The Caml sources (including camlyacc and camllex source files)
7 SOURCES
= types.ml parser.mly lexer.mll aux.ml basic.ml symbol.ml value.ml signal.ml beam.ml process.ml faustio.ml preprocess.ml main.ml preprocess_stubs.
cpp
9 # The executable file to generate
12 # Path to ocaml include header files
13 OCAML_INCLUDE_PATH
:= $(subst bin
,lib
,$(shell which ocaml
))
15 # Path to sndfile library
18 # Path to sndfile-ocaml library
19 SNDFILE_OCAML_PATH
:= $(SNDFILE_PATH
)/src
/libsndfile-ocaml
22 FAUST_PATH
= preprocessor
/faust-0.9
.47mr3
24 # Path to preprocessor library
25 PREPROCESSOR_PATH
= $(FAUST_PATH
)/compiler
27 # Path to preprocessor header files
28 PREPROCESSOR_INCLUDE_PATH
= $(PREPROCESSOR_PATH
)/headers
30 # Path to preprocessor cpp files
31 PREPROCESSOR_SRC
= $(wildcard $(PREPROCESSOR_PATH
)/*/*.
cpp) $(wildcard $(PREPROCESSOR_PATH
)/draw
/*/*.
cpp)
33 # Path to preprocessor obj files
34 PREPROCESSOR_OBJ
= $(PREPROCESSOR_SRC
:.
cpp=.o
)
36 # Path to the interpreter documentation
37 OCAML_DOC_PATH
= ..
/documentation
39 ########################## Advanced user's variables #####################
42 # You may fix here the path to access the Caml compiler on your machine
43 # You may also have to add various -I options.
52 # The list of Caml libraries needed by the program
54 # LIBS=$(WITHGRAPHICS) $(WITHUNIX) $(WITHSTR) $(WITHNUMS) $(WITHTHREADS)\
57 LIBS
= $(WITHSNDFILE
) $(WITHUNIX
) $(WITHSTR
)
59 # Should be set to -INCLUDE if you use any of the libraries above
60 # or if any C code have to be linked with your program
61 # (irrelevant for ocamlopt)
65 INCLUDE
= -I
$(SNDFILE_OCAML_PATH
)
66 SNDFILE_STUB
:= $(SNDFILE_OCAML_PATH
)/sndfile_stub.o
68 # Default setting of the WITH* variables. Should be changed if your
69 # local libraries are not found by the compiler.
70 #WITHGRAPHICS =graphics.cma -cclib -lgraphics -cclib -L/usr/X11R6/lib -cclib -lX11
72 #WITHUNIX =unix.cma -cclib -lunix
74 #WITHSTR =str.cma -cclib -lstr
76 #WITHNUMS =nums.cma -cclib -lnums
78 #WITHTHREADS =threads.cma -cclib -lthreads
80 #WITHDBM =dbm.cma -cclib -lmldbm -cclib -lndbm
84 WITHSNDFILE
= sndfile.cma
91 # The list of options for each compiler
92 CAMLC_OPTIONS
= $(GPP_CALL
) $(INCLUDE
) $(LIBS
)
94 CAMLOPT_OPTIONS
= -p
$(GPP_CALL
) $(INCLUDE
) $(LIBS
:.cma
=.cmxa
)
96 CAMLDOC_OPTIONS
= -d
$(OCAML_DOC_PATH
) -html
$(INCLUDE
)
98 CC_OPTIONS
= -c
-I
$(PREPROCESSOR_INCLUDE_PATH
) -I
$(OCAML_INCLUDE_PATH
)
100 ################ End of user's variables #####################
103 ##############################################################
104 ################ This part should be generic
105 ################ Nothing to set up or fix here
106 ##############################################################
108 all:: .depend.input .depend preprocessor libsndfile-ocaml
$(EXEC
)
110 opt
: .depend.input .depend preprocessor libsndfile-ocaml
$(EXEC
).opt
114 #ocamlc -INCLUDE other options graphics.cma other files -cclib -lgraphics -cclib -lX11
115 #ocamlc -thread -INCLUDE other options threads.cma other files -cclib -lthreads
116 #ocamlc -INCLUDE other options str.cma other files -cclib -lstr
117 #ocamlc -INCLUDE other options nums.cma other files -cclib -lnums
118 #ocamlc -INCLUDE other options unix.cma other files -cclib -lunix
119 #ocamlc -INCLUDE other options dbm.cma other files -cclib -lmldbm -cclib -lndbm
121 SMLIY
= $(SOURCES
:.mly
=.ml
)
122 SMLIYL
= $(SMLIY
:.mll
=.ml
)
123 SMLYL
= $(filter %.ml
, $(SMLIYL
))
124 OBJS
= $(SMLYL
:.ml
=.cmo
)
125 MLYS
= $(filter %.mly
, $(SOURCES
))
126 MLIS
= $(MLYS
:.mly
=.mli
)
127 OPTOBJS
= $(OBJS
:.cmo
=.cmx
)
129 CSOURCES
= $(filter %.
cpp, $(SOURCES
))
130 COBJS
= $(CSOURCES
:.
cpp=.o
)
131 #CLIBS = $(PREPROCESSOR_PATH)/preprocess.a
132 CLIBS
= $(PREPROCESSOR_OBJ
)
134 PARSER_MLY
= $(filter %.mly
, $(SOURCES
))
135 LEXER_MLL
= $(filter %.mll
, $(SOURCES
))
136 MIDDLE_ML
= $(PARSER_MLY
:.mly
=.ml
) $(LEXER_MLL
:.mll
=.ml
)
139 @echo
"Compiling preprocessor..."
140 $(MAKE
) -C
$(FAUST_PATH
) preprocessor
143 @echo
"Compiling libsndfile-ocaml..."
144 $(MAKE
) -C
$(SNDFILE_PATH
)
147 $(EXEC
): $(OBJS
) $(COBJS
) $(CLIBS
)
148 @echo
"Compiling $(EXEC)..."
150 $(CAMLC
) $(CAMLC_OPTIONS
) -o
$(EXEC
) $(OBJS
) $(COBJS
) $(CLIBS
)
152 $(EXEC
).opt
: $(OPTOBJS
) $(COBJS
) $(CLIBS
)
153 @echo
"Compiling optimized $(EXEC)..."
155 $(CAMLOPT
) $(CAMLOPT_OPTIONS
) -o
$(EXEC
) $(OPTOBJS
) $(COBJS
) $(CLIBS
)
157 document
: $(SMLYL
) $(OBJS
)
158 @echo
"Compiling documentation..."
159 $(CAMLDOC
) $(CAMLDOC_OPTIONS
) $(SMLYL
)
162 $(CAMLC
) $(INCLUDE
) -c
$<
165 $(CAMLOPT
) $(INCLUDE
) -c
$<
167 preprocess.cmo
: preprocess.ml
168 $(CAMLC
) $(GPP_CALL
) -c
$<
170 preprocess.cmx
: preprocess.ml
171 $(CAMLOPT
) $(GPP_CALL
) -c
$<
173 preprocess_stubs.o
: preprocess_stubs.
cpp
174 $(CC
) $(CC_OPTIONS
) $<
176 faustio.cmo
: faustio.ml
177 $(CAMLC
) $(INCLUDE
) $(LIBS
) -c
$<
179 faustio.cmx
: faustio.ml
180 $(CAMLOPT
) $(INCLUDE
) $(LIBS
:.cma
=.cmxa
) -c
$<
182 .SUFFIXES
: .ml .mli .cmo .cmi .cmx .mll .mly
222 rm -f
*.cm
[iox
] *~ .
*~
223 rm -f
$(MIDDLE_ML
) *.o
$(MLIS
) # .depend*
224 @
$(MAKE
) -C
$(SNDFILE_PATH
) clean
227 @
$(MAKE
) -C
$(SNDFILE_PATH
) mrproper
228 rm -f
$(EXEC
)* .depend
*
230 .depend.input
: Makefile
231 @echo
-n
'--Checking Ocaml input files: '
232 @
(ls
$(SMLIY
) $(SMLIY
:.ml
=.mli
) 2>/dev
/null || true
) \
234 @diff .depend.new .depend.input
2>/dev
/null
1>/dev
/null
&& \
235 (echo
'unchanged'; rm -f .depend.new
) || \
236 (echo
'changed'; mv .depend.new .depend.input
)
240 .depend
:: $(SMLIY
) .depend.input
241 @echo
'--Re-building dependencies'
242 $(CAMLDEP
) $(SMLIY
) $(SMLIY
:.ml
=.mli
) > .depend