summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--.gitignore42
-rw-r--r--CMakeLists.txt151
-rw-r--r--Makefile.am1
-rwxr-xr-xautogen.sh6
-rw-r--r--config.h.in24
-rw-r--r--configure.ac191
-rw-r--r--src/CMakeLists.txt83
-rw-r--r--src/Makefile.am70
8 files changed, 258 insertions, 310 deletions
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index e349901..0000000
--- a/.gitignore
+++ /dev/null
@@ -1,42 +0,0 @@
-# .gitignore for dash
-
-# generated by autogen.sh
-Makefile.in
-/aclocal.m4
-/autom4te.cache/
-/compile
-/config.h.in
-/configure
-/depcomp
-/install-sh
-/missing
-
-# generated by configure
-Makefile
-.deps
-.dirstamp
-/config.cache
-/config.h
-/config.log
-/config.status
-/stamp-h1
-
-# generated by make
-/src/token_vars.h
-
-# Apple debug symbol bundles
-*.dSYM/
-
-# backups and patch artefacts
-*~
-*.bak
-*.orig
-*.rej
-
-# OS generated files
-.DS_Store
-.DS_Store?
-._*
-.Spotlight*
-.Trash*
-*[Tt]humbs.db
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..5385049
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,151 @@
+cmake_minimum_required(VERSION 3.10)
+
+project(dash VERSION 0.5.11.5 LANGUAGES C)
+
+include(CheckCSourceCompiles)
+include(CheckIncludeFile)
+include(CheckLibraryExists)
+include(CheckStructHasMember)
+include(CheckSymbolExists)
+include(CheckTypeSize)
+include(GNUInstallDirs)
+
+check_c_source_compiles([[
+void t() {}
+void a() __attribute__((__alias__("t")));
+int main() { a(); return 0; }
+]] HAVE_ALIAS_ATTRIBUTE)
+
+option(ENABLE_FNMATCH "Use fnmatch(3) from libc")
+option(ENABLE_GLOB "Use glob(3) from libc")
+
+# Checks for header files.
+check_include_file("alloca.h" HAVE_ALLOCA_H)
+check_include_file("paths.h" HAVE_PATHS_H)
+
+# Check for declarations
+check_symbol_exists(_PATH_BSHELL "paths.h" HAVE__PATH_BSHELL)
+check_symbol_exists(_PATH_DEVNULL "paths.h" HAVE__PATH_DEVNULL)
+check_symbol_exists(_PATH_TTY "paths.h" HAVE__PATH_TTY)
+add_compile_definitions(
+	$<$<NOT:$<BOOL:${HAVE__PATH_BSHELL}>>:_PATH_BSHELL="/bin/sh">
+	$<$<NOT:$<BOOL:${HAVE__PATH_DEVNULL}>>:_PATH_DEVNULL="/dev/null">
+	$<$<NOT:$<BOOL:${HAVE__PATH_TTY}>>:_PATH_TTY="/dev/tty">
+)
+
+# Some systems lack isblank
+check_symbol_exists(isblank "ctype.h" HAVE_DECL_ISBLANK)
+
+# Check for sizes of types
+check_type_size("intmax_t" SIZEOF_INTMAX_T)
+check_type_size("long long int" SIZEOF_LONG_LONG_INT)
+
+# Select a fallback format string for intmax_t in case we don't find PRIdMAX
+set(
+	INTMAX_FSTR
+	$<IF:$<EQUAL:${SIZEOF_INTMAX_T},${SIZEOF_LONG_LONG_INT}>,lld,jd>
+)
+
+# Check for PRIdMAX and define it to a fallback if not found
+check_symbol_exists(PRIdMAX "inttypes.h" HAVE_PRIdMAX)
+if(NOT HAVE_PRIdMAX)
+	add_compile_definitions(PRIdMAX="${INTMAX_FSTR}")
+endif()
+
+# Checks for library functions.
+check_symbol_exists(bsearch "stdlib.h" HAVE_BSEARCH)
+check_symbol_exists(faccessat "unistd.h" HAVE_FACCESSAT)
+check_symbol_exists(getpwnam "pwd.h" HAVE_GETPWNAM)
+check_symbol_exists(getrlimit "sys/resource.h" HAVE_GETRLIMIT)
+check_symbol_exists(isalpha "ctype.h" HAVE_ISALPHA)
+check_symbol_exists(killpg "signal.h" HAVE_KILLPG)
+check_symbol_exists(memcpy "string.h" HAVE_MEMCPY)
+check_symbol_exists(sigsetmask "signal.h" HAVE_SIGSETMASK)
+check_symbol_exists(stpcpy "string.h" HAVE_STPCPY)
+check_symbol_exists(strchrnul "string.h" HAVE_STRCHRNUL)
+check_symbol_exists(strsignal "string.h" HAVE_STRSIGNAL)
+check_symbol_exists(strtod "stdlib.h" HAVE_STRTOD)
+check_symbol_exists(strtoimax "inttypes.h" HAVE_STRTOIMAX)
+check_symbol_exists(strtoumax "inttypes.h" HAVE_STRTOUMAX)
+check_symbol_exists(sysconf "unistd.h" HAVE_SYSCONF)
+
+# Check whether it's worth working around FreeBSD PR kern/125009.
+# The traditional behavior of access/faccessat is crazy, but
+# POSIX.1-2008 explicitly allows those functions to misbehave.
+#
+# Unaffected kernels:
+#
+# - all versions of Linux
+# - NetBSD sys/kern/vfs_subr.c 1.64, 1997-04-23
+# - FreeBSD 9 (r212002), 2010-09-10
+# - OpenBSD sys/kern/vfs_subr.c 1.166, 2008-06-09
+#
+# Also worked around in Debian's libc0.1 2.13-19 when using
+# kFreeBSD 8.
+option(
+	ENABLE_TEST_WORKAROUND
+	"Guard against faccessat(2) that tells root all files are executable"
+	AUTO
+)
+if(ENABLE_TEST_WORKAROUND STREQUAL "AUTO" AND HAVE_FACCESSAT)
+	if(
+		CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" OR
+		CMAKE_SYSTEM_NAME STREQUAL "GNU/kFreeBSD"
+	)
+		set(ENABLE_TEST_WORKAROUND ON)
+	endif()
+	set(
+		HAVE_TRADITIONAL_FACCESSAT ON CACHE
+		BOOL "Define if your faccessat tells root all files are executable"
+	)
+endif()
+
+if(ENABLE_FNMATCH)
+	check_symbol_exists(fnmatch "fnmatch.h" HAVE_FNMATCH)
+endif()
+
+if(HAVE_FNMATCH AND ENABLE_GLOB)
+	check_symbol_exists(glob "glob.h" HAVE_GLOB)
+endif()
+
+# Check for klibc signal.
+check_symbol_exists(bsd_signal "signal.h" HAVE_BSD_SIGNAL)
+if(HAVE_BSD_SIGNAL)
+	add_compile_definitions(signal=bsd_signal)
+endif()
+
+# Check for stat64 (dietlibc/klibc).
+check_symbol_exists(stat64 "sys/stat.h" HAVE_STAT64)
+if(NOT HAVE_STAT64)
+	add_compile_definitions(fstat64=fstat lstat64=lstat stat64=stat)
+endif()
+
+# OS X apparently has stat64 but not open64.
+check_symbol_exists(open64 "fcntl.h" HAVE_OPEN64)
+if(NOT HAVE_OPEN64)
+	add_compile_definitions(open64=open readdir64=readdir dirent64=dirent)
+endif()
+
+# Check if struct stat has st_mtim.
+check_struct_has_member(
+	"struct stat" "st_mtim.tv_sec" "sys/stat.h" HAVE_ST_MTIM
+)
+
+option(WITH_LIBEDIT "Compile with libedit support")
+if(WITH_LIBEDIT)
+	check_include_file("histedit.h" HAVE_HISTEDIT_H)
+	check_library_exists(edit history_init /usr/lib LIBEDIT_FOUND)
+	if(HAVE_HISTEDIT_H AND LIBEDIT_FOUND)
+		link_libraries(edit)
+	else()
+		message(SEND_ERROR "Can't find libedit.")
+	endif()
+else()
+	add_compile_definitions(SMALL)
+endif()
+
+option(WITH_LINENO "Enable LINENO support" ON)
+
+configure_file(config.h.in config.h)
+
+add_subdirectory(src)
diff --git a/Makefile.am b/Makefile.am
deleted file mode 100644
index af437a6..0000000
--- a/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-SUBDIRS = src
diff --git a/autogen.sh b/autogen.sh
deleted file mode 100755
index 9879c53..0000000
--- a/autogen.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-aclocal \
-&& autoheader \
-&& automake --add-missing \
-&& autoconf
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..382ad35
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,24 @@
+#cmakedefine HAVE_ALIAS_ATTRIBUTE
+#cmakedefine01 HAVE_ALLOCA_H
+#cmakedefine01 HAVE_PATHS_H
+#cmakedefine01 HAVE_DECL_ISBLANK
+#cmakedefine HAVE_BSEARCH
+#cmakedefine HAVE_FACCESSAT
+#cmakedefine HAVE_GETPWNAM
+#cmakedefine HAVE_GETRLIMIT
+#cmakedefine HAVE_ISALPHA
+#cmakedefine HAVE_KILLPG
+#cmakedefine HAVE_MEMCPY
+#cmakedefine HAVE_SIGSETMASK
+#cmakedefine HAVE_STPCPY
+#cmakedefine HAVE_STRCHRNUL
+#cmakedefine HAVE_STRSIGNAL
+#cmakedefine HAVE_STRTOD
+#cmakedefine HAVE_STRTOIMAX
+#cmakedefine HAVE_STRTOUMAX
+#cmakedefine HAVE_SYSCONF
+#cmakedefine HAVE_TRADITIONAL_FACCESSET
+#cmakedefine HAVE_FNMATCH
+#cmakedefine HAVE_GLOB
+#cmakedefine HAVE_ST_MTIM
+#cmakedefine WITH_LINENO
diff --git a/configure.ac b/configure.ac
deleted file mode 100644
index 2a31251..0000000
--- a/configure.ac
+++ /dev/null
@@ -1,191 +0,0 @@
-AC_INIT([dash],[0.5.11.5])
-AM_INIT_AUTOMAKE([foreign subdir-objects])
-AC_CONFIG_SRCDIR([src/main.c])
-
-AC_CONFIG_HEADERS(config.h)
-
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
-
-dnl Checks for programs.
-AC_PROG_CC
-AC_USE_SYSTEM_EXTENSIONS
-
-AC_MSG_CHECKING([for build system compiler])
-if test "$cross_compiling" = yes; then
-	CC_FOR_BUILD=${CC_FOR_BUILD-cc}
-else
-	CC_FOR_BUILD=${CC}
-fi
-AC_MSG_RESULT(${CC_FOR_BUILD})
-AC_SUBST(CC_FOR_BUILD)
-
-AC_MSG_CHECKING([for __attribute__((__alias__()))])
-dash_cv_have_attribute_alias=no
-AC_LINK_IFELSE([AC_LANG_PROGRAM([void t() {}
-                                 void a() __attribute__((__alias__("t")));],
-                                [a();])],
-               [dash_cv_have_attribute_alias=yes])
-AC_MSG_RESULT($dash_cv_have_attribute_alias)
-if test "x$dash_cv_have_attribute_alias" = xyes; then
-  AC_DEFINE([HAVE_ALIAS_ATTRIBUTE], 1,
-            [Define if __attribute__((__alias__())) is supported])
-fi
-
-AC_ARG_ENABLE(static, AS_HELP_STRING(--enable-static, \
-				     [Build statical linked program]))
-if test "$enable_static" = "yes"; then
-	export LDFLAGS="-static -Wl,--fatal-warnings"
-fi
-
-AC_ARG_ENABLE(fnmatch, AS_HELP_STRING(--enable-fnmatch, \
-				      [Use fnmatch(3) from libc]))
-AC_ARG_ENABLE(glob, AS_HELP_STRING(--enable-glob, [Use glob(3) from libc]))
-
-dnl Checks for libraries.
-
-dnl Checks for header files.
-AC_CHECK_HEADERS(alloca.h paths.h)
-
-dnl Check for declarations
-AC_CHECK_DECL([_PATH_BSHELL],,AC_DEFINE_UNQUOTED([_PATH_BSHELL], "/bin/sh", [Define to system shell path]),[
-#ifdef HAVE_PATHS_H
-#include <paths.h>
-#endif
-])
-AC_CHECK_DECL([_PATH_DEVNULL],,AC_DEFINE_UNQUOTED([_PATH_DEVNULL], "/dev/null", [Define to devnull device node path]),[
-#ifdef HAVE_PATHS_H
-#include <paths.h>
-#endif
-])
-AC_CHECK_DECL([_PATH_TTY],,AC_DEFINE_UNQUOTED([_PATH_TTY], "/dev/tty", [Define to tty device node path]),[
-#ifdef HAVE_PATHS_H
-#include <paths.h>
-#endif
-])
-
-dnl Some systems lack isblank
-AC_CHECK_DECLS([isblank],,,[#include <ctype.h>])
-
-dnl Check for sizes of types
-AC_CHECK_SIZEOF([intmax_t])
-AC_CHECK_SIZEOF([long long int])
-
-dnl Select a fallback format string for intmax_t in case we don't find PRIdMAX
-if test "x$ac_cv_sizeof_intmax_t" = "x$ac_cv_sizeof_long_long_int"; then
-  intmax_fstr="lld"
-else
-  intmax_fstr="jd"
-fi
-
-dnl Check for PRIdMAX and define it to a fallback if not found
-AC_CHECK_DECL([PRIdMAX],,
-	[AC_DEFINE_UNQUOTED([PRIdMAX], "$intmax_fstr",
-				       [Define to printf format string for intmax_t])],
-        [
-#include <inttypes.h>
-])
-
-dnl Checks for library functions.
-AC_CHECK_FUNCS(bsearch faccessat getpwnam getrlimit isalpha killpg \
-	       mempcpy \
-	       sigsetmask stpcpy strchrnul strsignal strtod strtoimax \
-	       strtoumax sysconf)
-
-dnl Check whether it's worth working around FreeBSD PR kern/125009.
-dnl The traditional behavior of access/faccessat is crazy, but
-dnl POSIX.1-2008 explicitly allows those functions to misbehave.
-dnl
-dnl Unaffected kernels:
-dnl
-dnl - all versions of Linux
-dnl - NetBSD sys/kern/vfs_subr.c 1.64, 1997-04-23
-dnl - FreeBSD 9 (r212002), 2010-09-10
-dnl - OpenBSD sys/kern/vfs_subr.c 1.166, 2008-06-09
-dnl
-dnl Also worked around in Debian's libc0.1 2.13-19 when using
-dnl kFreeBSD 8.
-
-AC_ARG_ENABLE(test-workaround, AS_HELP_STRING(--enable-test-workaround, \
-	[Guard against faccessat(2) that tells root all files are executable]),,
-	[enable_test_workaround=auto])
-
-if test "enable_test_workaround" = "auto" &&
-   test "$ac_cv_func_faccessat" = yes; then
-	case `uname -s 2>/dev/null` in
-	GNU/kFreeBSD | \
-	FreeBSD)
-		enable_test_workaround=yes
-	esac
-fi
-if test "$enable_test_workaround" = "yes"; then
-	AC_DEFINE([HAVE_TRADITIONAL_FACCESSAT], [1],
-		[Define if your faccessat tells root all files are executable])
-fi
-
-if test "$enable_fnmatch" = yes; then
-	use_fnmatch=
-	AC_CHECK_FUNCS(fnmatch, use_fnmatch=yes)
-fi
-
-if test "$use_fnmatch" = yes && test "$enable_glob" = yes; then
-	AC_CHECK_FUNCS(glob)
-fi
-
-dnl Check for klibc signal.
-AC_CHECK_FUNC(signal)
-if test "$ac_cv_func_signal" != yes; then
-	AC_CHECK_FUNC(bsd_signal,
-		      [AC_DEFINE(signal, bsd_signal,
-				 [klibc has bsd_signal instead of signal])])
-fi
-
-dnl Check for stat64 (dietlibc/klibc).
-AC_CHECK_FUNC(stat64,, [
-	AC_DEFINE(fstat64, fstat, [64-bit operations are the same as 32-bit])
-	AC_DEFINE(lstat64, lstat, [64-bit operations are the same as 32-bit])
-	AC_DEFINE(stat64, stat, [64-bit operations are the same as 32-bit])
-])
-
-dnl OS X apparently has stat64 but not open64.
-AC_CHECK_FUNC(open64,, [
-	AC_DEFINE(open64, open, [64-bit operations are the same as 32-bit])
-	AC_DEFINE(readdir64, readdir,
-		  [64-bit operations are the same as 32-bit])
-	AC_DEFINE(dirent64, dirent,
-		  [64-bit operations are the same as 32-bit])
-])
-
-dnl Check if struct stat has st_mtim.
-AC_MSG_CHECKING(for stat::st_mtim)
-AC_COMPILE_IFELSE(
-[AC_LANG_PROGRAM([#include <time.h>
-#include <sys/time.h>
-#include <sys/stat.h>],
-[struct stat foo; return sizeof(foo.st_mtim.tv_sec)])],
-have_st_mtim=yes, have_st_mtim=no)
-AC_MSG_RESULT($have_st_mtim)
-if test "$have_st_mtim" = "yes"; then
-	AC_DEFINE([HAVE_ST_MTIM], [1],
-		[Define if your `struct stat' has `st_mtim'])
-fi
-
-AC_ARG_WITH(libedit, AS_HELP_STRING(--with-libedit, [Compile with libedit support]))
-use_libedit=
-if test "$with_libedit" = "yes"; then
-	AC_CHECK_LIB(edit, history_init, [
-		AC_CHECK_HEADER([histedit.h], [use_libedit="yes"],
-				AC_MSG_ERROR(
-					[Can't find required header files.]))])
-fi
-if test "$use_libedit" != "yes"; then
-	AC_DEFINE([SMALL], 1, [Define if you build with -DSMALL])
-else
-	export LIBS="$LIBS -ledit"
-fi
-AC_ARG_ENABLE(lineno, AS_HELP_STRING(--disable-lineno, \
-				     [Disable LINENO support]))
-if test "$enable_lineno" != "no"; then
-	AC_DEFINE([WITH_LINENO], 1, [Define if you build with -DWITH_LINENO])
-fi
-AC_CONFIG_FILES([Makefile src/Makefile])
-AC_OUTPUT
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 $@ $<