-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (32 loc) · 912 Bytes
/
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
NAME = minishell
TMP = tmp
SRCS = $(wildcard ./srcs/*.c)
OBJS = $(patsubst ./srcs/%.c, ./$(TMP)/%.o, $(SRCS))
CC = cc
CFALGS = -Wall -Wextra -Werror
LIB = ./libs
LIBFT = $(LIB)/libft
UNIX_NAME = $(shell uname -s)
ifeq ($(UNIX_NAME),Darwin)
LINKERS = -lft -L$(LIBFT) -lreadline -L $(HOME)/readline/lib
else ifeq ($(UNIX_NAME),Linux)
LINKERS = -lft -L$(LIBFT) -lreadline -ltinfo -L $(HOME)/readline/lib
endif
INCLUDES = -I ./includes -I $(HOME)/readline/include
RM = rm -rf
.PHONY: all clean fclean re
./tmp/%.o: ./srcs/%.c ./includes/minishell.h
@$(CC) $(CFALGS) $(INCLUDES) -o $@ -c $<
all: $(NAME)
$(TMP):
@mkdir $(TMP)
$(NAME): $(TMP) $(OBJS)
@$(MAKE) -C $(LIBFT) all
@$(CC) $(CFLAGS) $(INCLUDES) $(OBJS) $(LINKERS) -o $(NAME)
clean:
@$(MAKE) -C $(LIBFT) clean
@$(RM) $(TMP)
fclean: clean
@$(MAKE) -C $(LIBFT) fclean
@$(RM) $(NAME)
re: fclean all