-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (46 loc) · 1.96 KB
/
Copy pathMakefile
File metadata and controls
64 lines (46 loc) · 1.96 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
# **************************************************************************** #
# #
# ft_script — recode of the UNIX script command (42 project) #
# #
# **************************************************************************** #
NAME := ft_script
CC := cc
CFLAGS := -Wall -Wextra -Werror
LIBFT_DIR := vendor/libft
LIBFT := $(LIBFT_DIR)/build/lib/libft.a
CPPFLAGS := -Iinclude -I$(LIBFT_DIR)/include -I$(LIBFT_DIR) -D_GNU_SOURCE
SRCDIR := src
OBJDIR := obj
HEADER := include/ft_script.h
SRCS := main.c args.c args2.c args3.c args4.c pty.c child.c term.c \
relay.c log.c log2.c timing.c signals.c util.c
OBJS := $(SRCS:%.c=$(OBJDIR)/%.o)
all: $(NAME)
# Build the vendored libft (init its ft_malloc submodule so the allocator is
# mmap-based, not libc malloc). Order-only prereq: no relink unless an object
# changed. Link the static archive by path — the prebuilt .so carries unrelated
# undefined symbols.
$(LIBFT):
@git -C $(LIBFT_DIR) submodule update --init --recursive 2>/dev/null || true
$(MAKE) -C $(LIBFT_DIR)
$(NAME): $(OBJS) | $(LIBFT)
$(CC) $(CFLAGS) $(OBJS) $(LIBFT) -o $(NAME)
$(OBJDIR)/%.o: $(SRCDIR)/%.c $(HEADER) | $(OBJDIR)
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
$(OBJDIR):
mkdir -p $(OBJDIR)
clean:
rm -rf $(OBJDIR)
fclean: clean
rm -f $(NAME)
re: fclean all
# 42 norm on project sources only (libft has its own verif_norm). Gate on real
# violations; the justified signal-flag global is a permitted NOTICE.
norm:
@norminette include src | grep 'Error' && exit 1 || echo "norm: clean"
# project-scoped static analysis (the kit gate scans vendored libft too).
lint:
@cppcheck --enable=warning,style --error-exitcode=1 --quiet include src
bench: all
@sh bench/run.sh
.PHONY: all clean fclean re norm lint bench