-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
85 lines (67 loc) · 1.61 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
##
## EPITECH PROJECT, 2019
## PSU_minishell1_2019
## File description:
## Makefile
##
ECHO = /bin/echo -e
CURL = /bin/curl
ONLINE = /bin/nm-online
DEFAULT = "\033[00m"
GREEN = "\033[0;32m"
BGREEN = "\033[1;32m"
TEAL = "\033[1;36m"
ORANGE = "\e[1;33m"
RED = "\033[0;31m"
BRED = "\033[1;31m"
FLASH = "\e[5;30m"
BYELLOW = "\e[1;33m"
BMAGENTA = "\e[1;35m"
NAME = mysh
CC = gcc
RM = rm -f
SRCS = src/main.c \
src/interpret.c \
src/built_in.c \
src/globalfunc.c \
src/setenv.c \
src/error.c \
src/run_from_env.c \
src/cd_setenv.c \
src/signals.c
OBJS = $(SRCS:.c=.o)
LIB = lib/libmy.a
CFLAGS = -I ./include/
CFLAGS += -Wall -Wextra
CFLAGS += -L./lib -lmy
all: $(NAME)
$(NAME): binary_name $(LIB) $(OBJS)
@$(CC) $(OBJS) -o $(NAME) $(CFLAGS) && \
$(ECHO) $(BGREEN) "Build Complete !" $(DEFAULT) \
|| $(ECHO) $(FLASH) $(BRED) "Build Failed !" $(DEFAULT)
clean:
@make -C lib/my clean --no-print-directory
@$(RM) $(OBJS)
@$(ECHO) $(BMAGENTA) "clean" $(DEFAULT)
$(LIB):
@make -C lib/my --no-print-directory
@$(ECHO) $(BGREEN) "Lib Complete !\n"
fclean: clean
@make -C lib/my fclean --no-print-directory
@$(RM) $(NAME)
@$(ECHO) $(BMAGENTA) "fclean" $(DEFAULT)
re: fclean all
debug: CFLAGS += -g
debug: re
@$(ECHO) $(BRED) "Debug mode"
binary_name:
@$(ECHO) $(TEAL)
@$(ONLINE) -q -t 2 && \
$(CURL) http://artii.herokuapp.com/make?text=$(NAME) \
|| $(ECHO) -n $(TEAL) Building $(NAME)...
@$(ECHO) '\n'
.PHONY: all clean fclean re binary_name
.c.o:
@gcc $(CFLAGS) -c -o $@ $^ && $(ECHO) \
$(BGREEN)"[OK]"$(BYELLOW) `basename $^` $(DEFAULT) \
|| $(ECHO) $(BRED)"[ERROR]"$(BYELLOW) $< $(DEFAULT)