-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (32 loc) · 810 Bytes
/
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
SRCS = $(wildcard src/*.c)
OBJS = $(SRCS:.c=.o)
DEPS = $(SRCS:.c=.d)
CC = cc
CFLAGS = -Wall -Wextra -Werror -MMD -fPIC -pthread
HOSTNAME := $(shell hostname)
ifdef DEV
CFLAGS += -g3
endif
ifeq ($(HOSTTYPE),)
HOSTTYPE := $(shell uname -m)_$(shell uname -s)
endif
LIBFT = libft/libft.a
NAME = libft_malloc_$(HOSTTYPE).so
all: $(NAME)
$(NAME): $(LIBFT) $(OBJS)
$(CC) $(CFLAGS) -shared -o $(NAME) $(OBJS) $(LIBFT)
ln -sf $(NAME) libft_malloc.so
clean:
rm -f $(OBJS) $(DEPS) test.d
fclean: clean
rm -f $(NAME) libft_malloc.so test
ffclean: fclean
make -C libft fclean
re: fclean all
rere: ffclean all
test: $(NAME)
$(CC) -g3 -Werror -Wall -Wextra -MMD -O0 -o test test.c -L. -lft_malloc -Wl,-rpath=.
$(LIBFT):
make -C libft
-include $(DEPS)
.PHONY: all clean fclean ffclean re rere test