feat(autotools): basic usage

This commit is contained in:
Matteo Flebus 2026-01-07 17:38:54 +01:00
parent ec9a168764
commit 269f50a367
24 changed files with 133 additions and 1 deletions

1
Makefile.am Normal file
View file

@ -0,0 +1 @@
SUBDIRS = src

View file

@ -24,3 +24,8 @@ TODO
## Project status ## Project status
WIP WIP
## TODO
# Autotools
implement functions in all .c files to see if everything compiles.

30
configure.ac Normal file
View file

@ -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

View file

@ -1 +0,0 @@
This is a git test.

6
src/42sh.c Normal file
View file

@ -0,0 +1,6 @@
// all includes
int main(int argc, char **argv)
{
return 0;
}

25
src/Makefile.am Normal file
View file

@ -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

11
src/ast/Makefile.am Normal file
View file

@ -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

0
src/ast/ast.c Normal file
View file

0
src/ast/ast.h Normal file
View file

11
src/execution/Makefile.am Normal file
View file

@ -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

View file

View file

11
src/expansion/Makefile.am Normal file
View file

@ -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

View file

View file

View file

@ -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

View file

View file

11
src/lexer/Makefile.am Normal file
View file

@ -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

0
src/lexer/lexer.c Normal file
View file

0
src/lexer/lexer.h Normal file
View file

11
src/parser/Makefile.am Normal file
View file

@ -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

0
src/parser/parser.c Normal file
View file

0
src/parser/parser.h Normal file
View file