configure_file(tenyr_config.h.in tenyr_config.h)

add_subdirectory(os)

add_library(common STATIC
    common.c
    param.c
    stream.c
)

target_include_directories(common PUBLIC .)
target_link_libraries(common PUBLIC os_support)

add_executable(tld
    tld.c

    obj.c
)
target_link_libraries(tld PUBLIC common)

find_package(FLEX)
flex_target(scanner
    lexer.l lexer.c
    DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/lexer.h
)

find_package(BISON 3.7.6)
bison_target(parser
    parser.y parser.c
    DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/parser.h
)

add_flex_bison_dependency(scanner parser)

configure_file(tenyr_config.h.in tenyr_config.h)

add_subdirectory(os)

add_library(common STATIC
    common.c
    param.c
    stream.c
)

target_include_directories(common PUBLIC .)
target_link_libraries(common PUBLIC os_support)

add_executable(tld
    tld.c

    obj.c
)
target_link_libraries(tld PUBLIC common)

find_package(FLEX)
flex_target(scanner
    lexer.l lexer.c
    DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/lexer.h
)

find_package(BISON 3.7.6)
bison_target(parser
    parser.y parser.c
    DEFINES_FILE ${CMAKE_CURRENT_BINARY_DIR}/parser.h
)

add_flex_bison_dependency(scanner parser)

add_executable(tas
    tas.c

    asm.c
    asmif.c
    obj.c
    ${FLEX_scanner_OUTPUTS}
    ${BISON_parser_OUTPUTS}
)

target_include_directories(tas PRIVATE ${CMAKE_CURRENT_BINARY_DIR})

include_directories(${CMAKE_CURRENT_SOURCE_DIR})

target_link_libraries(tas PUBLIC common)

Add executable target for tas
Add executable target for tas
