1---- author Daniel Norte de Moraes <danielcheagle@gmail.com>
2---- tested in Debian Sid, Gcc 4.6 , gnat 4.6 , gprbuild 2011-1 :-)
3----
4---- this project file permit "simultaneously" :
5---- choose compile with (static or shared) and ( normal or debug) and (system operations)  libs.
6--
7-- this permit cross-compiling too :-)
8----
9
10----    IMPORTANT!!!  You Can hit and compile you program just passing for your
11--			program project file these three(3) environment variables:
12--			 "Static_Or_Dynamic" , "Os" and "Debug_information". this is made
13--			 by the "-Xvariable=value" (without double quotes)
14--			eg: if your program import apq.gpr in your my_program.gpr made
15--
16--			gnatmake -Pmy_program.gpr -Xstatic_or_dynamic=dynamic -XOs=mswindows -Xdebug_information=yes
17--
18--			to compile your program with lib shared+debug+mswindows. if the combination
19--			don't exist, usually the compiler/linker will hit
20--			a error message. these combination was determined by the time the libs was compiled and installed.
21--			of course you can use "gprbuild" instead of gnatmake :-)
22--		    the gpr file will take  care for you where are the libs.
23----                   You will need however, in system specific manner,  a way for
24----                    your program using the libs "as being run/executing" locate the libs for him :-)
25----                   We just (just? ;-) take care of _compilation_ :-)
26----       p.s.: You can use gnat-gps. gnat-gps will permit you choose in a Gui , the enviroment variables on-the-fly :-) and if you already have a cross-compiling enviroment, this permit cross-compiling,too. :-)
27----  Enjoy!!! :-)
28
29-- You can need set ADA_PROJECT_PATH
30
31project Apq is
32   -----------------------
33   -- type declarations --
34   -----------------------
35	prefix := $prefix ;
36
37   type Static_Or_Dynamic_Type is ("dynamic", "static", "relocatable" );
38   type Debug_information_Type is ("yes", "no");
39   type Os_Type is ("other", "mswindows", "linux" , "darwin" , "bsd" );
40   --
41   Static_Or_Dynamic : Static_Or_Dynamic_Type := external ("static_or_dynamic", "static");
42   Os : Os_Type := external ("os", "linux");
43   Debug_information : Debug_information_Type := external ("debug_information", "no");
44   --
45   Debug  := "";
46   Debug_option_list_builder := ();  -- null string_list
47   Debug_option_list_compiler := (); -- null string_list
48
49   case debug_information is
50      when "yes" =>
51         Debug := Debug & "debug";
52         case os is
53            when "other" => -- :0}
54               Debug_option_list_builder := Debug_option_list_builder & ( "-g" );
55               Debug_option_list_compiler := Debug_option_list_compiler & ("-fstack-check", "-gnata" , "-gnato" , "-gnatE" ); -- fixme , if necessary :-)
56
57            when "mswindows" =>
58               Debug_option_list_builder := Debug_option_list_builder & ( "-g" );
59               Debug_option_list_compiler := Debug_option_list_compiler & ("-fstack-check", "-gnata" , "-gnato" , "-gnatE" ); -- fixme , if necessary :-)
60
61            when "linux" =>
62               Debug_option_list_builder := Debug_option_list_builder & ( "-g" );
63               Debug_option_list_compiler := Debug_option_list_compiler & ("-fstack-check", "-gnata" , "-gnato" , "-gnatE" ); -- fixme , if necessary :-)
64
65            when "darwin" =>
66               Debug_option_list_builder := Debug_option_list_builder & ( "-g" );
67               Debug_option_list_compiler := Debug_option_list_compiler & ("-fstack-check", "-gnata" , "-gnato" , "-gnatE" ); -- fixme , if necessary :-)
68
69            when "bsd" =>
70               Debug_option_list_builder := Debug_option_list_builder & ( "-g" );
71               Debug_option_list_compiler := Debug_option_list_compiler & ("-fstack-check", "-gnata" , "-gnato" , "-gnatE" ); -- fixme , if necessary :-)
72
73            when others => ---- :0]
74               Debug_option_list_builder := Debug_option_list_builder & ( "-g" );
75               Debug_option_list_compiler := Debug_option_list_compiler & ("-fstack-check", "-gnata" , "-gnato" , "-gnatE" ); -- fixme , if necessary :-)
76
77         end case;  -- end yes/os
78      when "no" =>
79         Debug := Debug & "";
80         case os is
81            when "other" => -- :0}
82               Debug_option_list_builder := Debug_option_list_builder & (  );
83               Debug_option_list_compiler := Debug_option_list_compiler & (  ); -- fixme , if necessary :-) --> insert some thing making sense in string_list form -> ()
84
85            when "mswindows" =>
86               Debug_option_list_builder := Debug_option_list_builder & (  );
87               Debug_option_list_compiler := Debug_option_list_compiler & (  ); -- fixme , if necessary :-) --> insert some thing making sense in string_list form -> ()
88
89            when "linux" =>
90               Debug_option_list_builder := Debug_option_list_builder & (  );
91               Debug_option_list_compiler := Debug_option_list_compiler & (  ); -- fixme , if necessary :-) --> insert some thing making sense in string_list form -> ()
92
93            when "darwin" =>
94               Debug_option_list_builder := Debug_option_list_builder & (  );
95               Debug_option_list_compiler := Debug_option_list_compiler & ( ); -- fixme , if necessary :-) --> insert some thing making sense in string_list form -> ()
96
97            when "bsd" =>
98               Debug_option_list_builder := Debug_option_list_builder & ( );
99               Debug_option_list_compiler := Debug_option_list_compiler & ( ); -- fixme , if necessary :-) --> insert some thing making sense in string_list form -> ()
100
101            when others => -- :0]
102               Debug_option_list_builder := Debug_option_list_builder & (   );
103               Debug_option_list_compiler := Debug_option_list_compiler & (   ); -- fixme , if necessary :-) --> insert some thing making sense in string_list form -> ()
104
105         end case; -- end no/os
106      when others =>
107		  null;
108   end case; -- end Debug_information
109
110   for Languages use ("Ada");
111   for Source_Dirs use () & ( prefix & "/include/apq" ) ;
112   for Library_Name use "apq" ;
113   case debug_information is
114	   when "yes" =>
115		   case static_or_dynamic is
116				when "dynamic" | "relocatable" =>
117					for Library_Dir use "" & prefix & "/lib/apq/" & Os & "/shared/debug/"  ;
118					for Library_ALI_Dir use  "" & prefix & "/lib/apq/" & Os & "/shared/debug/ali/" ;
119				when "static" =>
120					for Library_Dir use "" & prefix & "/lib/apq/" & Os & "/static/debug/"  ;
121					for Library_ALI_Dir use  "" & prefix & "/lib/apq/" & Os & "/static/debug/ali/" ;
122		   end case;
123	   when "no"  =>
124		   case static_or_dynamic is
125				when "dynamic" | "relocatable" =>
126					for Library_Dir use "" & prefix & "/lib/apq/" & Os & "/shared/"  ;
127					for Library_ALI_Dir use  "" & prefix & "/lib/apq/" & Os & "/shared/ali/" ;
128				when "static" =>
129					for Library_Dir use "" & prefix & "/lib/apq/" & Os & "/static/"  ;
130					for Library_ALI_Dir use  "" & prefix & "/lib/apq/" & Os & "/static/ali/" ;
131		   end case;
132   end case;
133
134   for Library_Kind use Static_Or_Dynamic;
135   for Externally_Built use "true";
136
137   package Compiler is
138      for Default_Switches ("ada") use ("-O2", "-gnat05", "-gnatn" , "-fPIC"  ) & Debug_option_list_compiler ;
139   end Compiler;
140
141   package Builder  is
142      for Default_Switches ("ada") use ("-O2", "-gnat05", "-gnatn" , "-fPIC") & Debug_option_list_builder ;
143   end Builder;
144
145end Apq;
146
147