annotate helpers/build-date.c @ 574:41b6a18ffa0b

GPF rebuild from source: symlink magic to fix __FILE__ With this fix all of the core GPF libraries (frame_*, misc_* and tif_*) compile into objects that perfectly match the original TCS211 binary versions bit for bit. Prior to this fix there was an issue with TI's use of __FILE__ expanding into longer pathnames that were an artifact of our FC Magnetite build system, and it appears that these longer __FILE__ strings in GPF may have been causing some breakage in some error handling paths.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 24 Jan 2019 23:26:51 +0000
parents 074e24776948
children adf7a4281fd7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
248
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * This program runs at firmware build time to produce a C file for the
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * fw build that includes the build date and time stamp.
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdio.h>
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdlib.h>
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <time.h>
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 main(argc, argv)
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 char **argv;
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 {
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 time_t now;
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 struct tm *tm;
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
572
074e24776948 helpers/build-date.c: added support for target name in version string
Mychaela Falconia <falcon@freecalypso.org>
parents: 248
diff changeset
16 if (argc < 2 || argc > 3) {
074e24776948 helpers/build-date.c: added support for target name in version string
Mychaela Falconia <falcon@freecalypso.org>
parents: 248
diff changeset
17 fprintf(stderr, "usage: %s config_name [target_name]\n",
074e24776948 helpers/build-date.c: added support for target name in version string
Mychaela Falconia <falcon@freecalypso.org>
parents: 248
diff changeset
18 argv[0]);
248
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 exit(1);
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 }
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 time(&now);
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 tm = gmtime(&now);
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 printf("const char firmware_version_str[] =\n");
572
074e24776948 helpers/build-date.c: added support for target name in version string
Mychaela Falconia <falcon@freecalypso.org>
parents: 248
diff changeset
24 if (argv[2])
074e24776948 helpers/build-date.c: added support for target name in version string
Mychaela Falconia <falcon@freecalypso.org>
parents: 248
diff changeset
25 printf("\"FreeCalypso Magnetite %s (%s), ", argv[1], argv[2]);
074e24776948 helpers/build-date.c: added support for target name in version string
Mychaela Falconia <falcon@freecalypso.org>
parents: 248
diff changeset
26 else
074e24776948 helpers/build-date.c: added support for target name in version string
Mychaela Falconia <falcon@freecalypso.org>
parents: 248
diff changeset
27 printf("\"FreeCalypso Magnetite %s, ", argv[1]);
248
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 printf("build date %d-%02d-%02dT%02d:%02d:%02dZ\";\n",
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 tm->tm_year+1900, tm->tm_mon+1, tm->tm_mday,
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 tm->tm_hour, tm->tm_min, tm->tm_sec);
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 exit(0);
35b17d54773d helpers: build-date helper program written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 }