Fixed markdown errors in README - code samples now correctly formatted.
This commit is contained in:
parent
6819010401
commit
4017495c12
1 changed files with 8 additions and 0 deletions
|
|
@ -69,6 +69,7 @@ it'll be very, very fast.)
|
||||||
The easiest way to show it is with an example.
|
The easiest way to show it is with an example.
|
||||||
|
|
||||||
Create a file called default.o.do:
|
Create a file called default.o.do:
|
||||||
|
|
||||||
redo-ifchange $1.c
|
redo-ifchange $1.c
|
||||||
gcc -MD -MF $3.deps.tmp -c -o $3 $1.c
|
gcc -MD -MF $3.deps.tmp -c -o $3 $1.c
|
||||||
DEPS=$(sed -e "s/^$3://" -e 's/\\//g' <$3.deps.tmp)
|
DEPS=$(sed -e "s/^$3://" -e 's/\\//g' <$3.deps.tmp)
|
||||||
|
|
@ -76,6 +77,7 @@ Create a file called default.o.do:
|
||||||
redo-ifchange $DEPS
|
redo-ifchange $DEPS
|
||||||
|
|
||||||
Create a file called myprog.do:
|
Create a file called myprog.do:
|
||||||
|
|
||||||
DEPS="a.o b.o"
|
DEPS="a.o b.o"
|
||||||
redo-ifchange $DEPS
|
redo-ifchange $DEPS
|
||||||
gcc -o $3 $DEPS
|
gcc -o $3 $DEPS
|
||||||
|
|
@ -84,30 +86,36 @@ Of course, you'll also have to create `a.c` and `b.c`, the C language
|
||||||
source files that you want to build to create your application.
|
source files that you want to build to create your application.
|
||||||
|
|
||||||
In a.c:
|
In a.c:
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "b.h"
|
#include "b.h"
|
||||||
|
|
||||||
int main() { printf(bstr); }
|
int main() { printf(bstr); }
|
||||||
|
|
||||||
In b.h:
|
In b.h:
|
||||||
|
|
||||||
extern char *bstr;
|
extern char *bstr;
|
||||||
|
|
||||||
In b.c:
|
In b.c:
|
||||||
char *bstr = "hello, world!\n";
|
char *bstr = "hello, world!\n";
|
||||||
|
|
||||||
Now you simply run:
|
Now you simply run:
|
||||||
|
|
||||||
$ redo myprog
|
$ redo myprog
|
||||||
|
|
||||||
And it says:
|
And it says:
|
||||||
|
|
||||||
redo myprog
|
redo myprog
|
||||||
redo a.o
|
redo a.o
|
||||||
redo b.o
|
redo b.o
|
||||||
|
|
||||||
Now try this:
|
Now try this:
|
||||||
|
|
||||||
$ touch b.h
|
$ touch b.h
|
||||||
$ redo myprog
|
$ redo myprog
|
||||||
|
|
||||||
Sure enough, it says:
|
Sure enough, it says:
|
||||||
|
|
||||||
redo myprog
|
redo myprog
|
||||||
redo a.o
|
redo a.o
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue