-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·64 lines (54 loc) · 1.91 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: cdeniau <cdeniau@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2014/12/11 12:00:21 by cdeniau #+# #+# #
# Updated: 2015/09/23 15:23:16 by cdeniau ### ########.fr #
# #
# **************************************************************************** #
ifeq ($(HOSTTYPE),)
HOSTTYPE := $(shell uname -m)_$(shell uname -s)
endif
NAME = libft_malloc_$(HOSTTYPE).so
LS = libft_malloc.so
CC = gcc
CFLAGS = -Wall -Werror -Wextra
SRCDIR = ./sources/
SRCO = $(SRC:.c=.o)
ODIR = ./includes/
LIB = ./libft/libft.a
INC = -I./includes -I./libft/includes
LINK = -Llibft -lft
SRC = ft_atoi_hex.c \
malloc.c \
ft_free.c \
ft_realloc.c \
ft_print.c \
tiny.c \
small.c \
large.c \
header.c \
ptr_op.c
OBJ = $(SRC:.c=.o)
OBJS = $(addprefix $(ODIR), $(OBJ))
all : $(LIB) $(NAME)
$(NAME) : $(OBJS)
$(CC) -shared -o $(NAME) $^ $(LINK)
ln -s $(NAME) $(LS)
$(ODIR)%.o : $(SRCDIR)%.c
mkdir -p $(ODIR)
$(CC) $(CFLAGS) -c $^ $(INC) -o $@
$(LIB) :
@make -C libft
clean :
/bin/rm -f $(addprefix $(ODIR), $(OBJ))
make -C ./libft clean
fclean : clean
/bin/rm -rf $(LS)
make -C ./libft fclean
/bin/rm -rf $(NAME)
/bin/rm -rf test
re : fclean all