diff --git a/.ft_printf.c.swm b/.ft_printf.c.swm deleted file mode 100644 index 3a1571c..0000000 Binary files a/.ft_printf.c.swm and /dev/null differ diff --git a/.ft_printf.c.swn b/.ft_printf.c.swn deleted file mode 100644 index 8be9b75..0000000 Binary files a/.ft_printf.c.swn and /dev/null differ diff --git a/Makefile b/Makefile index c2418a4..ebb5279 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ # variables names # # - - - - - - - - - # -NAME = ft_printf +NAME = libftprintf.a CC = gcc VPATH = srcs @@ -30,22 +30,41 @@ LFLAGS = -L$(LDIR) -l$(LIBS) # rules to execute # # - - - - - - - - - - - # -all: $(ODIR) $(NAME) -$(NAME): $(OBJS) $(DEPS) - $(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS) +all: $(NAME) + +$(NAME): $(ODIR) $(OBJS) $(DEPS) + cp $(LDIR)$(_LIBS) ./ + mv $(_LIBS) $(NAME) + ar -rc $@ $(OBJS) + ranlib $@ + $(ODIR): mkdir -p $@ + $(ODIR)/%.o: %.c $(CC) $(CFLAGS) -c -o $@ $< + clean: /bin/rm -rf $(ODIR) + fclean: clean /bin/rm -f $(NAME) + re: fclean all + +# - - - - - - - - - - - # +# rules to test # +# with # +# main and libft # +# - - - - - - - - - - - # + lib: make -C $(LDIR) cleanlib: lib make fclean -C $(LDIR) -fsanitize: $(ODIR) $(OBJS) $(DEPS) - $(CC) $(CFLAGS) -o $(NAME) $(OBJS) $(LFLAGS) -fsanitize=address -.PHONY: all clean fclean re lib fsanitize +main: $(ODIR) $(OBJS) $(DEPS) + $(CC) $(CFLAGS) $(OBJS) $(LFLAGS) -fsanitize=address +mainfclean: fclean + /bin/rm -f out*.txt a.out + +.PHONY: all clean fclean re lib cleanlib main mainfclean diff --git a/ft_printf b/ft_printf deleted file mode 100755 index 574921d..0000000 Binary files a/ft_printf and /dev/null differ diff --git a/outf.txt b/outf.txt deleted file mode 100644 index 5c94524..0000000 --- a/outf.txt +++ /dev/null @@ -1 +0,0 @@ -33333 diff --git a/outft.txt b/outft.txt deleted file mode 100644 index 5c94524..0000000 --- a/outft.txt +++ /dev/null @@ -1 +0,0 @@ -33333 diff --git a/test.c b/test.c deleted file mode 100644 index 84735a8..0000000 --- a/test.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "ft_printf.h" -#include // for printf -#include // for dup() and dup2() - -//#define PRINT(string) \ -// dup2(out1, 1); \ -// ft_printf(string "\n"); \ -// dup2(out2, 1); \ -// ft_printf(string "\n"); \ -// dup2(save, 1); \ -// ft_printf(string "\n"); \ -// ft_printf(string "\n\n"); - -//#define PRINT(string) \ -// dup2(out1, 1); \ -// write(1, "printf :" string "\n", 14); \ -// dup2(out2, 1); \ -// write(1, "printf2:" string "\n", 14); \ -// dup2(save, 1); \ -// write(1, "printf :" string "\n", 14); \ -// write(1, "printf2:" string "\n\n", 15); \ - -#define PRINT(string) \ - dup2(out1, 1); \ - printf("printf :" string "\n"); \ - dup2(out2, 1); \ - ft_printf("printf2:" string "\n"); \ - dup2(save, 1); \ - printf("printf :" string "\n"); \ - ft_printf("printf2:" string "\n\n"); - -//#define PRINT(string) \ -// printf("printf :" string "\n"); \ -// ft_printf("printf2:" string "\n\n"); \ -// dup2(out1, 1); \ -// printf("printf :" string "\n"); \ -// dup2(out2, 1); \ -// ft_printf("printf2:" string "\n"); \ -// dup2(save, 1); - -int main(void) -{ - int out1 = open("out1.txt", O_WRONLY | O_TRUNC); - int out2 = open("out2.txt", O_WRONLY | O_TRUNC); - int save = dup(1); - - PRINT("test1"); - PRINT("test2"); - - close(out1); - close(out2); - close(save); - return (0); -}