Created
September 11, 2016 13:40
-
-
Save tim-janik/0957f2f7e3f640a4d997e770ce737a41 to your computer and use it in GitHub Desktop.
build_always
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
# -*- Mode: python; python-indent-offset: 2 -*- | |
project ('test always_build', 'c') | |
buildid_h = custom_target ('buildid.h', | |
output : 'buildid.h', | |
command : ['../mkbuildid.sh', '+"%M"'], | |
build_always : true) | |
executable ('tester', 'tester.c', buildid_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
#!/bin/sh | |
set -e | |
BUILDID="$(date '+"%M"')" | |
test ! -e buildid.h || | |
test "$(echo $BUILDID)" != "$(cat buildid.h)" || | |
exit 0 | |
echo $BUILDID > buildid.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
#include <stdio.h> | |
#include <stdint.h> | |
static const char *buildid = | |
#include "buildid.h" | |
; | |
int | |
main (int argc, char *argv[]) | |
{ | |
printf ("buildid: %s\n", buildid); | |
return 0; | |
} | |
// g++ -Wall -O2 -std=gnu++11 -fdiagnostics-color x.cc && ./a.out |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment