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
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)
$(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
}
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)
{