summaryrefslogtreecommitdiff
path: root/sys-devel/lcc/files/add_cmake_support.patch
blob: 5fc462212746c8bb090c0791a7601de44d7d7b92 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..6c3b77c
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 3.13)
+
+# TODO: test, triple
+
+project(lcc C)
+
+add_subdirectory(lburg)
+add_subdirectory(src)
+add_subdirectory(cpp)
+add_subdirectory(etc)
+add_subdirectory(lib)
diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt
new file mode 100644
index 0000000..accff2e
--- /dev/null
+++ b/cpp/CMakeLists.txt
@@ -0,0 +1,12 @@
+add_executable(cpp
+               cpp.c
+               lex.c
+               nlist.c
+               tokens.c
+               macro.c
+               eval.c
+               include.c
+               hideset.c
+               getopt.c
+               unix.c
+               )
\ No newline at end of file
diff --git a/etc/CMakeLists.txt b/etc/CMakeLists.txt
new file mode 100644
index 0000000..aa4d4aa
--- /dev/null
+++ b/etc/CMakeLists.txt
@@ -0,0 +1,18 @@
+add_executable(lcc
+               lcc.c)
+
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+    target_sources(lcc PRIVATE win32.c)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+    target_sources(lcc PRIVATE linux.c)
+endif()
+
+add_executable(bprint
+               bprint.c)
+
+target_link_libraries(bprint PRIVATE profio)
+
+add_executable(ops EXCLUDE_FROM_ALL
+               ops.c)
+
+target_link_libraries(ops PRIVATE c)
\ No newline at end of file
diff --git a/lburg/CMakeLists.txt b/lburg/CMakeLists.txt
new file mode 100644
index 0000000..25b0ae1
--- /dev/null
+++ b/lburg/CMakeLists.txt
@@ -0,0 +1,14 @@
+
+add_executable(lburg
+               lburg.c
+               gram.c)
+
+target_include_directories(lburg PRIVATE lburg)
+
+# lburg function for generation of c files from md files
+function(lburg md_file c_file)
+    add_custom_command(OUTPUT  ${c_file}
+                       DEPENDS ${md_file}
+                       COMMAND lburg ${md_file} ${c_file}
+                       VERBATIM)
+endfunction()
\ No newline at end of file
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
new file mode 100644
index 0000000..3c31289
--- /dev/null
+++ b/lib/CMakeLists.txt
@@ -0,0 +1,4 @@
+add_library(liblcc STATIC
+            assert.c
+            yynull.c
+            bbexit.c)
\ No newline at end of file
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..21efef9
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,56 @@
+add_executable(rcc
+               main.c)
+
+target_link_libraries(rcc PRIVATE librcc)
+
+lburg(${CMAKE_CURRENT_SOURCE_DIR}/dagcheck.md dagcheck.c)
+lburg(${CMAKE_CURRENT_SOURCE_DIR}/alpha.md    alpha.c   )
+lburg(${CMAKE_CURRENT_SOURCE_DIR}/mips.md     mips.c    )
+lburg(${CMAKE_CURRENT_SOURCE_DIR}/sparc.md    sparc.c   )
+lburg(${CMAKE_CURRENT_SOURCE_DIR}/x86.md      x86.c     )
+lburg(${CMAKE_CURRENT_SOURCE_DIR}/x86linux.md x86linux.c)
+
+add_library(librcc STATIC
+            alloc.c
+            bind.c
+            dag.c
+            dagcheck.c
+            decl.c
+            enode.c
+            error.c
+            expr.c
+            event.c
+            init.c
+            inits.c
+            input.c
+            lex.c
+            list.c
+            main.c
+            output.c
+            prof.c
+            profio.c
+            simp.c
+            stmt.c
+            string.c
+            sym.c
+            trace.c
+            tree.c
+            types.c
+            null.c
+            symbolic.c
+            gen.c
+            bytecode.c
+            alpha.c
+            mips.c
+            sparc.c
+            stab.c
+            x86.c
+            x86linux.c)
+
+target_include_directories(librcc PUBLIC .)
+
+add_library(c INTERFACE)
+target_include_directories(c INTERFACE .)
+
+add_library(profio INTERFACE)
+target_include_directories(profio INTERFACE .)
\ No newline at end of file