aboutsummaryrefslogtreecommitdiff
path: root/docs/notes/c_interopable_builds.txt
blob: 39fefc6ca7eb2261c7802eeeeaa85a0836e9a6df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44


Building a C-only project
-------------------------

Makefile specifies dependencies:
    .c --> .o (suffix rule)
    .h --> .o (often auto-generated)

CC compiles to .o:
    Read main .c file
    Includes .h files (from "project" and from <system>)


Adding LRL to this
------------------

Makefile specifies dependencies:
    .c  --> .o (suffix rule)
    .lh --> .h (suffix rule [does it work when mixed with normal .h files?])
    .h  --> .o (often auto-generated. dependency checks need to run after LRL has generated the .lh files)

CC compiles to .o:
    Read main .c file
    Includes .h files (from "project" and from <system>)
        (some of those will be auto-generated)

LRLC compiles to .o
    Read main .lc file
    Includes .lh files
    Includes .h files

Perhaps change interop syntax into:
    use "blabla.h";  // *.h = use C interop
    use <blabla.h>;  // <> = special hack in tokenizer
OR simply use the pre-processor, even for LRL files?
    - tricky when C code is pasted inside LRL code
    - would need to trace pre-processor pastes
 
"Reverse includes" -- Includes from Makefile
--------------------------------------------
Instead of writing/generating the makefile from includes in source files,
we could parse the Makefile and turn dependencies into includes.
This will of course require a Makefile and might be tricky to do with
a makefile generator such as Automake.