-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
94 lines (80 loc) · 2.93 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
86
87
88
89
90
91
92
93
94
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: vmormont <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/11/08 12:44:34 by cormund #+# #+# #
# Updated: 2019/12/14 20:15:01 by vmormont ### ########.fr #
# #
# **************************************************************************** #
NAME := lem-in
VISUAL := visual
LIBFT := libft.a
HEADERS := libft.h lem_in.h li_visualizer.h SDL.h SDL2_gfxPrimitives.h
CC := clang
CFLAGS := -Wall -Wextra -Werror -O3 -g
REMOVE := /bin/rm -rf
DIR_BIN := bin
DIR_INCLUDE := -I include
DIR_LIBS := src/libs
DIR_LIBFT := $(DIR_LIBS)/libft
DIR_SRC := src/$(NAME) src/visualizer
DIR_SDLLIBS := $(DIR_LIBS)/libSDL2
DIR_INCLUDE_SDL := -I $(DIR_SDLLIBS)/SDL2.framework/Headers -I $(DIR_SDLLIBS)/SDL2_gfx/include
SDL_LIBS := -Wl,-rpath,$(DIR_SDLLIBS) -F $(DIR_SDLLIBS) -framework SDL2
SDL2_GFX := $(DIR_SDLLIBS)/SDL2_gfx/lib/libSDL2_gfx.a
vpath %.c $(DIR_SRC)
vpath %.o $(DIR_BIN)/$(NAME) $(DIR_BIN)/$(VISUAL)
vpath %.h $(DIR_INCLUDE) $(DIR_INCLUDE_SDL)
vpath %.a $(DIR_LIBFT) $(SDL2_GFX)
SRC_NAME := lem_in.c\
read_input.c\
parsing.c\
adjacencies.c\
suurballe.c\
bfs.c\
queue.c\
check_paths.c\
validation.c\
push_ants.c\
bonus.c\
hash_table.c\
find_paths.c\
get_count_steps_and_ants.c\
clear.c\
help.c\
vertex.c
SRC_VIS := visualization.c\
background.c\
collection_steps.c\
loop.c\
rendering.c\
collect_paths.c\
next_step.c\
collect_ant_move.c
OBJ_NAME := $(SRC_NAME:.c=.o)
OBJ_VIS := $(SRC_VIS:.c=.o)
all: $(NAME)
$(NAME): $(LIBFT) $(OBJ_NAME) $(OBJ_VIS)
@$(CC) $(CFLAGS) $(addprefix $(DIR_BIN)/, $(addprefix $(NAME)/, $(OBJ_NAME)) $(addprefix $(VISUAL)/, $(OBJ_VIS))) -lft -L $(DIR_LIBFT) $(SDL_LIBS) $(SDL2_GFX) -o $@
@printf "\r\e[J\e[32m$@\e[0m done!\n\e[?25h"
$(OBJ_NAME): %.o: %.c $(HEADERS)
@mkdir -p $(DIR_BIN)/$(NAME)
@$(CC) $(CFLAGS) -c $< $(DIR_INCLUDE) $(DIR_INCLUDE_SDL) -o $(DIR_BIN)/$(NAME)/$@
@printf "\r\e[?25l\e[Jcompiling \e[32m$(notdir $<)\e[0m"
$(OBJ_VIS): %.o: %.c $(HEADERS)
@mkdir -p $(DIR_BIN)/$(VISUAL)
@$(CC) $(CFLAGS) -c $< $(DIR_INCLUDE) $(DIR_INCLUDE_SDL) -o $(DIR_BIN)/$(VISUAL)/$@
@printf "\r\e[?25l\e[Jcompiling \e[32m$(notdir $<)\e[0m"
$(LIBFT):
@$(MAKE) -C $(DIR_LIBFT)
@$(MAKE) -C $(DIR_LIBFT) clean
clean:
@rm -rf $(DIR_BIN)
@$(MAKE) -C $(DIR_LIBFT) fclean
fclean: clean
@$(REMOVE) $(NAME)
@$(REMOVE) $(PUSH_SWAP)
re: fclean all