-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
92 lines (72 loc) · 2.95 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: jgranet <jgranet@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2014/02/08 16:48:39 by jgranet #+# #+# #
# Updated: 2014/06/22 14:54:45 by mlemort ### ########.fr #
# #
# **************************************************************************** #
NAME_SER = serveur
NAME_GFX = gfx_bin
INC_DIR = ./includes
SRC_DIR_SER = ./srcs/serveur
OBJ_DIR_SER = ./objs/serveur
SRC_DIR_GFX = ./srcs/gfx
OBJ_DIR_GFX = ./objs/gfx
BIN_DIR = ./bin/
LIBFT = libft
LIB_NAME = libft/libft.a
SDL2 = SDL2-2.0.3/build/.libs/libSDL2.a
PHP = php-5.5.13/sapi/cli/php
UNITS_SER = $(shell ls $(SRC_DIR_SER) | grep .c)
UNITS_O_SER = $(UNITS_SER:.c=.o)
UNITS_GFX = $(shell ls $(SRC_DIR_GFX) | grep .c)
UNITS_O_GFX = $(UNITS_GFX:.c=.o)
UNITS_H = $(shell ls $(INC_DIR) | grep .h)
SRCS_SER = $(patsubst %,$(SRC_DIR_SER)/%,$(UNITS_SER))
OBJS_SER = $(patsubst %,$(OBJ_DIR_SER)/%,$(UNITS_O_SER))
SRCS_GFX = $(patsubst %,$(SRC_DIR_GFX)/%,$(UNITS_GFX))
OBJS_GFX = $(patsubst %,$(OBJ_DIR_GFX)/%,$(UNITS_O_GFX))
LIBFLAGS = -L$(LIBFT) -lft
FLAGS = -Wall -Werror -Wextra -O1 -I libft/includes -I SDL2-2.0.3/include
CC = gcc $(FLAGS)
RM = /bin/rm -f
all: $(SDL2) $(PHP) $(LIB_NAME) $(BIN_DIR)$(NAME_SER) $(BIN_DIR)$(NAME_GFX)
$(PHP):
cd php-5.5.13 && ./configure CC=clang --enable-sockets --enable-pcntl \
--with-config-file-path=./ && make
$(SDL2):
cd SDL2-2.0.3 && ./configure CC=clang && make
$(LIB_NAME):
@make -C $(LIBFT)
$(BIN_DIR)$(NAME_SER): $(OBJS_SER) $(LIB_NAME)
@echo "Objects [$(NAME_SER)]:\033[1;33m DONE !\033[m"
@$(CC) -o $@ $^ $(LIBFLAGS)
@echo "Program [$(NAME_SER)] :\033[1;33m DONE !\033[m"
$(OBJ_DIR_SER)/%.o: $(SRC_DIR_SER)/%.c ./includes/serveur.h
@$(CC) -c -o $@ $< -I$(INC_DIR)
$(BIN_DIR)$(NAME_GFX): $(OBJS_GFX) $(LIB_NAME)
@echo "Objects [$(NAME_GFX)]:\033[1;33m DONE !\033[m"
@$(CC) -o $@ $^ $(LIBFLAGS) -L SDL2-2.0.3/build/.libs -l SDL2
@echo "Program [$(NAME_GFX)] :\033[1;33m DONE !\033[m"
$(OBJ_DIR_GFX)/%.o: $(SRC_DIR_GFX)/%.c ./includes/graphic.h
@$(CC) -c -o $@ $< -I$(INC_DIR)
clean:
@make -C libft clean
@$(RM) $(OBJS_SER)
@$(RM) $(OBJS_GFX)
@echo "Make clean :\033[1;33m DONE !\033[m"
fclean : clean
@make -C libft fclean
@$(RM) $(BIN_DIR)$(NAME_SER)
@$(RM) $(BIN_DIR)$(NAME_GFX)
@echo "Make fclean :\033[1;33m DONE !\033[m"
phpfc :
@make -C php-5.5.13 clean
sdlfc :
@make -C SDL2-2.0.3 clean
re: fclean all
.PHONY: all clean fclean re