0
0
This commit is contained in:
2021-08-24 20:55:48 +02:00
parent 175220f3f6
commit c629a99412
6 changed files with 39 additions and 38 deletions

View File

@@ -18,33 +18,33 @@
NAME = libft.a
SRCDIR = srcs
SRC = $(SRCDIR)/ft_putchar.c $(SRCDIR)/ft_swap.c $(SRCDIR)/ft_putstr.c $(SRCDIR)/ft_strlen.c $(SRCDIR)/ft_strcmp.c
OBJ = ${SRC:.c=.o}
SRC = ft_putchar.c \
ft_swap.c \
ft_putstr.c \
ft_strlen.c \
ft_strcmp.c
HDR = ft.h
INCLUDE = includes
HDRDIR = includes
HDR = $(HDRDIR)/ft.h
CC = gcc
CFLAGS = -Wall -Wextra -Werror
AR = ar
ARFLAGS = -cq
ARFLAGS = -rcs
RM = rm
RMFLAGS = -f
all: $(NAME)
$(NAME):
cd $(SRCDIR) && $(CC) $(CFLAGS) -I $(INCLUDE) -c $(SRC)
$(AR) $(ARFLAGS) $(NAME) $(SRCDIR)/*.o
.c.o:
$(CC) $(CFLAGS) -I $(HDRDIR) -c $< -o ${<:.c=.o}
$(NAME): $(OBJ)
$(AR) $(ARFLAGS) $@ $^
clean:
@/bin/rm -f **/*.o
$(RM) $(RMFLAGS) $(OBJ)
fclean: clean
@/bin/rm -f $(NAME)
$(RM) $(RMFLAGS) $(NAME)
re: fclean all

View File

@@ -14,12 +14,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
void ft_putchar(char c);
void ft_swap(int *a, int *b);
void ft_putstr(char *str);
int ft_strlen(char *str);
int ft_strcmp(char *s1, char *s2);
#include "ft.h"
int main(void)
{

View File

@@ -7,9 +7,9 @@ norminette -R CheckForbiddenSourceHeader {} \;
echo
make fclean
make
rm -f *.o
echo
echo $(basename $PWD):
gcc -Wall -Wextra -Werror -o a.out -L. -lft main.c
gcc -Wall -Wextra -Werror main.c -I includes -L . -lft -o a.out
./a.out "$@"
make fclean
rm -f a.out