From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,27b8da03f2246757 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder.news-service.com!cyclone03.ams2.highwinds-media.com!news.highwinds-media.com!npeersf01.ams.highwinds-media.com!newsfe29.ams2.POSTED!40385e62!not-for-mail From: Per Sandberg User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: conditionnal compilation References: <4259b442-6772-4527-989a-b20e1641b8d0@g20g2000vba.googlegroups.com> In-Reply-To: <4259b442-6772-4527-989a-b20e1641b8d0@g20g2000vba.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: X-Complaints-To: abuse@WWWSpace.NET NNTP-Posting-Date: Thu, 14 May 2009 05:14:16 UTC Date: Thu, 14 May 2009 06:20:13 +0200 Xref: g2news2.google.com comp.lang.ada:5834 Date: 2009-05-14T06:20:13+02:00 List-Id: More on the above them when using GNAT project files: When the number of target specific files is moderate: -------------------------------------------------------------------- project my is -- Both the spec and body of My_Unit is target specific -- But i would recommend to keep the target specific parts -- as isolated as possible. type OS_Type is ("Windows_NT","Linux"); OS : OS_Type := external("OS","Linux"); package Naming is case OS is when "Linux" => for Implementation("My.Unit") use "my-unit__Linux.adb"; for Specification ("My.Unit") use "my-unit__Linux.ads"; when "Windows_NT" => for Implementation("My.Unit") use "my-unit__Win32.adb"; for Specification ("My.Unit") use "my-unit__Win32.ads"; end case; end Naming; end my; --------------------------------------------------------------------- When the number of target specific files is a bit larger: -------------------------------------------------------------------- project my is -- The target specific files are kept in separate directories. type OS_Type is ("Windows_NT","Linux"); OS : OS_Type := external("OS","Linux"); for Source_Dirs use ("src"); case OS is when "Linux" => For Source_Dirs use project'Source_Dirs & ("src/Linux"); when "Windows_NT" => For Source_Dirs use project'Source_Dirs & ("src/Win32"); end case; end my; -------------------------------------------------------------------- I would advice to one of the above schema's since they keep things understandable and try to stay with the first since Ada is usually is very portable. But if conditional compilation is a requirement (in my opinion a very stupid one and this one is very compiler specific) you could read about it in: The GNAT users guide chapters: 16. Preprocessing Using gnatprep 3.2.17 Integrated Preprocessing The chapter references may not be 100% correct but anyway. /Project files are an engineers best friend. /Per guerrier.cachalot@gmail.com wrote: > Hi my friends > Now that I know Ada has not built'in support for conditional > compilation such a full-featured preprocessor, I would like know what > should I use instead ? > I precise I'm just a little beginner who doesn't want to compile > anything . > What really happend when I specify "--no-ssl" at some Ada-written > program compilation ?