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 basic.ml symbol.ml aux.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
16 SNDFILE_PATH
:= lib
/libsndfile
19 FAUST_PATH
= preprocessor
/faust-0.9
.47mr3
21 # Path to preprocessor library
22 PREPROCESSOR_PATH
= $(FAUST_PATH
)/compiler
24 # Path to preprocessor header files
25 PREPROCESSOR_INCLUDE_PATH
= $(PREPROCESSOR_PATH
)/headers
27 # Path to the interpretor documentation
28 OCAML_DOC_PATH
= ..
/documentation
30 ########################## Advanced user's variables #####################
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.
43 # The list of Caml libraries needed by the program
45 # LIBS=$(WITHGRAPHICS) $(WITHUNIX) $(WITHSTR) $(WITHNUMS) $(WITHTHREADS)\
48 LIBS
= $(WITHSNDFILE
) $(WITHUNIX
) $(WITHSTR
)
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)
56 INCLUDE
= -I
$(SNDFILE_PATH
)
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
62 #WITHUNIX =unix.cma -cclib -lunix
64 #WITHSTR =str.cma -cclib -lstr
66 #WITHNUMS =nums.cma -cclib -lnums
68 #WITHTHREADS =threads.cma -cclib -lthreads
70 #WITHDBM =dbm.cma -cclib -lmldbm -cclib -lndbm
74 WITHSNDFILE
= sndfile.cma
81 # The list of options for each compiler
82 CAMLC_OPTIONS
= $(GPP_CALL
) $(INCLUDE
) $(LIBS
)
84 CAMLOPT_OPTIONS
= -p
$(GPP_CALL
) $(INCLUDE
) $(LIBS
:.cma
=.cmxa
)
86 CAMLDOC_OPTIONS
= -d
$(OCAML_DOC_PATH
) -html
$(INCLUDE
)
88 CC_OPTIONS
= -c
-I
$(PREPROCESSOR_INCLUDE_PATH
) -I
$(OCAML_INCLUDE_PATH
)
90 ################ End of user's variables #####################
93 ##############################################################
94 ################ This part should be generic
95 ################ Nothing to set up or fix here
96 ##############################################################
98 all:: .depend.input .depend preprocessor
$(EXEC
)
100 opt
: .depend.input .depend preprocessor
$(EXEC
).opt
104 #ocamlc -INCLUDE other options graphics.cma other files -cclib -lgraphics -cclib -lX11
105 #ocamlc -thread -INCLUDE other options threads.cma other files -cclib -lthreads
106 #ocamlc -INCLUDE other options str.cma other files -cclib -lstr
107 #ocamlc -INCLUDE other options nums.cma other files -cclib -lnums
108 #ocamlc -INCLUDE other options unix.cma other files -cclib -lunix
109 #ocamlc -INCLUDE other options dbm.cma other files -cclib -lmldbm -cclib -lndbm
111 SMLIY
= $(SOURCES
:.mly
=.ml
)
112 SMLIYL
= $(SMLIY
:.mll
=.ml
)
113 SMLYL
= $(filter %.ml
, $(SMLIYL
))
114 OBJS
= $(SMLYL
:.ml
=.cmo
)
115 OPTOBJS
= $(OBJS
:.cmo
=.cmx
)
117 CSOURCES
= $(filter %.
cpp, $(SOURCES
))
118 COBJS
= $(CSOURCES
:.
cpp=.o
)
119 CLIBS
= $(PREPROCESSOR_PATH
)/preprocess.a
121 PARSER_MLY
= $(filter %.mly
, $(SOURCES
))
122 LEXER_MLL
= $(filter %.mll
, $(SOURCES
))
123 MIDDLE_ML
= $(PARSER_MLY
:.mly
=.ml
) $(LEXER_MLL
:.mll
=.ml
)
126 @echo
"Compiling preprocessor..."
127 cd
$(FAUST_PATH
) && $(MAKE
)
129 $(EXEC
): $(OBJS
) $(COBJS
) $(CLIBS
)
130 @echo
"Compiling $(EXEC)..."
131 $(CAMLC
) $(CAMLC_OPTIONS
) -o
$(EXEC
) $(OBJS
) $(COBJS
) $(CLIBS
)
133 $(EXEC
).opt
: $(OPTOBJS
) $(COBJS
) $(CLIBS
)
134 @echo
"Compiling optimized $(EXEC)..."
135 $(CAMLOPT
) $(CAMLOPT_OPTIONS
) -o
$(EXEC
) $(OPTOBJS
) $(COBJS
) $(CLIBS
)
137 document
: $(SMLYL
) $(OBJS
)
138 @echo
"Compiling documentation..."
139 $(CAMLDOC
) $(CAMLDOC_OPTIONS
) $(SMLYL
)
142 $(CAMLC
) $(INCLUDE
) -c
$<
145 $(CAMLOPT
) $(INCLUDE
) -c
$<
147 preprocess.cmo
: preprocess.ml
148 $(CAMLC
) $(GPP_CALL
) -c
$<
150 preprocess.cmx
: preprocess.ml
151 $(CAMLOPT
) $(GPP_CALL
) -c
$<
153 preprocess_stubs.o
: preprocess_stubs.
cpp
154 $(CC
) $(CC_OPTIONS
) $<
156 faustio.cmo
: faustio.ml
157 $(CAMLC
) $(INCLUDE
) $(LIBS
) -c
$<
159 faustio.cmx
: faustio.ml
160 $(CAMLOPT
) $(INCLUDE
) $(LIBS
:.cma
=.cmxa
) -c
$<
162 .SUFFIXES
: .ml .mli .cmo .cmi .cmx .mll .mly
202 rm -f
*.cm
[iox
] *~ .
*~
#*#
203 rm -f
$(MIDDLE_ML
) *.o
*.mli .depend
*
208 .depend.input
: Makefile
209 @echo
-n
'--Checking Ocaml input files: '
210 @
(ls
$(SMLIY
) $(SMLIY
:.ml
=.mli
) 2>/dev
/null || true
) \
212 @diff .depend.new .depend.input
2>/dev
/null
1>/dev
/null
&& \
213 (echo
'unchanged'; rm -f .depend.new
) || \
214 (echo
'changed'; mv .depend.new .depend.input
)
218 .depend
:: $(SMLIY
) .depend.input
219 @echo
'--Re-building dependencies'
220 $(CAMLDEP
) $(SMLIY
) $(SMLIY
:.ml
=.mli
) > .depend