From: Karim Barkati Date: Thu, 12 Sep 2013 09:52:04 +0000 (+0200) Subject: New Makefile for libsndfile-ocaml library integration; Makefiles chain modified. X-Git-Url: https://scm.cri.ensmp.fr/git/Faustine.git/commitdiff_plain/f4b893045495fe7868d595f2663adb3808dbac2c?ds=sidebyside;hp=-c New Makefile for libsndfile-ocaml library integration; Makefiles chain modified. --- f4b893045495fe7868d595f2663adb3808dbac2c diff --git a/.gitignore b/.gitignore index 8ad4bde..8332efa 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,8 @@ parser.ml lexer.ml *.mli .depend* -examples/*/output* +output*.wav +output*.csv *.lo *.Po *.Plo @@ -81,3 +82,5 @@ interpretor/lib/src/libsndfile-1.0.25/examples/sndfilehandle interpretor/lib/src/libsndfile-1.0.25/examples/.libs/sndfilehandle interpretor/lib/src/libsndfile-1.0.25/src/stamp-h1 interpretor/lib/src/libsndfile-1.0.25/tests/test_wrapper.sh +interpretor/lib/src/libsndfile-ocaml/sndfile.cma +interpretor/lib/src/libsndfile-ocaml/sndfile.cmxa diff --git a/Makefile.in b/Makefile.in index 972de0f..b370540 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,20 +1,21 @@ +# Faustine top-level Makefile. + +EXEC = faustine SRC_DIR = interpretor PREPROCESSOR_DIR = $(SRC_DIR)/preprocessor/faust-0.9.47mr3 OUTPUTSOUNDS_DIR = examples/output_sounds -EXEC = faustine DESTDIR ?= PREFIX ?= /usr/local -CROSS=i586-mingw32msvc- - prefix := $(DESTDIR)$(PREFIX) arch := $(wildcard architecture/*.*) all: $(EXEC) faustine: - @cp $(SNDFILE_PATH)/sndfile_stub.o $(SRC_DIR) - @cd $(SRC_DIR) && $(MAKE) opt OCAML_INCLUDE_PATH=$(OCAML_INCLUDE_PATH) SNDFILE_PATH=$(SNDFILE_PATH) +# @cp $(SNDFILE_PATH)/sndfile_stub.o $(SRC_DIR) +## Using ocamlopt with 'make opt' + @cd $(SRC_DIR) && $(MAKE) opt #OCAML_INCLUDE_PATH=$(OCAML_INCLUDE_PATH) SNDFILE_PATH=$(SNDFILE_PATH) @cd $(SRC_DIR) && $(MAKE) clean .PHONY: clean mrproper test help install uninstall @@ -35,7 +36,7 @@ mrproper: clean @(cd $(SRC_DIR) && $(MAKE) mrproper) @(cd $(PREPROCESSOR_DIR) && $(MAKE) clean) -test: +test: # TODO, obsolete @rm -f $(OUTPUTSOUNDS_DIR)/output0.wav @cd $(SRC_DIR) && ./faustine -d ../dsp_files/sin.dsp @ls -l $(OUTPUTSOUNDS_DIR)/output0.wav @@ -54,8 +55,3 @@ install : uninstall : rm -rf $(prefix)/lib/faustine/ rm -f $(prefix)/bin/faustine - - -# Library paths for OCaml and libsndfile-ocaml -# OCAML_INCLUDE_PATH -# SNDFILE_PATH diff --git a/interpretor/Makefile b/interpretor/Makefile index 3a35e1c..4a5f84f 100644 --- a/interpretor/Makefile +++ b/interpretor/Makefile @@ -1,3 +1,5 @@ +# Faustine interpreter Makefile. + ########################## User's variables ##################### # # The Caml sources (including camlyacc and camllex source files) @@ -5,17 +7,15 @@ 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 # The executable file to generate - EXEC = faustine # Path to ocaml include header files -export OCAML_INCLUDE_PATH +OCAML_INCLUDE_PATH := $(subst bin,lib,$(shell which ocaml)) # Path to sndfile library -#SNDFILE_PATH = /home/wang/Desktop/libsndfile-ocaml -export SNDFILE_PATH +SNDFILE_PATH := lib/libsndfile -# Path to Faust.mr2 +# Path to Faust.mr3 FAUST_PATH = preprocessor/faust-0.9.47mr3 # Path to preprocessor library @@ -84,6 +84,7 @@ CAMLC_OPTIONS = $(GPP_CALL) $(INCLUDE) $(LIBS) CAMLOPT_OPTIONS = -p $(GPP_CALL) $(INCLUDE) $(LIBS:.cma=.cmxa) CAMLDOC_OPTIONS = -d $(OCAML_DOC_PATH) -html $(INCLUDE) + CC_OPTIONS = -c -I$(PREPROCESSOR_INCLUDE_PATH) -I$(OCAML_INCLUDE_PATH) ################ End of user's variables ##################### @@ -122,16 +123,19 @@ LEXER_MLL = $(filter %.mll, $(SOURCES)) MIDDLE_ML = $(PARSER_MLY:.mly=.ml) $(LEXER_MLL:.mll=.ml) preprocessor:: - echo "Compling preprocessor..." + @echo "Compiling preprocessor..." cd $(FAUST_PATH) && $(MAKE) $(EXEC): $(OBJS) $(COBJS) $(CLIBS) + @echo "Compiling $(EXEC)..." $(CAMLC) $(CAMLC_OPTIONS) -o $(EXEC) $(OBJS) $(COBJS) $(CLIBS) $(EXEC).opt: $(OPTOBJS) $(COBJS) $(CLIBS) + @echo "Compiling optimized $(EXEC)..." $(CAMLOPT) $(CAMLOPT_OPTIONS) -o $(EXEC) $(OPTOBJS) $(COBJS) $(CLIBS) document: $(SMLYL) $(OBJS) + @echo "Compiling documentation..." $(CAMLDOC) $(CAMLDOC_OPTIONS) $(SMLYL) main.cmo: main.ml diff --git a/interpretor/lib/Makefile b/interpretor/lib/Makefile index e249b40..d6ed16f 100644 --- a/interpretor/lib/Makefile +++ b/interpretor/lib/Makefile @@ -1,40 +1,35 @@ -LIBSNDFILESRC := src/libsndfile-1.0.25 -prefix := libsndfile -rootdir := $(abspath .) -#TARGETDIR ?= "" -#PREFIX ?= /usr/local -#prefix := $(DESTDIR)$(PREFIX) -#arch := $(wildcard architecture/*.*) +# Faustine library dependancies Makefile. + +LIBSNDFILE_SRCDIR ?= src/libsndfile-1.0.25 +LIBSFOCAML_SRCDIR ?= src/libsndfile-ocaml +LIBSNDFILE_DESTNAME ?= libsndfile +DESTDIR := $(abspath .)/$(LIBSNDFILE_DESTNAME) all: librairies -librairies :: libsndfile -# @cp $(SNDFILE_PATH)/sndfile_stub.o $(SRC_DIR) -# @cd $(SRC_DIR) && $(MAKE) opt OCAML_INCLUDE_PATH=$(OCAML_INCLUDE_PATH) SNDFILE_PATH=$(SNDFILE_PATH) -# @cd $(SRC_DIR) && $(MAKE) clean +librairies : libsndfile libsfocaml libsndfile: - mkdir -p $(prefix) - cd $(LIBSNDFILESRC) && ./configure --prefix="$(rootdir)/$(prefix)" --exec_prefix="$(rootdir)/$(prefix)" - cd $(LIBSNDFILESRC) && make - cd $(LIBSNDFILESRC) && make install + mkdir -p $(DESTDIR) + cd $(LIBSNDFILE_SRCDIR) && ./configure --prefix="$(DESTDIR)" --exec_prefix="$(DESTDIR)" + cd $(LIBSNDFILE_SRCDIR) && make + cd $(LIBSNDFILE_SRCDIR) && make install + cd $(LIBSNDFILE_SRCDIR) && make clean + +libsfocaml: + cd $(LIBSFOCAML_SRCDIR) && PKG_CONFIG_PATH=$(DESTDIR)/lib/pkgconfig + cd $(LIBSFOCAML_SRCDIR) && make + cd $(LIBSFOCAML_SRCDIR) #&& make clean -.PHONY: clean mrproper help libsndfile +.PHONY: clean mrproper help libsndfile libsfocaml help : @echo "make or make all : compile librairies" @echo "make clean : remove all object files" clean: - @(cd $(LIBSNDFILESRC) && $(MAKE) clean) + @(cd $(LIBSNDFILE_SRCDIR) && $(MAKE) clean) @(rm -f *~) mrproper: clean - @(cd $(LIBSNDFILESRC) && $(MAKE) clean) - - -# Library paths for OCaml and libsndfile-ocaml -# OCAML_INCLUDE_PATH -# SNDFILE_PATH -OCAML_INCLUDE_PATH = /usr/local/lib/ocaml -SNDFILE_PATH = /Users/karimbarkati/Boulot/2013-07-CRI/Interpretor/libsndfile-ocaml + rm -rf $(DESTDIR) diff --git a/interpretor/lib/src/libsndfile-ocaml/Makefile b/interpretor/lib/src/libsndfile-ocaml/Makefile index 299214a..8df3b1e 100644 --- a/interpretor/lib/src/libsndfile-ocaml/Makefile +++ b/interpretor/lib/src/libsndfile-ocaml/Makefile @@ -1,6 +1,7 @@ +LIBSNDFILEDIR = ../../libsndfile/lib #/home/erikd/Local/lib CC = gcc -CFLAGS = -g -W -Wall -Werror +CFLAGS = -g -W -Wall -Werror -Wno-missing-field-initializers OCAMLC = ocamlc OCAMLOPT = ocamlopt @@ -10,9 +11,11 @@ OCAMLDOC = ocamldoc SNDFILE_CFLAGS = $(shell pkg-config --cflags sndfile) SNDFILE_LIBS = $(shell pkg-config --libs sndfile) -OCAML_CFLAGS = -I /usr/lib/ocaml/$(shell ocamlopt -version) +OCAML_BINDIR = $(shell which ocaml) +OCAML_LIBDIR = $(subst bin,lib,$(OCAML_BINDIR)) +OCAML_CFLAGS = -I $(OCAML_LIBDIR) #/usr/lib/ocaml/$(shell ocamlopt -version) -LIBSNDFILE = -ccopt -L/home/erikd/Local/lib -cclib -lsndfile -cclib -lm +LIBSNDFILE = -ccopt -L$(LIBSNDFILEDIR) -cclib -lsndfile -cclib -lm all: sndfile.cma sndfile.cmxa