Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More work on #576 (make driver)

  • Loading branch information...
commit 015eb27ba9938262b23c0816e9c3b3c7c7900c3a 1 parent 1c4e303
@nddrylliog nddrylliog authored
View
7 source/rock/frontend/drivers/Flags.ooc
@@ -72,8 +72,6 @@ Flags: class {
}
sourceFolders add(sourceFolder)
- addCompilerFlag("-I" + sourceFolder includePath())
-
for(module in sourceFolder modules) {
absorb(module)
}
@@ -105,11 +103,6 @@ Flags: class {
}
uses add(useDef)
- // TODO: there needs a better way to do that. .use files
- // are usually linked to SourceFolders, there needs to be a way
- // to make that connection.
- addCompilerFlag("-I" + params libcachePath + File separator + useDef identifier)
-
for (lib in useDef libs) {
addLinkerFlag(lib)
}
View
50 source/rock/frontend/drivers/MakeDriver.ooc
@@ -75,6 +75,16 @@ MakeDriver: class extends SequenceDriver {
params libcachePath = params outPath path
copyLocals(module, params)
+ params libcachePath = originalOutPath path
+ params libcache = true
+ flags := Flags new(null, params)
+ flags absorb(params)
+
+ for (sourceFolder in sourceFolders) {
+ flags absorb(sourceFolder)
+ }
+ params libcache = false
+
"Writing to %s" printfln(makefile path)
fW := FileWriter new(makefile)
@@ -121,7 +131,7 @@ MakeDriver: class extends SequenceDriver {
fW write("endif\n")
fW write("# this folder must contains libs/\n")
- fW write("ROCK_DIST?=.\n")
+ fW write("ROCK_DIST?=$(shell dirname $(shell dirname $(shell which rock)))\n")
fW write("ifeq ($(MYOS), FreeBSD)\n")
fW write(" GC_PATH?=-lgc\n")
@@ -132,30 +142,20 @@ MakeDriver: class extends SequenceDriver {
fW write("else ifeq ($(MYOS), DragonFly)\n")
fW write(" GC_PATH?=-lgc\n")
fW write("else\n")
- fW write(" # uncomment to link dynamically with the gc instead (e.g. -lgc)\n")
- fW write(" #GC_PATH?=-lgc\n")
+ fW write("ifeq (${DYN_GC},)\n")
fW write(" GC_PATH?=${ROCK_DIST}/libs/${ARCH}/libgc.a\n")
+ fW write("else\n")
+ fW write(" GC_PATH?=-lgc\n")
+ fW write("endif\n")
fW write("endif\n")
- fW write("CFLAGS+=-I %s" format(originalOutPath getPath()))
- fW write(" -I ${ROCK_DIST}/libs/headers/ -L/usr/local/lib -L/usr/pkg/lib -I/usr/local/include -I/usr/pkg/include -std=gnu99 -Wall")
-
- if (params debug) {
- fW write(" -g")
- }
+ fW write("CFLAGS+=")
- for (define in params defines) {
- fW write(" -D"). write(define)
- }
-
- for (compilerArg in params compilerArgs) {
- fW write(" "). write(compilerArg)
- }
+ fW write(" -I ${ROCK_DIST}/libs/headers/ -L/usr/local/lib -L/usr/pkg/lib -I/usr/local/include -I/usr/pkg/include -std=gnu99 -Wall")
- for (incPath in params incPath getPaths()) {
- fW write(" -I "). write(incPath getPath())
+ for (flag in flags compilerFlags) {
+ fW write(" "). write(flag)
}
-
fW write("\n")
fW write("EXECUTABLE=")
@@ -243,10 +243,6 @@ MakeDriver: class extends SequenceDriver {
fW write(" -o ${EXECUTABLE}")
- flags := Flags new(null, params)
- flags absorb(module)
-
- // FIXME: this doesn't use Flags the right way.
for(linkerFlag in flags linkerFlags) {
fW write(" "). write(linkerFlag)
}
@@ -264,6 +260,14 @@ MakeDriver: class extends SequenceDriver {
fW write("\n\n")
+ fW write("\nclean:\n")
+
+ fW write("\trm -rf ${OBJECT_FILES}\n")
+ fW write("\n\n")
+
+ fW write("\n.PHONY: clean")
+ fW write("\n\n")
+
fW close()
return 0
View
4 source/rock/frontend/drivers/SourceFolder.ooc
@@ -51,10 +51,6 @@ SourceFolder: class {
archive = Archive new(this, outlib, params, true, File new(absolutePath))
}
- includePath: func -> String {
- params libcachePath + File separator + identifier
- }
-
relativeObjectPath: func (module: Module) -> String {
File new(identifier, module path + ".o") getPath()
}
Please sign in to comment.
Something went wrong with that request. Please try again.