From: WANG <wang@wang-OptiPlex-780.(none)>
Date: Mon, 16 Sep 2013 15:44:39 +0000 (+0200)
Subject: Examples' Makefiles are completed and tested.
X-Git-Url: https://svn.cri.ensmp.fr/git/Faustine.git/commitdiff_plain/829259826b29edc284ec43810bb505a832091dda

Examples' Makefiles are completed and tested.
---

diff --git a/Makefile b/Makefile
index c558b8c..2743a33 100644
--- a/Makefile
+++ b/Makefile
@@ -33,6 +33,7 @@ clean:
 mrproper: clean
 	@($(MAKE) -C $(SRC_DIR) mrproper)
 	@($(MAKE) -C $(PREPROCESSOR_DIR) clean)
+	@($(MAKE) -C $(EXAMPLES_DIR) clean)
 
 test:
 	@$(MAKE) -C $(SINWAVE_DIR)
@@ -43,6 +44,9 @@ test:
 	@echo "open $(SINWAVE_DIR)/output1.wav"
 	@echo "octave -q --eval 'plot(wavread(\"$(SINWAVE_DIR)/output1.wav\")); pause'"
 
+example:
+	@($(MAKE) -C $(EXAMPLES_DIR))
+
 install :
 	mkdir -p $(prefix)/lib/faustine/
 	mkdir -p $(prefix)/bin/
diff --git a/examples/Makefile b/examples/Makefile
index 66667e1..c7e43eb 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -1,4 +1,15 @@
-SOURCES = $(wildcard */*.dsp)
+#SOURCES = $(wildcard */*.dsp)
+#MAKEFILES = $(wildcard */Makefile)
+EXAMPLES = 2d_fft close dilation erosion fft licenceplate open primitives sinwave
 
-all: $(SOURCES)
-	
+all: examples
+
+examples::
+	echo "Making all the examples, it may take several mins..."
+	@$(foreach example, $(EXAMPLES), cd $(example) && make && cd ..;)
+
+clean::
+	@$(foreach example, $(EXAMPLES), cd $(example) && make clean && cd ..;)
+
+#examples:
+#	cd primitives && make
diff --git a/examples/close/img_read.m b/examples/close/img_read.m
index 1f1beae..941dbfa 100644
--- a/examples/close/img_read.m
+++ b/examples/close/img_read.m
@@ -1,2 +1,2 @@
-a = imread('circbw.png' );
+a = imread('circbw.gif' );
 csvwrite('circbw.csv', a);
diff --git a/examples/fft/Makefile b/examples/fft/Makefile
index fa1e89d..20aeaf3 100644
--- a/examples/fft/Makefile
+++ b/examples/fft/Makefile
@@ -4,10 +4,18 @@ INPUT2 = sin_2067Hz_0.005_ampli_128samples.wav
 INPUT3 = sin_16536Hz_0.005_ampli_128samples.wav
 INPUT4 = sin_22000Hz_0.005_ampli_128samples.wav
 
-all: clean fft
+BASENAME = output
+FORMAT = csv
+CSVOUT = $(BASENAME)1.$(FORMAT)
+IMGOUT = $(SRC:.dsp=.png)
 
-fft: $(SRC) $(INPUT1) $(INPUT2) $(INPUT3) $(INPUT4)
-	faustine -d $(SRC) -i $(INPUT1) -i $(INPUT2) -i $(INPUT3) -i $(INPUT4)
+all: $(IMGOUT)
+
+$(IMGOUT): $(CSVOUT)
+	octave -qf img_write.m
+
+$(CSVOUT): $(SRC) $(INPUT1) $(INPUT2) $(INPUT3) $(INPUT4)
+	faustine -d $(SRC) -i $(INPUT1) -i $(INPUT2) -i $(INPUT3) -i $(INPUT4) --oformat $(FORMAT) --obasename $(BASENAME)
 
 clean::
 	rm -f gmon.out output*
diff --git a/examples/fft/fft.png b/examples/fft/fft.png
new file mode 100644
index 0000000..6e8739e
Binary files /dev/null and b/examples/fft/fft.png differ
diff --git a/examples/fft/img_write.m b/examples/fft/img_write.m
new file mode 100644
index 0000000..a359b40
--- /dev/null
+++ b/examples/fft/img_write.m
@@ -0,0 +1,4 @@
+a = csvread('output1.csv' );
+plot(a);
+print('fft.png');
+
diff --git a/examples/licenseplate/Makefile b/examples/licenceplate/Makefile
similarity index 100%
rename from examples/licenseplate/Makefile
rename to examples/licenceplate/Makefile
diff --git a/examples/licenseplate/img_read.m b/examples/licenceplate/img_read.m
similarity index 100%
rename from examples/licenseplate/img_read.m
rename to examples/licenceplate/img_read.m
diff --git a/examples/licenseplate/img_write.m b/examples/licenceplate/img_write.m
similarity index 100%
rename from examples/licenseplate/img_write.m
rename to examples/licenceplate/img_write.m
diff --git a/examples/licenseplate/licence.png b/examples/licenceplate/licence.png
similarity index 100%
rename from examples/licenseplate/licence.png
rename to examples/licenceplate/licence.png
diff --git a/examples/licenseplate/licence_small.png b/examples/licenceplate/licence_small.png
similarity index 100%
rename from examples/licenseplate/licence_small.png
rename to examples/licenceplate/licence_small.png
diff --git a/examples/licenseplate/licenceplate.dsp b/examples/licenceplate/licenceplate.dsp
similarity index 100%
rename from examples/licenseplate/licenceplate.dsp
rename to examples/licenceplate/licenceplate.dsp
diff --git a/examples/open/img_read.m b/examples/open/img_read.m
index 1f1beae..941dbfa 100644
--- a/examples/open/img_read.m
+++ b/examples/open/img_read.m
@@ -1,2 +1,2 @@
-a = imread('circbw.png' );
+a = imread('circbw.gif' );
 csvwrite('circbw.csv', a);
diff --git a/examples/primitives/Makefile b/examples/primitives/Makefile
index 80d4dbd..b392c2b 100644
--- a/examples/primitives/Makefile
+++ b/examples/primitives/Makefile
@@ -2,10 +2,14 @@ EXAMPLE = primitives
 SRC = $(EXAMPLE).dsp
 SAMPLES = 30
 
-all: clean $(EXAMPLE)
+BASENAME = output
+FORMAT = csv
+CSVOUT = $(BASENAME)1.$(FORMAT)
 
-$(EXAMPLE): $(SRC)
-	faustine -d $(SRC) -t $(SAMPLES) --oformat csv
+all: $(CSVOUT)
+
+$(CSVOUT): $(SRC)
+	faustine -d $(SRC) -t $(SAMPLES) --oformat $(FORMAT) --obasename $(BASENAME)
 
 clean::
 	rm -f gmon.out output*
diff --git a/examples/sinwave/Makefile b/examples/sinwave/Makefile
index 4a495a4..c6d2ec9 100644
--- a/examples/sinwave/Makefile
+++ b/examples/sinwave/Makefile
@@ -1,7 +1,13 @@
-all: clean sin
+SRC = sin.dsp
 
-sin: sin.dsp
-	faustine -d $<
+BASENAME = output
+FORMAT = wav
+WAVOUT = $(BASENAME)1.$(FORMAT)
+
+all: $(WAVOUT)
+
+$(WAVOUT): $(SRC)
+	faustine -d $< --obasename $(BASENAME) --oformat $(FORMAT)
 
 clean::
-	rm -f gmon.out output*
+	rm -f gmon.out $(BASENAME)*