diff options
| -rw-r--r-- | .build | 7 | ||||
| -rwxr-xr-x | cook.py | 11 | ||||
| -rw-r--r-- | main.c | 7 | ||||
| -rw-r--r-- | test/.build | 7 | ||||
| -rw-r--r-- | test/hai.c | 5 | ||||
| -rw-r--r-- | test/hai.h | 5 |
6 files changed, 29 insertions, 13 deletions
@@ -1,5 +1,10 @@ +this.include_dirs = [this.cwd()] + test = this('test') +this.objects = this.c.cc.gen('main.c', include_dirs=this.include_dirs) + this.c.exe('vol', - test.link + this.objects, + test.objects ) @@ -252,10 +252,13 @@ class CC(Vec): def gen(self, *args, extra_args = [], include_dirs = [], dependencies = [], **kwargs): inputs = File.resolve(args) dependencies = flatten(dependencies) - + + include_dirs = [e for e in include_dirs] include_dirs += [d.include_dirs for d in dependencies if d.include_dirs] include_dirs = File.resolve(include_dirs) include_args = [self.mkinc(str(x)) for x in include_dirs] + + extra_args = [e for e in extra_args] extra_args += [d.cc_args for d in dependencies if d.cc_args] extra_args += include_args @@ -301,8 +304,11 @@ class CExe(Processor): def gen(self, name, *args, libs=[], dependencies = [], extra_args = [], **kwargs): libs = flatten(libs) dependencies = flatten(dependencies) - + + libs = [e for e in libs] libs += [d.libs for d in dependencies if d.libs] + + extra_args = [e for e in extra_args] extra_args += [d.ld_args for d in dependencies if d.ld_args] # Note: this is bad, perhaps take a "depends" also/instead @@ -533,6 +539,7 @@ _root = CMod(None, "") global this this = _root +this.cwd = Path.cwd global cook cook = AttrDict({ @@ -0,0 +1,7 @@ +#include <stdio.h> +#include <test/hai.h> + +int main() { + printf("%d\n", hai()); + return 0; +} diff --git a/test/.build b/test/.build index b7c10e0..ded9352 100644 --- a/test/.build +++ b/test/.build @@ -1,5 +1,4 @@ -objects = this.c.cc( - 'hai.c' +this.objects = this.c.cc.gen( + 'hai.c', + include_dirs = this.include_dirs ) - -this.object = this.c.lib('test', objects) @@ -1,6 +1,5 @@ #include <stdio.h> -int main() { - printf("Hello world!\n"); - return 0; +int hai() { + return 42; } @@ -1,4 +1,3 @@ -void hai(); +int hai(); - -// test
\ No newline at end of file +// test |
