Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes for MakeDriver

  • Loading branch information...
commit 9f23951aa3e864ba4b8ce113c21bfa5ad1345ee6 1 parent ee8c662
@nddrylliog nddrylliog authored
View
13 source/rock/backend/cnaughty/CGenerator.ooc
@@ -32,10 +32,15 @@ CGenerator: class extends Skeleton {
init: func ~cgenerator (=params, =module) {
- hOutPath := File new(params libcachePath + File separator + module getSourceFolderName(), module getPath(""))
- hOutPath parent() mkdirs()
- hw = AwesomeWriter new(this, CachedFileWriter new(hOutPath path + ".h"))
- fw = AwesomeWriter new(this, CachedFileWriter new(hOutPath path + "-fwd.h"))
+ if (params libcache) {
+ hOutPath := File new(params libcachePath + File separator + module getSourceFolderName(), module getPath(""))
+ hOutPath parent() mkdirs()
+ hw = AwesomeWriter new(this, CachedFileWriter new(hOutPath path + ".h"))
+ fw = AwesomeWriter new(this, CachedFileWriter new(hOutPath path + "-fwd.h"))
+ } else {
+ hw = AwesomeWriter new(this, CachedFileWriter new(File new(params outPath path, module getPath(".h")) path))
+ fw = AwesomeWriter new(this, CachedFileWriter new(File new(params outPath path, module getPath("-fwd.h")) path))
+ }
cOutPath := File new(params outPath path, module getPath(".c"))
cOutPath parent() mkdirs()
View
1  source/rock/frontend/CommandLine.ooc
@@ -345,6 +345,7 @@ CommandLine: class {
module := Module new(fullName, params sourcePath getElement(moduleName) path, params , nullToken)
module token = Token new(0, 0, module)
module main = true
+ module lastModified = moduleFile lastModified()
// phase 1: parse
AstBuilder new(modulePath, module, params)
View
44 source/rock/frontend/drivers/MakeDriver.ooc
@@ -17,6 +17,9 @@ MakeDriver: class extends SequenceDriver {
wasSetup := static false
if(wasSetup) return
+ // no lib-caching for the make driver!
+ params libcache = false
+
// build/
builddir = File new("build")
@@ -40,7 +43,9 @@ MakeDriver: class extends SequenceDriver {
setup()
params outPath mkdirs()
- for(candidate in module collectDeps()) {
+
+ toCompile := module collectDeps()
+ for(candidate in toCompile) {
CGenerator new(params, candidate) write()
}
@@ -120,13 +125,10 @@ MakeDriver: class extends SequenceDriver {
fW write("OBJECT_FILES:=")
- toCompile := collectDeps(module, HashMap<String, SourceFolder> new(), ArrayList<String> new())
-
- for(sourceFolder in toCompile) {
- for(currentModule in sourceFolder modules) {
- path := File new(originalOutPath, currentModule getPath("")) getPath()
- fW write(path). write(".o ")
- }
+ for(currentModule in toCompile) {
+ printf("%p, %s\n", currentModule, currentModule fullName)
+ path := File new(originalOutPath, currentModule getPath("")) getPath()
+ fW write(path). write(".o ")
}
fW write("\n\n.PHONY: compile link\n\n")
@@ -141,20 +143,18 @@ MakeDriver: class extends SequenceDriver {
oPaths := ArrayList<String> new()
- for(sourceFolder in toCompile) {
- for(currentModule in sourceFolder modules) {
- path := File new(originalOutPath, currentModule getPath("")) getPath()
- oPath := path + ".o"
- cPath := path + ".c"
- oPaths add(oPath)
-
- fW write(oPath). write(": ").
- write(cPath). write(" ").
- write(path). write(".h ").
- write(path). write("-fwd.h\n")
-
- fW write("\t${CC} ${CFLAGS} -c %s -o %s\n" format(cPath, oPath))
- }
+ for(currentModule in toCompile) {
+ path := File new(originalOutPath, currentModule getPath("")) getPath()
+ oPath := path + ".o"
+ cPath := path + ".c"
+ oPaths add(oPath)
+
+ fW write(oPath). write(": ").
+ write(cPath). write(" ").
+ write(path). write(".h ").
+ write(path). write("-fwd.h\n")
+
+ fW write("\t${CC} ${CFLAGS} -c %s -o %s\n" format(cPath, oPath))
}
fW write("\nlink: ${OBJECT_FILES}\n")
View
6 source/rock/frontend/drivers/SequenceDriver.ooc
@@ -336,7 +336,7 @@ SequenceDriver: class extends Driver {
Collect all modules imported from `module`, sort them by SourceFolder,
put them in `toCompile`, and return it.
*/
- collectDeps: func (module: Module, toCompile: HashMap<String, SourceFolder>, done: ArrayList<String>) -> HashMap<String, SourceFolder> {
+ collectDeps: func (module: Module, toCompile: HashMap<String, SourceFolder>, done: ArrayList<Module>) -> HashMap<String, SourceFolder> {
name := File new(File new(module getPathElement()) getAbsolutePath()) name()
@@ -347,10 +347,10 @@ SequenceDriver: class extends Driver {
}
sourceFolder modules add(module)
- done add(module getPath())
+ done add(module)
for(import1 in module getAllImports()) {
- if(done contains(import1 getModule() getPath())) continue
+ if(done contains(import1 getModule())) continue
collectDeps(import1 getModule(), toCompile, done)
}
Please sign in to comment.
Something went wrong with that request. Please try again.