fix: added header guards, and some testing purpose autotools rules

This commit is contained in:
Guillem George 2026-01-07 20:18:11 +01:00
parent 269f50a367
commit 919ea7b1ba
9 changed files with 88 additions and 14 deletions

View file

@ -1,25 +1,46 @@
# define the subdirectories
SUBDIRS = \
ast \
parser \
lexer \
io_backend \
execution \
expansion
# + utils if needed
ast \
parser \
lexer \
io_backend \
execution \
expansin \
utils
bin_PROGRAMS = 42sh
42sh_SOURCES = 42sh.c
42sh_SOURCES = main.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
ast/libast.a \
parser/libparser.a \
lexer/liblexer.a \
io_backend/libio_backend.a \
expansion/libexpansion.a \
execution/libexecution.a \
utils/libutils.a
################################################# Test
bin_PROGRAMS = 42sh_asan
42sh_asan_SOURCES = main.c
42sh_asan_CPPFLAGS = -I%D%
42sh_asan_CFLAGS = -std=c99 -pedantic -Werror -Wall -Wextra -Wvla -g -fsanitize=address
42sh_asan_LDADD = \
ast/libast.a \
parser/libparser.a \
lexer/liblexer.a \
io_backend/libio_backend.a \
expansion/libexpansion.a \
execution/libexecution.a \
utils/libutils.a

View file

@ -0,0 +1,22 @@
#ifndef AST_H
#define AST_H
enum ast_type
{
AST_NULL = 0,
ATS_IF,
AST_CMD
};
union ast_union
{
};
struct ast
{
enum ast_type type;
union ast_union data;
};
#endif /* ! AST_H */

View file

@ -0,0 +1,4 @@
#ifndef EXECUTION_H
#define EXECUTION_H
#endif /* ! EXECUTION_H */

View file

@ -0,0 +1,4 @@
#ifndef EXPANSION_H
#define EXPANSION_H
#endif /* ! EXPANSION_H */

View file

@ -0,0 +1,4 @@
#ifndef IO_BACKEND_H
#define IO_BACKEND_H
#endif /* ! IO_BACKEND_H */

View file

@ -0,0 +1,4 @@
#ifndef LEXER_H
#define LEXER_H
#endif /* ! LEXER_H */

View file

@ -0,0 +1,4 @@
#ifndef PARSER_H
#define PARSER_H
#endif /* ! PARSER_H */

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

@ -0,0 +1,11 @@
lib_LIBRARIES = libutils.a
# libutils_a_SOURCES = \
# utils.c \
# utils.h
# libutils_a_CPPFLAGS = -I$(top_srcdir)/src
# libutils_a_CFLAGS = -std=c99 -pedantic -Werror -Wall -Wextra -Wvla
# noinst_LIBRARIES = libutils.a