add example
This commit is contained in:
parent
2ae8e1f8a3
commit
deb4cdbf2a
4
example/bar.c
Normal file
4
example/bar.c
Normal file
|
@ -0,0 +1,4 @@
|
|||
#include "bar.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void bar() { printf("bai\n"); }
|
3
example/bar.h
Normal file
3
example/bar.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
#ifndef B
|
||||
#define B
|
||||
#endif
|
24
example/cubefile
Normal file
24
example/cubefile
Normal 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
Normal file
4
example/foo.c
Normal file
|
@ -0,0 +1,4 @@
|
|||
#include "foo.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void foo() { printf("hai\n"); }
|
3
example/foo.h
Normal file
3
example/foo.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
#ifndef A
|
||||
#define A
|
||||
#endif
|
13
example/test.c
Normal file
13
example/test.c
Normal 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;
|
||||
}
|
Loading…
Reference in a new issue