Skip to content

Commit

Permalink
Example for ephemeral_cc_sources
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Vandevoorde committed Dec 6, 2013
1 parent 79fe32f commit 59c5917
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
12 changes: 12 additions & 0 deletions testdata/e/BUILD
@@ -0,0 +1,12 @@
[
{ "cc_library": {
"name": "print-build-timestamp",
"ephemeral_cc_sources": [ "print-build-timestamp.c" ],
"cc_compile_args": [ "-DBUILD_TIMESTAMP=\\\"\"$(date --rfc-3339=seconds)\"\\\"" ]
} },
{ "cc_binary": {
"name": "main",
"cc_sources": [ "main.c" ],
"dependencies": [ ":print-build-timestamp" ]
} }
]
8 changes: 8 additions & 0 deletions testdata/e/main.c
@@ -0,0 +1,8 @@
#include <stdio.h>

extern void print_build_timestamp();

int main(int argc, char* argv[]) {
print_build_timestamp();
return 0;
}
5 changes: 5 additions & 0 deletions testdata/e/print-build-timestamp.c
@@ -0,0 +1,5 @@
#include <stdio.h>

void print_build_timestamp() {
printf("Built on %s\n", BUILD_TIMESTAMP);
}

0 comments on commit 59c5917

Please sign in to comment.