FreeCalypso > hg > fc-magnetite
annotate helpers/makeline.c @ 695:530f71d65c20
uartfax.c: pull from Tourmaline (GTM900 RI output)
In addition to the primary intent of bringing in GTM900 RI output support,
pulling uartfax.c wholesale from Tourmaline also changes the initial_time
argument in the two NU_Create_Timer() calls from 0 to 1. This change
is required for the new version of Nucleus used in Tourmaline and Selenite
(and apparently also used by TI in LoCosto), and it is harmless (no effect)
for the original TCS211 version of Nucleus used in Magnetite.
The new philosophical model being adopted is that Tourmaline is our new
development head firmware, whereas Magnetite will now be maintained
similarly to how Linux maintainers treat stable kernels: changes will be
backported from Tourmaline if they are deemed appropriate for stable
modem firmware.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 24 Oct 2020 17:33:10 +0000 |
parents | 352f80da6813 |
children |
rev | line source |
---|---|
9
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This helper utility for the FreeCalypso Magnetite build system |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * emits potentially long generated Makefile lines, breaking them into |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 * multiple lines with backslashes. |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 */ |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <stdlib.h> |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <string.h> |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <strings.h> |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 int is_cmd, equ_or_colon, extra_indent; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 int linelen; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 main(argc, argv) |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 char **argv; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 { |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 char **ap; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 if (argc < 4) { |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 fprintf(stderr, "error: too few arguments\n", argv[0]); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 exit(1); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 } |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 if (!strcmp(argv[1], "def")) { |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 is_cmd = 0; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 equ_or_colon = '='; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 extra_indent = 0; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 } else if (!strcmp(argv[1], "dep")) { |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 is_cmd = 0; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 equ_or_colon = ':'; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 extra_indent = 1; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 } else if (!strcmp(argv[1], "cmd")) { |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 is_cmd = 1; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 extra_indent = 1; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 } else { |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 fprintf(stderr, "error: line type \"%s\" not known\n", argv[1]); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 exit(1); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 } |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 if (is_cmd) { |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 putchar('\t'); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 linelen = 8; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 } else |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 linelen = 0; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 fputs(argv[2], stdout); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 linelen += strlen(argv[2]); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 if (is_cmd) { |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 putchar(' '); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 linelen++; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 } else { |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 putchar(equ_or_colon); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 linelen++; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 putchar('\t'); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 do |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 linelen++; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 while (linelen & 7); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 } |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 fputs(argv[3], stdout); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 linelen += strlen(argv[3]); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 for (ap = argv + 4; *ap; ap++) { |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 if (linelen + 1 + strlen(*ap) <= 78) { |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 putchar(' '); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 linelen++; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 } else { |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 fputs(" \\\n\t", stdout); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 linelen = 8; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 if (extra_indent) { |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 fputs(" ", stdout); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 linelen += 4; |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 } |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 } |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
71 fputs(*ap, stdout); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
72 linelen += strlen(*ap); |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
73 } |
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 putchar('\n'); |
10 | 75 exit(0); |
9
05945a9b9dda
makeline helper written
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
76 } |