Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
commit G.
Signed-off-by: Jiang Xin <jiangxin@ossxp.com>
- Loading branch information
Jiang Xin
committed
Dec 9, 2010
0 parents
commit e80aa74
Showing
6 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
DEMO program for git-scm-book. | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
|
||
Changes | ||
======= | ||
|
||
* create node G. | ||
* initialized. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2010年 12月 09日 星期四 13:45:52 CST |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*.o | ||
hello | ||
version.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
OBJECTS = main.o | ||
TARGET = hello | ||
|
||
all: $(TARGET) | ||
|
||
$(TARGET): $(OBJECTS) | ||
$(CC) -o $@ $^ | ||
|
||
main.o: version.h | ||
|
||
version.h: new_header | ||
|
||
new_header: | ||
@sed -e "s/<version>/$$(git describe)/g" < version.h.in > version.h.tmp | ||
@if diff -q version.h.tmp version.h >/dev/null 2>&1; then \ | ||
rm version.h.tmp; \ | ||
else \ | ||
echo "version.h.in => version.h" ; \ | ||
mv version.h.tmp version.h; \ | ||
fi | ||
|
||
clean: | ||
rm -f $(TARGET) $(OBJECTS) version.h | ||
|
||
.PHONY: all clean | ||
|
||
# vim: noet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#include "version.h" | ||
#include <stdio.h> | ||
|
||
int | ||
main() | ||
{ | ||
printf( "Hello, world.\n" ); | ||
printf( "version: %s.\n", _VERSION ); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#ifndef HELLO_WORLD_VERSION_H | ||
#define HELLO_WORLD_VERSION_H | ||
|
||
#define _VERSION "<version>" | ||
|
||
#endif |
Now the book calls "Got Git".