-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
43 lines (34 loc) · 815 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
NAME = woody_woodpacker
CFLAGS += -Ofast -Wall -Werror -Wextra
CFLAGS += -Iinc -Ilibft/inc
LDFLAGS += -Llibft -lft
SRCDIR = src
SRC = \
decrypt \
encrypt \
load \
main \
segment
OBJDIR = obj
OBJ = $(patsubst %, $(OBJDIR)/%.o, $(SRC))
LIBFT = libft/libft.a
all: $(NAME)
$(OBJDIR)/%.o: $(SRCDIR)/%.c
mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) -c $< -o $@
$(LIBFT):
make -C libft
$(OBJDIR)/g_decryptor.c:
nasm -f bin $(SRCDIR)/decryptor.s -o $(OBJDIR)/g_decryptor
cd $(OBJDIR) && xxd -i -c 8 g_decryptor g_decryptor.c
$(OBJDIR)/g_decryptor.o: $(OBJDIR)/g_decryptor.c
$(CC) $(CFLAGS) -c $< -o $@
$(NAME): $(OBJ) $(OBJDIR)/g_decryptor.o $(LIBFT)
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
clean:
rm -rf $(OBJDIR)
make -C libft clean
fclean: clean
rm -f $(NAME)
make -C libft fclean
re: fclean all