annotate helpers/makeline.c @ 287:3dee79757ae4

UI fw: load handheld audio mode on boot We have now reached the point where use of audio mode config files should be considered mandatory. In ACI usage we can tell users that they need to perform an AT@AUL of some appropriate audio mode, but in UI-enabled fw we really need to have the firmware load audio modes on its own, so that correct audio config gets established when the handset or development board runs on its own, without a connected host computer. Once have FC Venus with both main and headset audio channels and headset plug insertion detection, our fw will need to automatically load the handheld mode or the headset mode depending on the plug insertion state. For now we load only the handheld mode, which has been tuned for FC-HDS4 on FC Luna.
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 13 Nov 2021 03:20:57 +0000
parents 775dba605f33
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
9
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
10
775dba605f33 helpers: we are FC Tourmaline
Mychaela Falconia <falcon@freecalypso.org>
parents: 9
diff changeset
2 * This helper utility for the FreeCalypso Tourmaline build system
9
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * emits potentially long generated Makefile lines, breaking them into
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 * multiple lines with backslashes.
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 */
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <stdio.h>
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <stdlib.h>
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <string.h>
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <strings.h>
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 int is_cmd, equ_or_colon, extra_indent;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 int linelen;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 main(argc, argv)
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 char **argv;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 {
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 char **ap;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 if (argc < 4) {
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 fprintf(stderr, "error: too few arguments\n", argv[0]);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 exit(1);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 }
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 if (!strcmp(argv[1], "def")) {
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 is_cmd = 0;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 equ_or_colon = '=';
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 extra_indent = 0;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 } else if (!strcmp(argv[1], "dep")) {
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 is_cmd = 0;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 equ_or_colon = ':';
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 extra_indent = 1;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 } else if (!strcmp(argv[1], "cmd")) {
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 is_cmd = 1;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 extra_indent = 1;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 } else {
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 fprintf(stderr, "error: line type \"%s\" not known\n", argv[1]);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 exit(1);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 }
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 if (is_cmd) {
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 putchar('\t');
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 linelen = 8;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
42 } else
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
43 linelen = 0;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
44 fputs(argv[2], stdout);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
45 linelen += strlen(argv[2]);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
46 if (is_cmd) {
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
47 putchar(' ');
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
48 linelen++;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
49 } else {
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
50 putchar(equ_or_colon);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 linelen++;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
52 putchar('\t');
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
53 do
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
54 linelen++;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
55 while (linelen & 7);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
56 }
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 fputs(argv[3], stdout);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58 linelen += strlen(argv[3]);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 for (ap = argv + 4; *ap; ap++) {
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 if (linelen + 1 + strlen(*ap) <= 78) {
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61 putchar(' ');
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 linelen++;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
63 } else {
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
64 fputs(" \\\n\t", stdout);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 linelen = 8;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66 if (extra_indent) {
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 fputs(" ", stdout);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
68 linelen += 4;
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 }
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70 }
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 fputs(*ap, stdout);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 linelen += strlen(*ap);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 }
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74 putchar('\n');
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 exit(0);
1fb47f5b597a helpers: import from Magnetite
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76 }