forked from Tastyep/malloc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (38 loc) · 919 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
49
50
51
52
53
54
55
##
## Makefile for Malloc in /home/fillon_g/projects/tek2/unix/malloc
##
## Made by guillaume fillon
## Login <[email protected]>
##
## Started on Fri Jan 31 14:24:48 2014 guillaume fillon
## Last update Sun Feb 16 12:30:38 2014 luc sinet
##
NAME = libmy_malloc_$(HOSTTYPE).so
LINK = libmy_malloc.so
CC = gcc
SRCDIR = src/
SRC = malloc.c \
free.c \
calloc.c \
realloc.c \
show_alloc_mem.c \
thread.c \
RM = rm -f
OBJDIR = obj/
OBJ = $(addprefix $(OBJDIR), $(SRC:.c=.o))
CFLAGS += -W -Wall -Wextra -Werror -fPIC
LDFLAGS += -shared -fPIC -lpthread
dummy := $(shell test -d $(OBJDIR) || mkdir $(OBJDIR))
$(OBJDIR)%.o: $(SRCDIR)%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(NAME): $(OBJ)
$(CC) -o $(NAME) $(LDFLAGS) $(OBJ)
ln -sf $(NAME) $(LINK)
all: $(NAME)
clean:
$(RM) $(OBJ)
fclean: clean
$(RM) $(LINK)
$(RM) $(NAME)
re: fclean all
.PHONY: all clean fclean re