add_compile_options(-Wall) add_compile_definitions(BSD=1 SHELL) add_compile_options(-include ${CMAKE_BINARY_DIR}/config.h) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) set( CFILES alias.c arith_yacc.c arith_yylex.c cd.c error.c eval.c exec.c expand.c histedit.c input.c jobs.c mail.c main.c memalloc.c miscbltin.c mystring.c options.c parser.c redir.c show.c trap.c output.c bltin/printf.c system.c bltin/test.c bltin/times.c var.c ) add_executable( dash ${CFILES} alias.h arith_yacc.h bltin/bltin.h cd.h error.h eval.h exec.h expand.h init.h input.h jobs.h machdep.h mail.h main.h memalloc.h miscbltin.h myhistedit.h mystring.h options.h output.h parser.h redir.h shell.h show.h system.h trap.h var.h builtins.c builtins.h init.c nodes.c nodes.h signames.c syntax.c syntax.h ) install(TARGETS dash) install(FILES dash.1 TYPE MAN RENAME man1/dash.1) add_executable(mkinit EXCLUDE_FROM_ALL mkinit.c) add_executable(mksyntax EXCLUDE_FROM_ALL mksyntax.c token.h) add_executable(mknodes EXCLUDE_FROM_ALL mknodes.c) add_executable(mksignames EXCLUDE_FROM_ALL mksignames.c) add_custom_command( OUTPUT token.h token_vars.h COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/mktokens DEPENDS mktokens VERBATIM ) add_custom_command( OUTPUT builtins.def COMMAND ${CMAKE_C_COMPILER} "-D$,;-D>" $ -E -x c ${CMAKE_CURRENT_SOURCE_DIR}/builtins.def.in -o ${CMAKE_CURRENT_BINARY_DIR}/builtins.def DEPENDS builtins.def.in ${CMAKE_BINARY_DIR}/config.h VERBATIM COMMAND_EXPAND_LISTS ) add_custom_command( OUTPUT builtins.c builtins.h COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/mkbuiltins ${CMAKE_CURRENT_BINARY_DIR}/builtins.def DEPENDS mkbuiltins builtins.def VERBATIM ) list(TRANSFORM CFILES PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/") add_custom_command( OUTPUT init.c COMMAND mkinit ${CFILES} DEPENDS ${CFILES} VERBATIM COMMAND_EXPAND_LISTS ) add_custom_command( OUTPUT nodes.c nodes.h COMMAND mknodes ${CMAKE_CURRENT_SOURCE_DIR}/nodetypes ${CMAKE_CURRENT_SOURCE_DIR}/nodes.c.pat DEPENDS nodetypes nodes.c.pat VERBATIM ) add_custom_command( OUTPUT syntax.c syntax.h COMMAND mksyntax VERBATIM ) add_custom_command( OUTPUT signames.c COMMAND mksignames VERBATIM )