From eae3e7cdef529546fbd10fc5f794df568ae545f5 Mon Sep 17 00:00:00 2001 From: Avery Pennarun Date: Wed, 17 Nov 2010 19:49:41 -0800 Subject: [PATCH] Add t/example, a basic example build environment suitable for a tutorial. --- README.md | 6 +++--- t/all.do | 4 +--- t/clean.do | 3 +-- t/example/.gitignore | 3 +++ t/example/CC.do | 10 ++++++++++ t/example/Makefile | 6 ++++++ t/example/all.do | 1 + t/example/clean.do | 1 + t/example/config.sh | 1 + t/example/default.o.do | 2 ++ t/example/hello.do | 4 ++++ t/example/main.c | 8 ++++++++ t/example/mystr.c | 4 ++++ t/example/mystr.h | 6 ++++++ 14 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 t/example/.gitignore create mode 100644 t/example/CC.do create mode 100644 t/example/Makefile create mode 100644 t/example/all.do create mode 100644 t/example/clean.do create mode 100644 t/example/config.sh create mode 100644 t/example/default.o.do create mode 100644 t/example/hello.do create mode 100644 t/example/main.c create mode 100644 t/example/mystr.c create mode 100644 t/example/mystr.h diff --git a/README.md b/README.md index d3b04d0..0a8d14b 100644 --- a/README.md +++ b/README.md @@ -64,9 +64,9 @@ But the easiest way to show it is with an example. Create a file called default.o.do: redo-ifchange $1.c - gcc -MD -MF deps.tmp -c -o $3 $1.c - DEPS=$(sed -e "s/^$3://" -e 's/\\//g' +#include "mystr.h" + +int main() +{ + printf("%s\n", mystr); + return 0; +} diff --git a/t/example/mystr.c b/t/example/mystr.c new file mode 100644 index 0000000..b64b7a5 --- /dev/null +++ b/t/example/mystr.c @@ -0,0 +1,4 @@ + +#include "mystr.h" + +char *mystr = "Hello, world!"; diff --git a/t/example/mystr.h b/t/example/mystr.h new file mode 100644 index 0000000..1bf584e --- /dev/null +++ b/t/example/mystr.h @@ -0,0 +1,6 @@ +#ifndef __MYSTR_H +#define __MYSTR_H + +extern char *mystr; + +#endif