diff --git a/example/bar.c b/example/bar.c new file mode 100644 index 0000000..0ceae2e --- /dev/null +++ b/example/bar.c @@ -0,0 +1,4 @@ +#include "bar.h" +#include + +void bar() { printf("bai\n"); } diff --git a/example/bar.h b/example/bar.h new file mode 100644 index 0000000..b2f3b07 --- /dev/null +++ b/example/bar.h @@ -0,0 +1,3 @@ +#ifndef B +#define B +#endif diff --git a/example/cubefile b/example/cubefile new file mode 100644 index 0000000..3fecafd --- /dev/null +++ b/example/cubefile @@ -0,0 +1,24 @@ +rule all test + +OBJ = [test.o foo.o bar.o] + +rule test $OBJ [ + echo " LD" $target + shell cc -o $target $sources +] + +rule %.o %.c [ + echo " CC" $target + shell cc -c -o $target $source +] + +rule clean [] [ + echo " CLEAN" $OBJ test + shell rm -f $OBJ test +] + +// dependencies + +rule foo.o foo.h +rule bar.o bar.h +rule test.o [foo.h bar.h] \ No newline at end of file diff --git a/example/foo.c b/example/foo.c new file mode 100644 index 0000000..6adf181 --- /dev/null +++ b/example/foo.c @@ -0,0 +1,4 @@ +#include "foo.h" +#include + +void foo() { printf("hai\n"); } diff --git a/example/foo.h b/example/foo.h new file mode 100644 index 0000000..2f2f23f --- /dev/null +++ b/example/foo.h @@ -0,0 +1,3 @@ +#ifndef A +#define A +#endif diff --git a/example/test.c b/example/test.c new file mode 100644 index 0000000..e691c35 --- /dev/null +++ b/example/test.c @@ -0,0 +1,13 @@ +#include "foo.h" +#include "bar.h" +#include + +void foo(); +void bar(); + +int main() { + foo(); + bar(); + printf("hello world\n"); + return 0; +}