Re: libobject and :tool gcc

Bram Moolenaar <[email protected]> Thu, 18 Dec 2003 11:50:07 +0100
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
Richard Boulton wrote:

> The following short A-A-P recipe file doesn't behave as I expect.
> 
> -----begin main.aap-----
> :usetool gcc
> foo.c:
>     :touch {force} foo.c
> :lib foo : foo.c
> -----end main.aap-----
> 
> I expected running aap in the same directory as this to build a static
> library (containing essentially nothing).
> 
> Instead, I get:
> 
> Aap: Creating directory "/data/home/richard/stuff/tmp/build-Linux2_4_20_k7"
> Aap:  cc       -MM foo.c > build-Linux2_4_20_k7/foo.c.aap
> Aap: Error in recipe "/data/home/richard/Working/aap/Exec/default.aap"
> line 640: Error executing commands for compile c: Error in recipe
> "/data/home/richard/Working/aap/Exec/default.aap" line 267: No commands
> defined for compile_gcc dllobject from c

Your conclusion is correct: The compile actions for dllobject and
libobject are not yet defined for the gcc tool.  Please try the patch
below that adds these actions.  It differs from your solution in that
the dllobject is created with an extra flag: -fPIC.  And there are no
changes to the build action, I don't see why these would be required.
Building is possible with a mix of filetypes anyway.

> The attached patch fixes this in what I hope is a reasonable way, and 
> includes a regression test for the problem.  I think there is still a 
> problem if libtool is used in conjunction with :usetool gcc, but thought 
> I should restrict the scope of my first attempt to patch aap.

Best is to find situations where something goes wrong.  It's a bit
difficult to guess when libtool interferes with selecting gcc.

> PS: I'm a software developer who's been looking for a decent build 
> system for several years, and aap looks extremely promising.  I spent a 
> fair while working on autotools a few years back, in particular fixing 
> the conditionals in automake so that they merely execute slowly rather 
> than exponentially slowly, so I have a good grasp of how that system 
> works.  I'm looking to use aap to build a project I'm working on which 
> requires cross compiling with mingw, so I'll be hoping to iron out any 
> bugs in that code too.  Hope my contributions will be useful - please 
> let me know how to make them more useful if I do anything wrong.

Your contributions are very much welcome.  I have tried to make a good
first version of Aap, but for a tool like this the experience of many
people is required to further improve it.



*** tools/gcc.py.orig	Mon Sep 15 12:53:16 2003
--- tools/gcc.py	Thu Dec 18 10:39:06 2003
***************
*** 44,59 ****
  
      rd = Global.globals
      rpstack = [ RecPos("compile_gcc action") ]
!     action_add(rpstack, rd, str2dictlist(rpstack, "compile_gcc object c"),
  	    ":buildcheck $OPTIMIZE $?DEBUG\n"
              ":sys $GCC $CPPFLAGS $?DEFINE $?INCLUDE `cflags_normal()` "
                  "$CFLAGS -o $target -c $source")
  
      rpstack = [ RecPos("compile_gxx action") ]
!     action_add(rpstack, rd, str2dictlist(rpstack, "compile_gxx object cpp"),
  	    ":buildcheck $OPTIMIZE $?DEBUG\n"
              ":sys $GXX $CPPFLAGS $?DEFINE $?INCLUDE `cflags_normal()` "
                  "$CXXFLAGS -o $target -c $source")
  
      rpstack = [ RecPos("build_gcc action") ]
      action_add(rpstack, rd, str2dictlist(rpstack, "build_gcc object"),
--- 44,71 ----
  
      rd = Global.globals
      rpstack = [ RecPos("compile_gcc action") ]
!     action_add(rpstack, rd, str2dictlist(rpstack, "compile_gcc object,libobject c"),
  	    ":buildcheck $OPTIMIZE $?DEBUG\n"
              ":sys $GCC $CPPFLAGS $?DEFINE $?INCLUDE `cflags_normal()` "
                  "$CFLAGS -o $target -c $source")
  
+     rpstack = [ RecPos("compile_gcc dllobject action") ]
+     action_add(rpstack, rd, str2dictlist(rpstack, "compile_gcc dllobject c"),
+ 	    ":buildcheck $OPTIMIZE $?DEBUG\n"
+             ":sys $GCC $CPPFLAGS $?DEFINE $?INCLUDE `cflags_normal()` "
+                 "$CFLAGS -fPIC -o $target -c $source")
+ 
      rpstack = [ RecPos("compile_gxx action") ]
!     action_add(rpstack, rd, str2dictlist(rpstack, "compile_gxx object,libobject cpp"),
  	    ":buildcheck $OPTIMIZE $?DEBUG\n"
              ":sys $GXX $CPPFLAGS $?DEFINE $?INCLUDE `cflags_normal()` "
                  "$CXXFLAGS -o $target -c $source")
+ 
+     rpstack = [ RecPos("compile_gxx dllobject action") ]
+     action_add(rpstack, rd, str2dictlist(rpstack, "compile_gcc dllobject cpp"),
+ 	    ":buildcheck $OPTIMIZE $?DEBUG\n"
+             ":sys $GXX $CPPFLAGS $?DEFINE $?INCLUDE `cflags_normal()` "
+                 "$CXXFLAGS -fPIC -o $target -c $source")
  
      rpstack = [ RecPos("build_gcc action") ]
      action_add(rpstack, rd, str2dictlist(rpstack, "build_gcc object"),

-- 
hundred-and-one symptoms of being an internet addict:
43. You tell the kids they can't use the computer because "Daddy's got work to
    do" and you don't even have a job.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///


-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click