mmanders    02/04/11 14:46:58

  Modified:    jk/jkant/java/org/apache/jk/ant/compilers MwldLinker.java
                        MwccCompiler.java
  Log:
  More updates to allow building against Clib or LibC within the same project.
  
  Revision  Changes    Path
  1.8       +15 -5     
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MwldLinker.java
  
  Index: MwldLinker.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MwldLinker.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MwldLinker.java   8 Mar 2002 16:13:26 -0000       1.7
  +++ MwldLinker.java   11 Apr 2002 21:46:57 -0000      1.8
  @@ -111,6 +111,7 @@
           Commandline cmd = new Commandline();
           File linkOpt = new File(buildDir, "link.opt");
           File linkDef = new File(buildDir, "link.def");
  +        boolean useLibC = false;
   
           String libtool=project.getProperty("build.compiler.ld");
           if(libtool==null) libtool="mwldnlm";
  @@ -152,14 +153,20 @@
                   JkData opt = (JkData) opts.nextElement();
                   String option = opt.getValue();
                   if( option == null ) continue;
  +
                   linkOptPw.println( option );
  +                option = option.toLowerCase();
  +
  +                // check to see if we are building using LibC
  +                if (option.indexOf("libc") > 0)
  +                    useLibC = true;
               }
   
               // add the default startup code to the list of objects
  -            if (null == project.getProperty("use.novelllibc"))
  -                linkOptPw.println(libBase + "\\lib\\nwpre.obj");
  -            else
  +            if (useLibC)
                   linkOptPw.println("-llibcpre.o");
  +            else
  +                linkOptPw.println(libBase + "\\lib\\nwpre.obj");
   
               // write the objects to link with to the .opt file
               for( int i=0; i<srcList.size(); i++ ) {
  @@ -237,8 +244,11 @@
               
               throw new BuildException("Link failed " + soFile);
           }
  -        linkOpt.delete();
  -        linkDef.delete();
  +        if (null == project.getProperty("save.optionFiles"))
  +        {
  +            linkOpt.delete();
  +            linkDef.delete();
  +        }
           closeStreamHandler();
           return true;
       }
  
  
  
  1.8       +30 -17    
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MwccCompiler.java
  
  Index: MwccCompiler.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/compilers/MwccCompiler.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- MwccCompiler.java 8 Mar 2002 16:13:26 -0000       1.7
  +++ MwccCompiler.java 11 Apr 2002 21:46:57 -0000      1.8
  @@ -114,8 +114,11 @@
               
               throw new BuildException("Compile failed " + source);
           }
  -        File ccOpt = new File(buildDir, "cc.opt");
  -        ccOpt.delete();
  +        if (null == project.getProperty("save.optionFiles"))
  +        {
  +            File ccOpt = new File(buildDir, "cc.opt");
  +            ccOpt.delete();
  +        }
           closeStreamHandler();
   
       }
  @@ -126,27 +129,14 @@
           String extra_cflags=project.getProperty("build.native.extra_cflags");
           String localCflags=cflags;
           File ccOpt = new File(buildDir, "cc.opt");
  -        if( localCflags==null ) {
  -            localCflags=new String("-nosyspath -c -w nocmdline -bool on");
  -            if (null == project.getProperty("use.novelllibc"))
  -                localCflags += " -align 1";
  -            else
  -                localCflags += " -align 4";
  -
  -            if( extra_cflags!=null )
  -                localCflags+=" " + extra_cflags;
  -        }
  -
  -        if (optG)
  -            localCflags += " -g";
  +        boolean useLibC = false;
   
           // create a cc.opt file 
           PrintWriter ccpw = null;
           try
           {
               ccpw = new PrintWriter(new FileWriter(ccOpt));
  -            // write the compilation flags out
  -            ccpw.println(localCflags);
  +
               for( int i=0; i<includeList.length; i++ ) {
                   ccpw.print("-I");
                   ccpw.println(includeList[i] );
  @@ -159,12 +149,35 @@
                       String name=d.getName();
                       String val=d.getValue();
                       if( name==null ) continue;
  +                    
                       String arg="-D" + name;
                       if( val!=null )
                           arg+= "=" + val;
                       ccpw.println(arg);
  +
  +                    // check to see if we are building using LibC
  +                    if (name.equals("__NOVELL_LIBC__"))
  +                        useLibC = true;
                   }
               }
  +
  +            // finalize the cflags
  +            if( localCflags==null ) {
  +                localCflags=new String("-nosyspath -c -w nocmdline -bool on");
  +                if (useLibC)
  +                    localCflags += " -align 4";
  +                else
  +                    localCflags += " -align 1";
  +
  +                if( extra_cflags!=null )
  +                    localCflags+=" " + extra_cflags;
  +            }
  +
  +            if (optG)
  +                localCflags += " -g";
  +
  +            // write the compilation flags out
  +            ccpw.println(localCflags);
           }
           catch (IOException ioe)
           {
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to