|
@@ -46,12 +46,42 @@ class Build {
|
|
else
|
|
else
|
|
relDir = currentAbs.substr(targetAbs.length+1);
|
|
relDir = currentAbs.substr(targetAbs.length+1);
|
|
relDir = relDir.split("\\").join("/");
|
|
relDir = relDir.split("\\").join("/");
|
|
|
|
+ if( relDir != "" )
|
|
|
|
+ relDir += "/";
|
|
}
|
|
}
|
|
if( !sys.FileSystem.exists(srcDir) ) {
|
|
if( !sys.FileSystem.exists(srcDir) ) {
|
|
srcDir = dataPath + "templates/"+tpl;
|
|
srcDir = dataPath + "templates/"+tpl;
|
|
if( !sys.FileSystem.exists(srcDir) )
|
|
if( !sys.FileSystem.exists(srcDir) )
|
|
throw "Failed to find make template '"+tpl+"'";
|
|
throw "Failed to find make template '"+tpl+"'";
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ var allFiles = config.files.copy();
|
|
|
|
+ for( f in config.files )
|
|
|
|
+ if( StringTools.endsWith(f,".c") ) {
|
|
|
|
+ var h = f.substr(0,-2) + ".h";
|
|
|
|
+ if( sys.FileSystem.exists(targetDir+h) )
|
|
|
|
+ allFiles.push(h);
|
|
|
|
+ }
|
|
|
|
+ allFiles.sort(Reflect.compare);
|
|
|
|
+
|
|
|
|
+ var files = [for( f in allFiles ) { path : f, directory : new haxe.io.Path(f).dir }];
|
|
|
|
+ var directories = new Map();
|
|
|
|
+ for( f in files )
|
|
|
|
+ if( f.directory != null )
|
|
|
|
+ directories.set(f.directory, true);
|
|
|
|
+ for( k in directories.keys() ) {
|
|
|
|
+ var dir = k.split("/");
|
|
|
|
+ dir.pop();
|
|
|
|
+ while( dir.length > 0 ) {
|
|
|
|
+ var p = dir.join("/");
|
|
|
|
+ directories.set(p, true);
|
|
|
|
+ dir.pop();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var directories = [for( k in directories.keys() ) { path : k }];
|
|
|
|
+ directories.sort(function(a,b) return Reflect.compare(a.path,b.path));
|
|
|
|
+
|
|
function genRec( path : String ) {
|
|
function genRec( path : String ) {
|
|
var dir = srcDir + "/" + path;
|
|
var dir = srcDir + "/" + path;
|
|
for( f in sys.FileSystem.readDirectory(dir) ) {
|
|
for( f in sys.FileSystem.readDirectory(dir) ) {
|
|
@@ -64,33 +94,6 @@ class Build {
|
|
}
|
|
}
|
|
var content = sys.io.File.getContent(srcPath);
|
|
var content = sys.io.File.getContent(srcPath);
|
|
var tpl = new haxe.Template(content);
|
|
var tpl = new haxe.Template(content);
|
|
- var allFiles = config.files.copy();
|
|
|
|
- for( f in config.files )
|
|
|
|
- if( StringTools.endsWith(f,".c") ) {
|
|
|
|
- var h = f.substr(0,-2) + ".h";
|
|
|
|
- if( sys.FileSystem.exists(targetDir+h) )
|
|
|
|
- allFiles.push(h);
|
|
|
|
- }
|
|
|
|
- allFiles.sort(Reflect.compare);
|
|
|
|
-
|
|
|
|
- var files = [for( f in allFiles ) { path : f, directory : new haxe.io.Path(f).dir }];
|
|
|
|
- var directories = new Map();
|
|
|
|
- for( f in files )
|
|
|
|
- if( f.directory != null )
|
|
|
|
- directories.set(f.directory, true);
|
|
|
|
- for( k in directories.keys() ) {
|
|
|
|
- var dir = k.split("/");
|
|
|
|
- dir.pop();
|
|
|
|
- while( dir.length > 0 ) {
|
|
|
|
- var p = dir.join("/");
|
|
|
|
- directories.set(p, true);
|
|
|
|
- dir.pop();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- var directories = [for( k in directories.keys() ) { path : k }];
|
|
|
|
- directories.sort(function(a,b) return Reflect.compare(a.path,b.path));
|
|
|
|
-
|
|
|
|
content = tpl.execute({
|
|
content = tpl.execute({
|
|
name : this.name,
|
|
name : this.name,
|
|
libraries : [for( l in config.libs ) if( l != "std" ) { name : l }],
|
|
libraries : [for( l in config.libs ) if( l != "std" ) { name : l }],
|
|
@@ -105,6 +108,9 @@ class Build {
|
|
sha1 = sha1.toUpperCase();
|
|
sha1 = sha1.toUpperCase();
|
|
return sha1.substr(0,8)+"-"+sha1.substr(8,4)+"-"+sha1.substr(12,4)+"-"+sha1.substr(16,4)+"-"+sha1.substr(20,12);
|
|
return sha1.substr(0,8)+"-"+sha1.substr(8,4)+"-"+sha1.substr(12,4)+"-"+sha1.substr(16,4)+"-"+sha1.substr(20,12);
|
|
},
|
|
},
|
|
|
|
+ makePath : function(_,dir:String) {
|
|
|
|
+ return dir == "" ? "./" : (StringTools.endsWith(dir,"/") || StringTools.endsWith(dir,"\\")) ? dir : dir + "/";
|
|
|
|
+ },
|
|
winPath : function(_,s:String) return s.split("/").join("\\"),
|
|
winPath : function(_,s:String) return s.split("/").join("\\"),
|
|
});
|
|
});
|
|
var prevContent = try sys.io.File.getContent(targetPath) catch( e : Dynamic ) null;
|
|
var prevContent = try sys.io.File.getContent(targetPath) catch( e : Dynamic ) null;
|