costin 01/10/26 15:53:56
Modified: jk/jkant/java/org/apache/jk/ant SoTask.java
jk/native build.xml
Log:
Dependecy checking works, all files compile ( both 1.3 and 2.0 - this is the first
improvement over configure, no need to run twice ).
Still need to link, and with some help from Windows and Netware experts to add
the required code to build ( I assume libtool is not so easily available there ).
Revision Changes Path
1.4 +40 -3
jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java
Index: SoTask.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/jkant/java/org/apache/jk/ant/SoTask.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SoTask.java 2001/10/26 22:28:27 1.3
+++ SoTask.java 2001/10/26 22:53:56 1.4
@@ -193,6 +193,8 @@
if (src == null)
throw new BuildException("No source files");
+ if (buildDir == null) buildDir = project.getBaseDir();
+
DirectoryScanner ds=src.getDirectoryScanner( project );
String [] list = ds.getIncludedFiles();
if (list.length == 0)
@@ -208,8 +210,8 @@
}
// Check the dependency
-
- compileList.addElement( srcFile );
+ if( needCompile( srcFile, buildDir ) )
+ compileList.addElement( srcFile );
}
String [] includeList = ( includes==null ) ?
@@ -226,6 +228,42 @@
}
+ protected static GlobPatternMapper co_mapper=new GlobPatternMapper();
+ static {
+ co_mapper.setFrom("*.c");
+ co_mapper.setTo("*.o");
+ }
+
+ /** Verify if a .c file needs compilation.
+ * As with javac, we assume a fixed build structure, where all .o
+ * files are in a separate directory from the sources ( no mess ).
+ *
+ * XXX Hack makedepend somehow into this.
+ */
+ public boolean needCompile( File srcF, File oDir ) {
+ // For each .c file we'll have a .o file in the build dir,
+ // with the same name.
+ if( !srcF.exists() )
+ return false;
+
+ String name=srcF.getName();
+ String targetNA[]=co_mapper.mapFileName( name );
+ if( targetNA==null )
+ return true; // strange, probably different extension ?
+ File target=new File( oDir, targetNA[0] );
+ // System.out.println("XXX " + name + " " + targetNA[0]
+ // + target.exists());
+ if( ! target.exists() )
+ return true;
+ if( srcF.lastModified() > target.lastModified() )
+ return true;
+
+ if( debug > 0 )
+ log("No need to compile " + srcF + " target " + target );
+ return false;
+
+ }
+
/** Generate the .so file using 'standard' gcc flags. This assume
* a 'current' gcc on a 'normal' platform.
*/
@@ -302,7 +340,6 @@
exe.setAntRun(project);
- if (buildDir == null) buildDir = project.getBaseDir();
exe.setWorkingDirectory(buildDir);
exe.setCommandline(cmd.getCommandline());
1.4 +9 -2 jakarta-tomcat-connectors/jk/native/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/build.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- build.xml 2001/10/26 22:28:27 1.3
+++ build.xml 2001/10/26 22:53:56 1.4
@@ -11,6 +11,9 @@
<property name="apxs13" value="/usr/sbin/apxs" />
<property name="apxs20" value="/opt/apache2/bin/apxs" />
+ <property name="apache2.home" location="/opt/apache2" />
+ <property name="apache13.home" location="/usr" />
+
<target name="main" >
<taskdef resource="META-INF/ant.tasks"
classpathref="jkant" />
@@ -36,7 +39,9 @@
<include name="common/*.c" />
</src>
<includes>
- <pathelement location="../common" />
+ <pathelement location="${native.dir}/common" />
+ <pathelement location="${apache2.home}/include" />
+ <pathelement location="${java.home}/../include" />
</includes>
</so>
@@ -48,7 +53,9 @@
<exclude name="common/jk_jni_worker.c" />
</src>
<includes>
- <pathelement location="../common" />
+ <pathelement location="${native.dir}/common" />
+ <pathelement location="${apache13.home}/include/apache" />
+ <pathelement location="${apache13.home}/include" />
</includes>
</so>
</target>