-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (47 loc) · 1.11 KB
/
Makefile
File metadata and controls
60 lines (47 loc) · 1.11 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
# -*- coding: utf-8 -*-
# vim: ts=4 sw=4 tw=80 et ai si
#
# Created: 08/04/2023 Niklas Neronin
# Updated: 08/04/2023 Niklas Neronin
RED := "\e[0;31m"
GREEN := "\e[0;32m"
YELLOW := "\e[0;33m"
CYAN := "\e[0;36m"
RESET := "\e[0m"
IDIR = -I ./include
RAW = malloc.c\
calloc.c\
realloc.c\
free.c\
block_utils.c\
zone_utils.c\
ft_malloc.c\
ft_memshow.c\
ft_mempurge.c\
ft_memfind.c\
ifeq ($(HOSTTYPE),)
HOSTTYPE := $(shell uname -m)_$(shell uname -s)
endif
NAME = libdm_$(HOSTTYPE).so
CDIR = srcs
ODIR = objs
SRCS = $(addprefix $(CDIR)/, $(RAW))
OBJS = $(addprefix $(ODIR)/, $(RAW:.c=.o))
CFLAGS = -Wall -Wextra -MMD
all: $(NAME)
@printf ${GREEN}"\e[J> $(NAME) ready!\n"${RESET}
$(ODIR):
@mkdir -p $(ODIR)
$(ODIR)/%.o: $(CDIR)/%.c
@printf $(YELLOW)"\e[JCompiling $<\n\e[F"$(RESET)
@gcc $(CFLAGS) -fPIC -c $< -o $@ $(IDIR)
$(NAME): $(ODIR) $(OBJS)
@gcc $(OBJS) $(IDIR) $(CFLAGS) -shared -o $(NAME)
clean:
@printf ${CYAN}"[INFO] Removing object files.\n"${RESET}
@rm -rf $(ODIR)
fclean: clean
@printf ${CYAN}"[INFO] Removing $(NAME)\n"${RESET}
@rm -f $(NAME)
re: fclean all
.PHONY: clean, all, fclean, re