diff options
Diffstat (limited to '')
-rw-r--r-- | src/CMakeLists.txt | 83 | ||||
-rw-r--r-- | src/Makefile.am | 70 |
2 files changed, 83 insertions, 70 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..dc3770e --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,83 @@ +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$<JOIN:$<TARGET_PROPERTY:dash,COMPILE_DEFINITIONS>,;-D>" + $<TARGET_PROPERTY:dash,COMPILE_OPTIONS> + -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 +) diff --git a/src/Makefile.am b/src/Makefile.am deleted file mode 100644 index 1732465..0000000 --- a/src/Makefile.am +++ /dev/null @@ -1,70 +0,0 @@ -AM_YFLAGS = -d - -COMMON_CFLAGS = -Wall -COMMON_CPPFLAGS = \ - -DBSD=1 -DSHELL - -AM_CFLAGS = $(COMMON_CFLAGS) -AM_CPPFLAGS = -include $(top_builddir)/config.h $(COMMON_CPPFLAGS) -AM_CFLAGS_FOR_BUILD = -g -O2 $(COMMON_CFLAGS) -AM_CPPFLAGS_FOR_BUILD = $(COMMON_CPPFLAGS) - -COMPILE_FOR_BUILD = \ - $(CC_FOR_BUILD) $(DEFAULT_INCLUDES) $(AM_CPPFLAGS_FOR_BUILD) \ - $(CPPFLAGS_FOR_BUILD) \ - $(AM_CFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) - -bin_PROGRAMS = dash - -dash_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 -dash_SOURCES = \ - $(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 -dash_LDADD = builtins.o init.o nodes.o signames.o syntax.o - -HELPERS = mkinit mksyntax mknodes mksignames - -BUILT_SOURCES = builtins.h nodes.h syntax.h token.h token_vars.h -CLEANFILES = \ - $(BUILT_SOURCES) $(patsubst %.o,%.c,$(dash_LDADD)) \ - $(HELPERS) builtins.def - -man_MANS = dash.1 -EXTRA_DIST = \ - $(man_MANS) \ - mktokens mkbuiltins builtins.def.in mkinit.c \ - mknodes.c nodetypes nodes.c.pat mksyntax.c mksignames.c - -token.h token_vars.h: mktokens - $(AM_V_GEN)$(SHELL) $^ - -builtins.def: builtins.def.in $(top_builddir)/config.h - $(AM_V_CC)$(COMPILE) -E -x c -o $@ $< - -builtins.c builtins.h: mkbuiltins builtins.def - $(AM_V_GEN)$(SHELL) $^ - -init.c: mkinit $(dash_CFILES) - $(AM_V_GEN)./$^ - -nodes.c nodes.h: mknodes nodetypes nodes.c.pat - $(AM_V_GEN)./$^ - -syntax.c syntax.h: mksyntax - $(AM_V_GEN)./$^ - -signames.c: mksignames - $(AM_V_GEN)./$^ - -mksyntax: token.h - -$(HELPERS): %: %.c - $(AM_V_CC)$(COMPILE_FOR_BUILD) -o $@ $< |