From 454fafd2329461a65656b00e6c878fc0392a47ac Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Ji=C5=99i=C5=A1t=C4=9B?= Date: Sun, 15 Dec 2024 08:30:30 +0100 Subject: [PATCH] Update Libft and Makefile --- .gitignore | 1 + Libft | 2 +- Makefile | 40 ++++++++++++++++++++++++++++++---------- src/main.c | 2 +- 4 files changed, 33 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index b4d162e..a1fa47d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ FET_sim *.[oa] *.swp +.debug diff --git a/Libft b/Libft index 0c6fb94..62f583c 160000 --- a/Libft +++ b/Libft @@ -1 +1 @@ -Subproject commit 0c6fb946da0bd3d8a0a15e4686020b3e103cdede +Subproject commit 62f583c8ab43754b5265c708243f3f5353ebfa1e diff --git a/Makefile b/Makefile index d5e8252..1e65f98 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,10 @@ CC := gcc -CFLAGS = -std=c99 -Wall -Wextra -Werror -Wpedantic +CFLAGS := -std=c99 -Wall -Wextra -Werror -Wpedantic +LDFLAGS := -L Libft -lft + +ifneq ("$(wildcard .debug)","") + CFLAGS += -g +endif RM := rm -f @@ -39,18 +44,26 @@ NAME := FET_sim all : $(NAME) -debug : CFLAGS += -g -debug : $(NAME) +debug : .debug + $(MAKE) -C Libft debug + $(MAKE) all + +nodebug : + $(MAKE) -C Libft nodebug + $(RM) .debug + $(MAKE) shallow_re -$(NAME) : $(OBJECTS) Libft/libft.a - $(CC) $(CFLAGS) -o $@ $^ +.% : + $(MAKE) shallow_fclean + touch $@ -Libft/libft.a : | Libft/Makefile -ifneq (,$(findstring debug, $(MAKECMDGOALS))) - $(MAKE) -C Libft debug -else +FORCE : ; + +Libft/libft.a : FORCE $(MAKE) -C Libft -endif + +$(NAME) : $(OBJECTS) Libft/libft.a + $(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS) %.o : %.c | Libft/Makefile $(CC) $(CFLAGS) -o $@ -c $< $(INCLUDE) @@ -62,7 +75,14 @@ clean : $(RM) $(OBJECTS) fclean : clean + $(MAKE) -C Libft fclean $(RM) $(NAME) re : fclean $(MAKE) all + +shallow_fclean : clean + $(RM) $(NAME) + +shallow_re : shallow_fclean + $(MAKE) all diff --git a/src/main.c b/src/main.c index 769e87f..bfcdeb4 100644 --- a/src/main.c +++ b/src/main.c @@ -233,7 +233,7 @@ int get_input(t_input *input, int fd) } if (str_inp[0] && str_inp[ft_strlen(str_inp) - 1] == '\n') str_inp[ft_strlen(str_inp) - 1] = '\0'; - split_inp = ft_split(str_inp, ' '); + split_inp = ft_split(str_inp, " "); res = construct_input(input, split_inp); if (!res) { -- 2.30.2