Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 12 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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
)
18 changes: 18 additions & 0 deletions etc/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
14 changes: 14 additions & 0 deletions lburg/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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()
4 changes: 4 additions & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
add_library(liblcc STATIC
assert.c
yynull.c
bbexit.c)
56 changes: 56 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 .)