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 the interpretor documentation
31 OCAML_DOC_PATH
= ..
/documentation
33 ########################## Advanced user's variables #####################
36 # You may fix here the path to access the Caml compiler on your machine
37 # You may also have to add various -I options.
46 # The list of Caml libraries needed by the program
48 # LIBS=$(WITHGRAPHICS) $(WITHUNIX) $(WITHSTR) $(WITHNUMS) $(WITHTHREADS)\
51 LIBS
= $(WITHSNDFILE
) $(WITHUNIX
) $(WITHSTR
)
53 # Should be set to -INCLUDE if you use any of the libraries above
54 # or if any C code have to be linked with your program
55 # (irrelevant for ocamlopt)
59 INCLUDE
= -I
$(SNDFILE_OCAML_PATH
)
60 SNDFILE_STUB
:= $(SNDFILE_OCAML_PATH
)/sndfile_stub.o
62 # Default setting of the WITH* variables. Should be changed if your
63 # local libraries are not found by the compiler.
64 #WITHGRAPHICS =graphics.cma -cclib -lgraphics -cclib -L/usr/X11R6/lib -cclib -lX11
66 #WITHUNIX =unix.cma -cclib -lunix
68 #WITHSTR =str.cma -cclib -lstr
70 #WITHNUMS =nums.cma -cclib -lnums
72 #WITHTHREADS =threads.cma -cclib -lthreads
74 #WITHDBM =dbm.cma -cclib -lmldbm -cclib -lndbm
78 WITHSNDFILE
= sndfile.cma
85 # The list of options for each compiler
86 CAMLC_OPTIONS
= $(GPP_CALL
) $(INCLUDE
) $(LIBS
)
88 CAMLOPT_OPTIONS
= -p
$(GPP_CALL
) $(INCLUDE
) $(LIBS
:.cma
=.cmxa
)
90 CAMLDOC_OPTIONS
= -d
$(OCAML_DOC_PATH
) -html
$(INCLUDE
)
92 CC_OPTIONS
= -c
-I
$(PREPROCESSOR_INCLUDE_PATH
) -I
$(OCAML_INCLUDE_PATH
)
94 ################ End of user's variables #####################
97 ##############################################################
98 ################ This part should be generic
99 ################ Nothing to set up or fix here
100 ##############################################################
102 all:: .depend.input .depend preprocessor libsndfile-ocaml
$(EXEC
)
104 opt
: .depend.input .depend preprocessor libsndfile-ocaml
$(EXEC
).opt
108 #ocamlc -INCLUDE other options graphics.cma other files -cclib -lgraphics -cclib -lX11
109 #ocamlc -thread -INCLUDE other options threads.cma other files -cclib -lthreads
110 #ocamlc -INCLUDE other options str.cma other files -cclib -lstr
111 #ocamlc -INCLUDE other options nums.cma other files -cclib -lnums
112 #ocamlc -INCLUDE other options unix.cma other files -cclib -lunix
113 #ocamlc -INCLUDE other options dbm.cma other files -cclib -lmldbm -cclib -lndbm
115 SMLIY
= $(SOURCES
:.mly
=.ml
)
116 SMLIYL
= $(SMLIY
:.mll
=.ml
)
117 SMLYL
= $(filter %.ml
, $(SMLIYL
))
118 OBJS
= $(SMLYL
:.ml
=.cmo
)
119 MLYS
= $(filter %.mly
, $(SOURCES
))
120 MLIS
= $(MLYS
:.mly
=.mli
)
121 OPTOBJS
= $(OBJS
:.cmo
=.cmx
)
123 CSOURCES
= $(filter %.
cpp, $(SOURCES
))
124 COBJS
= $(CSOURCES
:.
cpp=.o
)
125 CLIBS
= $(PREPROCESSOR_PATH
)/preprocess.a
127 PARSER_MLY
= $(filter %.mly
, $(SOURCES
))
128 LEXER_MLL
= $(filter %.mll
, $(SOURCES
))
129 MIDDLE_ML
= $(PARSER_MLY
:.mly
=.ml
) $(LEXER_MLL
:.mll
=.ml
)
132 @echo
"Compiling preprocessor..."
133 $(MAKE
) -C
$(FAUST_PATH
) preprocessor
136 @echo
"Compiling libsndfile-ocaml..."
137 $(MAKE
) -C
$(SNDFILE_PATH
)
140 $(EXEC
): $(OBJS
) $(COBJS
) $(CLIBS
)
141 @echo
"Compiling $(EXEC)..."
143 $(CAMLC
) $(CAMLC_OPTIONS
) -o
$(EXEC
) $(OBJS
) $(COBJS
) $(CLIBS
)
145 $(EXEC
).opt
: $(OPTOBJS
) $(COBJS
) $(CLIBS
)
146 @echo
"Compiling optimized $(EXEC)..."
148 $(CAMLOPT
) $(CAMLOPT_OPTIONS
) -o
$(EXEC
) $(OPTOBJS
) $(COBJS
) $(CLIBS
)
150 document
: $(SMLYL
) $(OBJS
)
151 @echo
"Compiling documentation..."
152 $(CAMLDOC
) $(CAMLDOC_OPTIONS
) $(SMLYL
)
155 $(CAMLC
) $(INCLUDE
) -c
$<
158 $(CAMLOPT
) $(INCLUDE
) -c
$<
160 preprocess.cmo
: preprocess.ml
161 $(CAMLC
) $(GPP_CALL
) -c
$<
163 preprocess.cmx
: preprocess.ml
164 $(CAMLOPT
) $(GPP_CALL
) -c
$<
166 preprocess_stubs.o
: preprocess_stubs.
cpp
167 $(CC
) $(CC_OPTIONS
) $<
169 faustio.cmo
: faustio.ml
170 $(CAMLC
) $(INCLUDE
) $(LIBS
) -c
$<
172 faustio.cmx
: faustio.ml
173 $(CAMLOPT
) $(INCLUDE
) $(LIBS
:.cma
=.cmxa
) -c
$<
175 .SUFFIXES
: .ml .mli .cmo .cmi .cmx .mll .mly
215 rm -f
*.cm
[iox
] *~ .
*~
216 rm -f
$(MIDDLE_ML
) *.o
$(MLIS
) # .depend*
217 @
$(MAKE
) -C
$(SNDFILE_PATH
) clean
220 @
$(MAKE
) -C
$(SNDFILE_PATH
) mrproper
221 rm -f
$(EXEC
)* .depend
*
223 .depend.input
: Makefile
224 @echo
-n
'--Checking Ocaml input files: '
225 @
(ls
$(SMLIY
) $(SMLIY
:.ml
=.mli
) 2>/dev
/null || true
) \
227 @diff .depend.new .depend.input
2>/dev
/null
1>/dev
/null
&& \
228 (echo
'unchanged'; rm -f .depend.new
) || \
229 (echo
'changed'; mv .depend.new .depend.input
)
233 .depend
:: $(SMLIY
) .depend.input
234 @echo
'--Re-building dependencies'
235 $(CAMLDEP
) $(SMLIY
) $(SMLIY
:.ml
=.mli
) > .depend