-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
94 lines (74 loc) · 2.71 KB
/
Makefile
File metadata and controls
94 lines (74 loc) · 2.71 KB
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: snicolet <snicolet@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2015/08/17 10:20:32 by snicolet #+# #+# #
#* Updated: 2018/05/04 18:51:59 by snicolet ### ########.fr *#
# #
# **************************************************************************** #
EXTRA_FLAGS=-pipe -Ofast -g3
FLAGS=-Wall -Werror -Wextra -Wno-unused-result -Wno-reserved-id-macro
#CC=clang
ifeq ($(CC),clang)
EXTRA_FLAGS+=-Weverything
else
FLAGS += -Wno-strict-aliasing
endif
COMPILE=$(CC) $(FLAGS) -I. $(EXTRA_FLAGS)
RANLIB=ranlib
AR=ar
LIBSO=libtga.so
NAME=libtga.a
INC=-Iincludes -I../libft/include -I /usr/local/include/ -I$(HOME)/.brew/include
OBJ=tga.o tga_display.o tga_save.o tga_load_ogl.o
################################################################################
## ##
## COMPILATION RULES : DONT TOUCH: IT'S MAGIC ##
## ##
################################################################################
OBJBUILDDIR=./build
ALLDIR=$(OBJBUILDDIR)/srcs
# all .obj listed with directories
ALLOBJ=$(OBJ:%.o=$(OBJBUILDDIR)/srcs/%.o)
# all .c files listes with directories
ALLSRC=$(OBJ:%.o=srcs/%.c)
all: $(NAME)
alldir: $(ALLDIR)
$(ALLDIR):
mkdir -p $@
test:
@echo $(ALLSRC)
@echo $(ALLOBJ)
%.c:
$(NAME): $(ALLDIR) $(ALLOBJ)
#@$(MAKE) $(ALLOBJ) | grep "$(COMPILE)"
$(AR) rc $(NAME) $(ALLOBJ)
$(RANLIB) $(NAME)
$(OBJBUILDDIR)/%.o: %.c
$(COMPILE) -c $< -o $@ $(INC)
#windows dll cross compill rule
dll:
make COMPILER="mingw32-gcc" AR="mingw32-ar" RANLIB="mingw32-ranlib" \
NAME="libtga.dll"
#linker for libft.so
$(LIBSO): $(ALLDIR) $(ALLOBJ)
$(COMPILE) -shared $(ALLOBJ) -o $(LIBSO)
so:
make FLAGS="-fPIC $(FLAGS)" $(LIBSO)
#cleaners
mrproper: fclean
find . -name ".*.swp" -print -delete
find . -name "\#*\#" -print -delete
clean:
rm -rf $(OBJBUILDDIR)
fclean: clean
$(RM) $(NAME) $(LIBSO)
re: fclean
$(MAKE)
# normal rule
#.PHONY: norminette so dll re all clean install
# 42file f***ing checker rule
.PHONY: re all clean fclean