add example
parent
2ae8e1f8a3
commit
deb4cdbf2a
|
@ -0,0 +1,4 @@
|
||||||
|
#include "bar.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void bar() { printf("bai\n"); }
|
|
@ -0,0 +1,3 @@
|
||||||
|
#ifndef B
|
||||||
|
#define B
|
||||||
|
#endif
|
|
@ -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]
|
|
@ -0,0 +1,4 @@
|
||||||
|
#include "foo.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
void foo() { printf("hai\n"); }
|
|
@ -0,0 +1,3 @@
|
||||||
|
#ifndef A
|
||||||
|
#define A
|
||||||
|
#endif
|
|
@ -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 New Issue