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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,80a657b612f5bad1,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.germany.com!news.motzarella.org!motzarella.org!not-for-mail From: Ivan Levashew Newsgroups: comp.lang.ada Subject: Creating and using Ada packages: need refinement Date: Sat, 15 Mar 2008 01:09:04 +0600 Organization: A noiseless patient Spider Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: feeder.motzarella.org U2FsdGVkX1+PrJS0OEr/msWSqxD98ikWf91cwP9O3t5uXKwjI01DJZ1O7Jiv9Qt4sgtt5/pLnRdVko1C9RLxQtBl70Kv5k2frokToNk/lsK1JrPKUYfTIbAwReJVuX4VpPX7iPlsp7+/rDR3rrSCkg== X-Complaints-To: Please send complaints to abuse@motzarella.org with full headers NNTP-Posting-Date: Fri, 14 Mar 2008 19:03:24 +0000 (UTC) X-Auth-Sender: U2FsdGVkX1/0L6pSZbkh2bKY1qACZCOlD9wt8n0028JK8Xq7DPEGdQ== X-Image-URL: http://img220.echo.cx/img220/9664/111408397042725603791c71pb.gif Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEUAAAOZlpMaJz3/9fYs //8FP1E2M3Qbef+MAAACEklEQVQ4jZ2TTW7bMBCFJwO465B2uqZfS+4NnyBA7LXMerSPEPL+R+gb KqmTIAWKDiCCmo9v/kSJqGaVJCp/TLk3kbypSPmdX2QD2YikTUrAe6CqiWuCL/LR3Cfu/AJgbP4K Phtjfz77vwAfOv4XkNPXVSkqwZvmfTZMAriHMOGG1EOt7xw1Rli8hTIkV4DDTIFn6qqYZJ5JFLhT yIVnHAoIrlYTNGKf7yVMUS4yvYITdC8EMaZwHyX4t4ERnCv2uN+HGMFH4x2bHuDEahD1IUR18LAn mC3Jjork3Wny28Gp+h1pMhR08VV9s55hc/J08qrg90RHP15uXag4c1pYMFvVbHmBB3bFtVGBpVwe z+Hno7UyABU8yYEt1l5q+P54Mj8sM5dsVdRqu4RDCLvWGn2lj8pMJdC2BMdtCFG0L8rptiz6Y3s8 Hh1wjehXby133vRneo5hBSgvu+rfozdodnDYui6g7645m1jpVXELFUtnz6yo9MUKfo1YhzXF6WSc bu09Ax7rcGSsgNKezKggaDNGLH8icz80EsmlcwxOPMcBBJZd0VnWzOnSGbYUMEXNnqO00gvB4p1T gG7TUMydxjljz9xxAAyFzUvpfiEZLHD91iwNhVmvfXybYaksDioVlDh4JdqbwVYFyQ2Unq8EeQDr GDfcrS/ZUF8VJAtWUW8pPyFXr8oDMun4r0pHgiVMafoNgUqRDtakwdAAAAAASUVORK5CYII= X-Face: *tpB#/X3&Zh\?<4l;hAgY:m6lt6L]v#Udy\Xwy{@<'qP=9clA}kEbbSV1]B0a^O{|ibsNV~|zu.Da}V4*se@ns!8*Bt$9l-]nbD}o*7ml9J2)u:"!6P%_-`y9,'.L.Psp),njUf!=F5;kx%~\,'D$%{" Cancel-Lock: sha1:78rB/rQOprtngyietMqn68MzTAE= User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; ru; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 ThunderBrowse/3.2.1 Mnenhy/0.7.5.666 Xref: g2news1.google.com comp.lang.ada:20391 Date: 2008-03-15T01:09:04+06:00 List-Id: Hello! My question is: how to create flexible Ada packages and what should they look like? Enlist the make variables, for example. I'm not happy with what I currently see. Ada packages are not easy to finetune. Let's suppose that our project is rather complex. It contains both Ada and C code and may be C++. Let's start with the following list: ADA= gnatgcc, gcc Name of the compiler used to compile Ada. Different compilers can be used to compile Ada, C and C++. In particular, different instances of GCC. On the most OSes it's $(which gcc), but on FreeBSD and Mac OS X it's better to use another compiler for C and C++. On FreeBSD Ada compiler is based on GCC 3.x, and on Mac OS X Apple GCC is supposed to be used instead of FSF one. So the ./configure script should first look for gnatgcc. ADAFLAGS= -I. -O2 Flags used when invoking $(ADA) CC= gcc C compiler invokation command CXX= g++ C++ compiler invokation command CFLAGS= -g -O2 C-specific flags (not applicable to C++) CXXFLAGS= -g -O2 C++-specific flags CPP= gcc -E C preprocessor invokation command CXXCPP= g++ -E INCLUDES, DEFS, LIBS Additional flags. The rightest way to call C compiler so far: $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) I also saw: $(AM_CPPFLAGS) $(AM_CFLAGS) $(DEFAULT_INCLUDES) The rightest way to invoke Ada compiler (?? not sure) $(ADA) $(ADAFLAGS) -c Adaproject-created project's Makefile contained ${ADA} ${ADAFLAGS}. ${} instead of $(). Does it make any sense? Next. GNATBIND, GNATLINK, GNATMAKE usually correspond to gnatbind, gnatlink and gnatmake GNATMAKEBINDFLAGS, GNATMAKELDFLAGS -- I saw them in GtkAda. I think it's a bad idea. For example, GNATMAKELDFLAGS = -largs -L. -lgtkada $(GTK_LIBS) in the GtkAda's Makefile. I don't like it because it is supposed to be used with $(GNATMAKE). And what if one morning one would like to call $(GNATLINK) explicitly? So I suppose it would be better to define GNATBINDFLAGS, GNATLDFLAGS (or better name it GNATLINKFLAGS?) and GNATMAKEFLAGS. So far, gnatmake invokation is: $(GNATMAKE) -cargs $(ADAFLAGS) -bargs $(GNATBINDFLAGS) \ -largs $(GNATLDFLAGS) -margs $(GNATMAKEFLAGS) I also saw $(GNATFLAGS). Is it supposed to be passed to every gnat* command? Or does it serve the same purpose as ADAFLAGS, just another name? It looks like there was no strict convention in Ada packages. No any single de facto standard. Developers on OSes where compilation is easy didn't care much about flexibility of their packages. And I'm now gathering obstacle by obstacle because of this inflexibility. Consider this example: GtkAda-2.8.1/testgtk/Makefile: GNATFLAGS = @CFLAGS@ -gnata -gnatws Pass CFLAGS to gnat! Awful! Yeah, right, gnat knows that -arch ppc is a single argument, that ppc is not a project name or so. I am to create crapload of shell scripts to make illusion that everything is OK. Illusion that GCC is the same for both Ada and C. Instead of passing CFLAGS, etc. to ./configure I'd like to circumvent ./configure-make mechanisms. CFLAGS and Co. are to be written to KRUNCH_* environment variables, and "gcc", "gnatmake" shell scripts are to pass all these flags to the actual compiler. It is temporary solution, we can't accumulate krunches. So far, I'd like to see a guidelines in the "Ada programming" wikibook. Another point: I'd like to use Apple GCC as linker. Should I alter GNATMAKELDFLAGS with --LINK="" or ideal Ada packages must care about using the right compiler by itself? When gcc or g++ is used to link, they are referenced by $(CCLD) or $(CXXLD) respectivelly. My point of view expresses my own only problems. I'd like my Ada packages to be convenient for use by everybody, so I encourage you to participate in creating a single de facto standard.