Description: Adapt the example Makefiles to Debian
 This patch is Debian-specific as it adjusts the build infrastructure
 of the examples to the Debian paths and project files, which are much
 simpler to use than upstream's.
Author: Olivier Henley <olivier.henley@polymtl.ca>
Forwarded: not-needed
Reviewed-By: Ludovic Brenta <lbrenta@debian.org>
Last-Update: 2010-07-08


--- /dev/null
+++ b/examples/composite_widget/composite_widget.gpr
@@ -0,0 +1,4 @@
+with "gtkada";
+project CompositeWidget is
+	for Main use ("main.adb");
+end CompositeWidget;
--- a/examples/composite_widget/Makefile
+++ b/examples/composite_widget/Makefile
@@ -1,8 +1,9 @@
 all:
-	gnatmake -g -gnata -gnaty -gnatwu main `gtkada-config`
+	gnatmake -Pcomposite_widget
+
 run:
 	./main
 
 clean: 
-	${RM} main *.o *.ali
+	gnat clean -Pcomposite_widget
 
--- a/examples/display_switch/Makefile
+++ b/examples/display_switch/Makefile
@@ -1,2 +1,8 @@
 all:
 		gnatmake -Pdisplay_switch
+
+run:
+	./test_display_switch
+
+clean:
+	gnat clean -Pdisplay_switch
--- /dev/null
+++ b/examples/doublebuffer/anim2.gpr
@@ -0,0 +1,4 @@
+with "gtkada";
+project Anim2 is
+	for Main use ("anim2.adb");
+end Anim2;
--- /dev/null
+++ b/examples/doublebuffer/anim.gpr
@@ -0,0 +1,4 @@
+with "gtkada";
+project Anim is
+	for Main use ("anim.adb");
+end Anim;
--- /dev/null
+++ b/examples/doublebuffer/main_full_test.adb
@@ -0,0 +1,10 @@
+with Full_Test; use Full_Test;
+with Gtk.Main; use Gtk.Main;
+
+procedure Main_Full_Test is
+begin
+   Gtk.Main.Set_Locale;
+   Gtk.Main.Init;
+   Full_Test.Init;
+   Gtk.Main.Main;
+end Main_Full_Test;
--- /dev/null
+++ b/examples/doublebuffer/main_full_test.gpr
@@ -0,0 +1,4 @@
+with "gtkada";
+project Main_Full_Test is
+	for Main use ("main_full_test.adb");
+end Main_Full_Test;
--- a/examples/doublebuffer/Makefile
+++ b/examples/doublebuffer/Makefile
@@ -1,16 +1,13 @@
-all: parameters anim anim2
-
-GNAT_FLAGS = -g -gnata -gnatwu
-
-parameters::
-	gnatmake $(GNAT_FLAGS) parameters `gtkada-config`
-
-anim::
-	gnatmake $(GNAT_FLAGS) anim `gtkada-config`
-
-anim2::
-	gnatmake $(GNAT_FLAGS) anim2 `gtkada-config`
-
+all:
+	gnatmake -Panim
+	gnatmake -Panim2
+	gnatmake -Pmain_full_test
+
+run:
+	./anim
+	./anim2
+	./main_full_test
 clean:
-	${RM} *.o *.ali anim parameters anim2
-
+	gnat clean -Panim
+	gnat clean -Panim2
+	gnat clean -Pmain_full_test
--- /dev/null
+++ b/examples/dynamic_cast/dynamic_cast.gpr
@@ -0,0 +1,4 @@
+with "gtkada";
+project Dynamic_Cast is
+	for Main use ("dynamic.adb");
+end Dynamic_Cast;
--- a/examples/dynamic_cast/Makefile
+++ b/examples/dynamic_cast/Makefile
@@ -1,6 +1,9 @@
 all:
-	gnatmake -g -gnata -gnatwu dynamic `gtkada-config`
+	gnatmake -Pdynamic_cast
+
+run:
+	./dynamic
 
 clean:
-	${RM} *.o *.ali b~* dynamic
+	gnat clean -Pdynamic_cast
 
--- a/examples/gtk_examples/Makefile
+++ b/examples/gtk_examples/Makefile
@@ -1,9 +1,9 @@
-EXAMPLES=scribble
+all:
+	gnatmake -Pscribble
 
-all: ${EXAMPLES}
+run:
+	./scribble
 
-scribble::
-	gnatmake -g -gnata -gnatwu $@ `gtkada-config`
-clean::
-	${RM} *.o *.ali scribble b~*
+clean:
+	gnat clean -Pscribble
 
--- /dev/null
+++ b/examples/gtk_examples/scribble.gpr
@@ -0,0 +1,4 @@
+with "gtkada";
+project Scribble is
+	for Main use ("scribble.adb");
+end Scribble;
--- a/examples/images/README
+++ b/examples/images/README
@@ -2,6 +2,3 @@
 them on the screen. It also reacts to mouse events to provide an
 interactive selection rectangle.
 
-How to build the demos:
-  >  gnatmake -Prect
-
--- a/examples/images/rect.adb
+++ b/examples/images/rect.adb
@@ -281,7 +281,7 @@
    --  error code of course, and provide fallbacks.
    --  Note that at this point the image has not been drawn to the screen
 
-   Gdk_New_From_File (Pix, "../../testgtk/alps.png", Error);
+   Gdk_New_From_File (Pix, "Ada_Lovelace1.jpg", Error);
 
    --  Connect to the relevant signals
 
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -1,4 +1,4 @@
-include ../src/Makefile.common
+#include ../src/Makefile.common
 
 examples=$(prefix)/share/examples/gtkada/
 
@@ -15,7 +15,6 @@
 export PATH:=${bindir}:${PATH}
 
 DIRECTORIES=base_widget \
-  calendar_combo        \
   composite_widget      \
   display_switch        \
   doublebuffer          \
--- a/examples/powergnu/Makefile
+++ b/examples/powergnu/Makefile
@@ -1,13 +1,8 @@
-CFLAGS = -g -O2 -gnata
+all:
+	gnatmake -Pdefault.gpr
 
-EXEC = power
-
-all: $(EXEC)
-
-power: force
-	gnatmake -m -Pdefault.gpr
-
-force:
+run:
+	./power file.tst
 
 clean:
-	rm -f *.o *.ali *~ b~* $(EXEC)
+	gnat clean -Ppowergnu
--- /dev/null
+++ b/examples/tutorial/gtkdial/gtkdial.gpr
@@ -0,0 +1,7 @@
+--  The following with clause is the only thing necessary to compile and link
+--  a GtkAda application
+
+with "gtkada";
+project GtkDial is
+   for Main use ("dial_test.adb");
+end GtkDial;
--- a/examples/tutorial/gtkdial/Makefile
+++ b/examples/tutorial/gtkdial/Makefile
@@ -1,5 +1,7 @@
-all: force
-	gnatmake -g -gnata -gnaty -gnatwu dial_test `gtkada-config`
+all:
+	gnatmake -Pgtkdial
+run:
+	./dial_test
 clean: 
-	rm -f *.o *~ *.ali dial_test
-force:
+	gnat clean -Pgtkdial
+
--- /dev/null
+++ b/examples/tutorial/helloworld/helloworld.gpr
@@ -0,0 +1,4 @@
+with "gtkada";
+project HelloWorld is
+	for Main use ("hello.adb");
+end HelloWorld;
--- a/examples/tutorial/helloworld/Makefile
+++ b/examples/tutorial/helloworld/Makefile
@@ -1,5 +1,6 @@
-all: force
-	gnatmake -g -gnata -gnaty -gnatwu hello `gtkada-config`
+all:
+	gnatmake -Phelloworld
+run:
+	./hello
 clean: 
-	rm -f *.o *~ *.ali hello
-force:
+	gnat clean -Phelloworld
--- /dev/null
+++ b/examples/tutorial/helloworld2/helloworld2.gpr
@@ -0,0 +1,4 @@
+with "gtkada";
+project HelloWorld2 is
+	for Main use ("hello2.adb");
+end HelloWorld2;
--- a/examples/tutorial/helloworld2/Makefile
+++ b/examples/tutorial/helloworld2/Makefile
@@ -1,5 +1,8 @@
-all: force
-	gnatmake -g -gnata -gnaty -gnatwu hello2 `gtkada-config`
+all:
+	gnatmake -Phelloworld2
+
+run:
+	./hello2
+
 clean: 
-	rm -f *.o *~ *.ali hello2
-force:
+	gnat clean -Phelloworld2
--- a/examples/tutorial/Makefile
+++ b/examples/tutorial/Makefile
@@ -1,4 +1,4 @@
-all: force
+all:
 	make -C gtkdial all
 	make -C helloworld all
 	make -C helloworld2 all
@@ -14,4 +14,3 @@
 	make -C simple clean
 	make -C table clean
 	make -C tictactoe clean
-force:
--- a/examples/tutorial/packbox/Makefile
+++ b/examples/tutorial/packbox/Makefile
@@ -1,9 +1,10 @@
-all: force
-	gnatmake -g -gnata -gnatwu packbox_test `gtkada-config`
-run: all
-	./packbox_text 1
-	./packbox_text 2
-	./packbox_text 3
+all:
+	gnatmake -Ppackbox
+
+run:
+	./packbox_test 1
+	./packbox_test 2
+	./packbox_test 3
 clean: 
-	rm -f *.o *~ *.ali packbox_test
-force:
+	gnat clean -Ppackbox
+
--- /dev/null
+++ b/examples/tutorial/packbox/packbox.gpr
@@ -0,0 +1,4 @@
+with "gtkada";
+project PackBox is
+	for Main use ("packbox_test.adb");
+end PackBox;
--- a/examples/tutorial/simple/Makefile
+++ b/examples/tutorial/simple/Makefile
@@ -1,5 +1,8 @@
-all: force
-	gnatmake -g -gnata -gnaty -gnatwu simple `gtkada-config`
-clean: 
-	rm -f *.o *~ *.ali simple
-force:
+all:
+	gnatmake -Psimple
+
+run:
+	./simple
+
+clean:
+	gnat clean -Psimple
--- /dev/null
+++ b/examples/tutorial/simple/simple.gpr
@@ -0,0 +1,4 @@
+with "gtkada";
+project Simple is
+	for Main use ("simple.adb");
+end Simple;
--- a/examples/tutorial/table/Makefile
+++ b/examples/tutorial/table/Makefile
@@ -1,5 +1,8 @@
-all: force
-	gnatmake -g -gnata -gnaty -gnatwu table_test `gtkada-config`
+all:
+	gnatmake -Ptable
+
+run:
+	./table_test
+
 clean: 
-	rm -f *.o *~ *.ali table_test
-force:
+	gnat clean -Ptable
--- /dev/null
+++ b/examples/tutorial/table/table.gpr
@@ -0,0 +1,4 @@
+with "gtkada";
+project Table is
+	for Main use ("table_test.adb");
+end Table;
--- a/examples/tutorial/tictactoe/Makefile
+++ b/examples/tutorial/tictactoe/Makefile
@@ -1,5 +1,8 @@
-all: force
-	gnatmake -g -gnata -gnaty -gnatwu ttt_test `gtkada-config`
+all:
+	gnatmake -Ptictactoe
+
+run:
+	./ttt_test
+
 clean: 
-	rm -f *.o *~ *.ali ttt_test
-force:
+	gnat clean -Ptictactoe
--- /dev/null
+++ b/examples/tutorial/tictactoe/tictactoe.gpr
@@ -0,0 +1,5 @@
+with "gtkada";
+project TicTacToe is
+	for Main use ("ttt_test.adb");
+end TicTacToe;
+
--- a/examples/user_data/Makefile
+++ b/examples/user_data/Makefile
@@ -1,5 +1,9 @@
 all:
 	gnatmake -Pdefault
+
+run:
+	./test_handlers
+
 clean:
-	${RM} *.o *.ali b~* test_handlers
+	gnat clean -Puser_data
 
