From: Maxime van Noppen <yabo(a)lrde.epita.fr>
To: olena-patches(a)lrde.epita.fr
Subject: r2674: Enhance the build-system
URL:
https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena/sandbox
ChangeLog:
2008-10-24 Maxime van Noppen <yabo(a)lrde.epita.fr>
Enhance the build-system.
* Makefile: Make a nice and usefull Makefile.
---
Makefile | 48 +++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 43 insertions(+), 5 deletions(-)
Index: branches/cleanup-2008/milena/sandbox/classif/Makefile
===================================================================
--- branches/cleanup-2008/milena/sandbox/classif/Makefile (revision 2673)
+++ branches/cleanup-2008/milena/sandbox/classif/Makefile (revision 2674)
@@ -1,7 +1,45 @@
-CCFLAGS=-I../.. -O1 -DNDEBUG
+INCLUDES=-I../..
-all:
- g++ iccvg04.cc $(CCFLAGS)
+SRC=iccvg04.cc
+TARGET=iccvg
-debug:
- g++ iccvg04.cc -I../../ -O0 -g3 -ggdb3
+TARGET_DBG=iccvg_dbg
+
+IMG?=../../img/lena.ppm
+DIV?=8
+LAMBDA?=10
+
+LOG=> stdout.log 2> stderr.log
+
+all: $(TARGET)
+
+$(TARGET): $(SRC)
+ g++ $(INCLUDES) -O1 -DNDEBUG $(SRC) -o $(TARGET)
+
+debug: $(TARGET_DBG)
+
+iccvg_dbg: $(SRC)
+ g++ $(INCLUDES) -O0 -g3 -ggdb3 $(SRC) -o $(TARGET_DBG)
+
+.PHONY:clean check check-debug valgrind
+
+clean:
+ rm -f $(TARGET)
+ rm -f $(TARGET_DBG)
+
+check-debug: $(TARGET_DBG)
+ ./iccvg_dbg $(IMG) $(DIV) $(LAMBDA) $(LOG)
+ cat stdout.log
+ display out.ppm &
+
+check: $(TARGET)
+ ./iccvg $(IMG) $(DIV) $(LAMBDA) $(LOG)
+ cat stdout.log
+ display out.ppm &
+
+valgrind:
+ valgrind --log-file=valgrind.log ./iccvg_dbg ../../img/lena.ppm $(DIV) $(LAMBDA) $(LOG)
+
+gdb: $(TARGET_DBG)
+ echo "run ../../img/lena.ppm $(DIV) $(LAMBDA)" > gdb.cmd
+ gdb $(TARGET_DBG) -x gdb.cmd