add example

master
Daniel Kolesa 2015-08-15 01:21:20 +01:00
parent 2ae8e1f8a3
commit deb4cdbf2a
6 changed files with 51 additions and 0 deletions

4
example/bar.c 100644
View File

@ -0,0 +1,4 @@
#include "bar.h"
#include <stdio.h>
void bar() { printf("bai\n"); }

3
example/bar.h 100644
View File

@ -0,0 +1,3 @@
#ifndef B
#define B
#endif

24
example/cubefile 100644
View File

@ -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]

4
example/foo.c 100644
View File

@ -0,0 +1,4 @@
#include "foo.h"
#include <stdio.h>
void foo() { printf("hai\n"); }

3
example/foo.h 100644
View File

@ -0,0 +1,3 @@
#ifndef A
#define A
#endif

13
example/test.c 100644
View File

@ -0,0 +1,13 @@
#include "foo.h"
#include "bar.h"
#include <stdio.h>
void foo();
void bar();
int main() {
foo();
bar();
printf("hello world\n");
return 0;
}