mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
54 lines
973 B
Makefile
54 lines
973 B
Makefile
NAME = minishell
|
|
DEBUG = -g
|
|
ASAN = -fsanitize=address
|
|
TSAN = -fsanitize=thread
|
|
UBSAN = -fsanitize=undefined
|
|
LDLIBS = \
|
|
-lreadline \
|
|
|
|
ifeq ($(CFLAGS),)
|
|
CFLAGS = -Wall -Wextra -Werror $(DEBUG)
|
|
endif
|
|
export CFLAGS
|
|
srcs = \
|
|
|
|
objs = $(srcs:.c=.o)
|
|
minishell_objs = $(addsuffix .o,src/$(NAME)) $(objs)
|
|
all_objs = $(minishell_objs)
|
|
deps = $(all_objs:.o=.d)
|
|
|
|
.PHONY: all clean fclean re norm tests
|
|
|
|
all: $(NAME)
|
|
|
|
-include $(deps)
|
|
|
|
$(NAME): $(minishell_objs)
|
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(minishell_objs) $(LDLIBS)
|
|
|
|
%.o: %.c
|
|
$(CC) -c $(CFLAGS) $(LDFLAGS) -o $*.o $*.c
|
|
$(CC) -MM $(CFLAGS) $(LDFLAGS) $*.c > $*.d
|
|
|
|
clean:
|
|
find . -name '*.o' -print -delete
|
|
find . -name '*.d' -print -delete
|
|
|
|
fclean: clean
|
|
rm -f $(NAME)
|
|
|
|
re:
|
|
+make fclean
|
|
+make all
|
|
|
|
norm:
|
|
norminette src | grep -v OK || true
|
|
|
|
tests:
|
|
+CFLAGS="$(CFLAGS) $(ASAN)" make re
|
|
shellspec
|
|
+CFLAGS="$(CFLAGS) $(UBSAN)" make re
|
|
shellspec
|
|
+CFLAGS="$(CFLAGS) $(TSAN)" make re
|
|
shellspec
|
|
@echo "All tests passed!"
|