1--  This is a GNAT, GCC or GNAT Programming Studio (GPS) project file
2--  for the Zip-Ada project:
3--
4--      home page:     http://unzip-ada.sf.net/
5--      project page:  http://sf.net/projects/unzip-ada/
6--      mirror:        https://github.com/svn2github/unzip-ada
7--
8--  Build me with "gprbuild -p -P zipada", or "gnatmake -p -P zipada",
9--  or open me with GPS.
10--
11--  Important: for building tests, see the zipada_test.gpr project file.
12--
13project ZipAda is
14
15   type Build_Mode_Type is
16      ("Debug",
17       "Fast",
18       "Small",
19       "Profiling",
20       --  Check_95 mode is for checking that the *library* is strictly
21       --  Ada-95-compliant for being compiled by the broadest set of compilers.
22       --  The demos, tools and tests are using some Ada 2005 & 2012 features.
23       "Check_95"
24      );
25   Build_Mode : Build_Mode_Type := external ("Build_Mode", "Fast");
26   for Exec_Dir use ".";
27
28   case Build_Mode is
29      when "Check_95" =>
30         for Source_Dirs use ("zip_lib");
31         for Main use ();
32      when others =>
33         for Source_Dirs use ("zip_lib", "extras", "tools", "demo");
34         for Main use (
35           "zipada.adb",
36           "unzipada.adb",
37           "comp_zip.adb",
38           "find_zip.adb",
39           "rezip.adb",
40           "demo_csv_into_zip.adb",
41           "demo_zip.adb",
42           "demo_unzip.adb",
43           --  Miscellaneous, non-Zip or experimental stuff
44           "bunzip",   --  Standalone BZip2 decoder (for .bz2 files)
45           "lzhuf",    --  A simple LZ-Huffman coder/decoder
46           "lzma_dec", --  LZMA decoder
47           "lzma_enc", --  LZMA encoder
48           "bwt_demo", --  Burrows-Wheeler precompression demo
49           "bwt_enc",  --  Burrows-Wheeler file encoder
50           "bwt_dec"   --  Burrows-Wheeler file decoder
51         );
52   end case;
53
54   case Build_Mode is
55      when "Debug" | "Check_95" =>  for Object_Dir use "obj_dbg";
56      when "Fast" =>                for Object_Dir use "obj_opt";
57      when "Small" =>               for Object_Dir use "obj_small";
58      when "Profiling" =>           for Object_Dir use "obj_pro";
59   end case;
60
61   package Binder is
62      --  -Es: Store tracebacks in exception occurrences, and enable symbolic tracebacks
63      for Default_Switches ("ada") use ("-Es");
64   end Binder;
65
66   package Linker is
67
68      case Build_Mode is
69
70         when "Debug" | "Check_95" =>
71            for Default_Switches ("ada") use ("-g");
72
73         when "Fast" | "Small" =>
74            for Default_Switches ("ada") use ("-s", "-Wl,--gc-sections");
75
76         when "Profiling" =>
77            for Default_Switches ("ada") use ("-pg");
78      end case;
79   end Linker;
80
81   package Compiler is
82
83      case Build_Mode is
84
85         when "Check_95" => for Default_Switches ("ada") use (
86              "-gnat95", "-gnatwa",
87              "-gnatec=" & project'Project_Dir & "restrictions.pra"
88              );
89
90         when "Debug" =>
91            for Default_Switches ("ada") use (
92              "-gnatyaknpr",  --  Style: check all casings: a:attribute, k:keywords, n:package Standard identifiers, p:pragma, r:identifier references
93              "-gnatybfhiu",  --  Style: check b:no blanks at end of lines, f:no ff/vtabs, h: no htabs, i:if-then layout, u:no unnecessary blank lines
94              "-gnatyx",      --  Style: check x:no extra parens
95              "-gnatye",      --  Style: check e:end/exit labels present
96              "-gnat12",
97              "-gnatf",
98              "-gnato",
99              "-fstack-check", "-g",
100              "-gnatVa",                        --  Validity checks switches
101              "-gnatwa",                        --  Warnings switches
102              "-gnatwcijkmopruvz.c.n.p.t.w.x",  --  Warnings switches
103              "-gnatec=" & project'Project_Dir & "debug.pra"
104              );
105
106         when "Fast" =>
107            for Default_Switches ("ada") use (
108              "-gnat12", "-O2", "-gnatp", "-gnatn",
109              "-funroll-loops", "-fpeel-loops", "-funswitch-loops", "-ftracer", "-fweb", "-frename-registers",
110              "-fpredictive-commoning", "-fgcse-after-reload", "-ftree-vectorize", "-fipa-cp-clone",
111              "-ffunction-sections",
112              "-gnatec=" & project'Project_Dir & "za_elim.pra"
113              );
114
115         when "Small" =>
116            for Default_Switches ("ada") use (
117              "-gnat12", "-Os", "-gnatp",
118              "-ffunction-sections",
119              "-gnatec=" & project'Project_Dir & "za_elim.pra"
120              );
121
122         when "Profiling" =>
123            for Default_Switches ("ada") use (
124              "-gnat12", "-O2", "-gnatp",
125              "-fno-inline",
126              "-funroll-loops", "-fpeel-loops", "-funswitch-loops", "-ftracer", "-fweb", "-frename-registers",
127              "-fpredictive-commoning", "-fgcse-after-reload", "-ftree-vectorize", "-fipa-cp-clone",
128              "-g", "-pg"
129              );
130      end case;
131   end Compiler;
132
133   package Builder is
134      --   "If -j0 is used, then the maximum number of simultaneous compilation
135      --    jobs is the number of core processors on the platform."
136      for Default_Switches ("ada") use ("-j0");
137   end Builder;
138
139   package Ide is
140      for Default_Switches ("adacontrol") use ("-f", "verif.aru");
141      for Vcs_Kind use "Subversion";
142   end Ide;
143
144end ZipAda;
145