-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
68 lines (49 loc) · 1.78 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: ewallner <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2016/11/05 16:30:18 by ewallner #+# #+# #
# Updated: 2016/11/22 18:12:59 by ewallner ### ########.fr #
# #
# **************************************************************************** #
# alternative NAME
# NAME = libftprintf.a
NAME= ft_printftest
SRC= main.c ft_get_flags.c ft_initialize_vars.c ft_print_parsed_value.c \
ctostr.c ft_handler_o.c ft_handler_x.c ft_handler_upx.c ft_handler_u.c \
ft_handler_di.c
OBJ= $(addprefix $(OBJDIR),$(SRC:.c=.o))
CC= gcc
CFLAGS= -Wall -Wextra -Werror
LIBFT= ./libft/libft.a
LIBINC= -I./libft
LIBLINK= -L./libft -lft
SRCDIR= ./src/
INCDIR= ./includes/
OBJDIR= ./obj/
all: $(NAME)
obj:
mkdir -p $(OBJDIR)
$(OBJDIR)%.o:$(SRCDIR)%.c
$(CC) $(CFLAGS) $(LIBINC) -I $(INCDIR) -o $@ -c $<
libft: $(LIBFT)
$(LIBFT):
make -C ./libft
$(NAME): obj libft $(OBJ)
$(CC) $(LIBLINK) -o $(NAME) $(OBJ)
# alternative makefile to create libftprintf.a
# $(NAME): obj libft $(OBJ)
# $(CC) $(LIBLINK)
# ar rc $(NAME) $(OBJ)
remlib:
rm -rf $(LIBFT)
remoblib:
make fclean -C ./libft/
clean: remoblib
rm -rf $(OBJDIR)
fclean: clean remlib
rm -rf $(NAME)
re: fclean all