diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..af437a6 --- /dev/null +++ b/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/README.md b/README.md index fc20ad4..87fe6e2 100644 --- a/README.md +++ b/README.md @@ -24,3 +24,8 @@ TODO ## Project status WIP + +## TODO + +# Autotools +implement functions in all .c files to see if everything compiles. diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..4a89a36 --- /dev/null +++ b/configure.ac @@ -0,0 +1,30 @@ +# Init the 42sh project +AC_INIT([42sh], [1.0], [matteo.flebus@epita.fr]) + +# Setup Automake +AM_INIT_AUTOMAKE([subdir-objects] [foreign]) + +# Pretty display of Makefile rules +AM_SILENT_RULES([yes]) + +# Enable ar for Makefile +AM_PROG_AR + +# Check if ranlib is available +AC_PROG_RANLIB + +# Check if a C compiler is available +AC_PROG_CC + +# Check if a compiler has this list of flags +# AX_COMPILER_FLAGS([], [], [], [-std=c99 -pedantic -Werror -Wall -Wextra -Wvla]) + +# List Makefiles in subdirectories +AC_CONFIG_FILES([ + Makefile + src/Makefile + src/ast/Makefile + src/parser/Makefile + src/lexer/Makefile + ]) +AC_OUTPUT diff --git a/git_test.txt b/git_test.txt deleted file mode 100644 index d625e48..0000000 --- a/git_test.txt +++ /dev/null @@ -1 +0,0 @@ -This is a git test. diff --git a/src/42sh.c b/src/42sh.c new file mode 100644 index 0000000..e05c6f6 --- /dev/null +++ b/src/42sh.c @@ -0,0 +1,6 @@ +// all includes + +int main(int argc, char **argv) +{ + return 0; +} diff --git a/src/Makefile.am b/src/Makefile.am new file mode 100644 index 0000000..564dfaa --- /dev/null +++ b/src/Makefile.am @@ -0,0 +1,25 @@ +# define the subdirectories +SUBDIRS = \ + ast \ + parser \ + lexer \ + io_backend \ + execution \ + expansion +# + utils if needed + +bin_PROGRAMS = 42sh + +42sh_SOURCES = 42sh.c + +42sh_CPPFLAGS = -I%D% + +42sh_CFLAGS = -std=c99 -pedantic -Werror -Wall -Wextra -Wvla + +42sh_LDADD = \ + ast/libast.a \ + parser/libparser.a \ + lexer/liblexer.a \ + io_backend/libio_backend.a \ + expansion/libexpansion.a \ + execution/libexecution.a diff --git a/src/ast/Makefile.am b/src/ast/Makefile.am new file mode 100644 index 0000000..9df484e --- /dev/null +++ b/src/ast/Makefile.am @@ -0,0 +1,11 @@ +lib_LIBRARIES = libast.a + +libast_a_SOURCES = \ + ast.c \ + ast.h + +libast_a_CPPFLAGS = -I$(top_srcdir)/src + +libast_a_CFLAGS = -std=c99 -pedantic -Werror -Wall -Wextra -Wvla + +noinst_LIBRARIES = libast.a diff --git a/src/ast/ast.c b/src/ast/ast.c new file mode 100644 index 0000000..e69de29 diff --git a/src/ast/ast.h b/src/ast/ast.h new file mode 100644 index 0000000..e69de29 diff --git a/src/execution/Makefile.am b/src/execution/Makefile.am new file mode 100644 index 0000000..f83e3ba --- /dev/null +++ b/src/execution/Makefile.am @@ -0,0 +1,11 @@ +lib_LIBRARIES = libexecution.a + +libexecution_a_SOURCES = \ + execution.c \ + execution.h + +libexecution_a_CPPFLAGS = -I$(top_srcdir)/src + +libexecution_a_CFLAGS = -std=c99 -pedantic -Werror -Wall -Wextra -Wvla + +noinst_LIBRARIES = libexecution.a diff --git a/src/execution/execution.c b/src/execution/execution.c new file mode 100644 index 0000000..e69de29 diff --git a/src/execution/execution.h b/src/execution/execution.h new file mode 100644 index 0000000..e69de29 diff --git a/src/expansion/Makefile.am b/src/expansion/Makefile.am new file mode 100644 index 0000000..5074622 --- /dev/null +++ b/src/expansion/Makefile.am @@ -0,0 +1,11 @@ +lib_LIBRARIES = libexpansion.a + +libexpansion_a_SOURCES = \ + expansion.c \ + expansion.h + +libexpansion_a_CPPFLAGS = -I$(top_srcdir)/src + +libexpansion_a_CFLAGS = -std=c99 -pedantic -Werror -Wall -Wextra -Wvla + +noinst_LIBRARIES = libexpansion.a diff --git a/src/expansion/expansion.c b/src/expansion/expansion.c new file mode 100644 index 0000000..e69de29 diff --git a/src/expansion/expansion.h b/src/expansion/expansion.h new file mode 100644 index 0000000..e69de29 diff --git a/src/io_backend/Makefile.am b/src/io_backend/Makefile.am new file mode 100644 index 0000000..7f056b2 --- /dev/null +++ b/src/io_backend/Makefile.am @@ -0,0 +1,11 @@ +lib_LIBRARIES = libio_backend.a + +libio_backend_a_SOURCES = \ + io_backend.c \ + io_backend.h + +libio_backend_a_CPPFLAGS = -I$(top_srcdir)/src + +libio_backend_a_CFLAGS = -std=c99 -pedantic -Werror -Wall -Wextra -Wvla + +noinst_LIBRARIES = libio_backend.a diff --git a/src/io_backend/io_backend.c b/src/io_backend/io_backend.c new file mode 100644 index 0000000..e69de29 diff --git a/src/io_backend/io_backend.h b/src/io_backend/io_backend.h new file mode 100644 index 0000000..e69de29 diff --git a/src/lexer/Makefile.am b/src/lexer/Makefile.am new file mode 100644 index 0000000..a113221 --- /dev/null +++ b/src/lexer/Makefile.am @@ -0,0 +1,11 @@ +lib_LIBRARIES = liblexer.a + +liblexer_a_SOURCES = \ + lexer.c \ + lexer.h + +liblexer_a_CPPFLAGS = -I$(top_srcdir)/src + +liblexer_a_CFLAGS = -std=c99 -pedantic -Werror -Wall -Wextra -Wvla + +noinst_LIBRARIES = liblexer.a diff --git a/src/lexer/lexer.c b/src/lexer/lexer.c new file mode 100644 index 0000000..e69de29 diff --git a/src/lexer/lexer.h b/src/lexer/lexer.h new file mode 100644 index 0000000..e69de29 diff --git a/src/parser/Makefile.am b/src/parser/Makefile.am new file mode 100644 index 0000000..51c8cb6 --- /dev/null +++ b/src/parser/Makefile.am @@ -0,0 +1,11 @@ +lib_LIBRARIES = libparser.a + +libparser_a_SOURCES = \ + parser.c \ + parser.h + +libparser_a_CPPFLAGS = -I$(top_srcdir)/src + +libparser_a_CFLAGS = -std=c99 -pedantic -Werror -Wall -Wextra -Wvla + +noinst_LIBRARIES = libparser.a diff --git a/src/parser/parser.c b/src/parser/parser.c new file mode 100644 index 0000000..e69de29 diff --git a/src/parser/parser.h b/src/parser/parser.h new file mode 100644 index 0000000..e69de29