-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
46 lines (34 loc) · 894 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
NAME = 21sh
CC := gcc
all: $(NAME)
MODULES := src/ast src/env src/exec src/shell src/termcaps src/parser_2 includes
LIBDIRS := libft
LIBS := -lncurses -Llibft -lft
CFLAGS += -Ilibft/includes -Iincludes -Wall -Werror -Wextra -g -fsanitize=address
MODNAME := module.mk
SRC :=
include $(patsubst %,%/$(MODNAME),$(MODULES))
OBJ := $(patsubst %.c,%.o,$(filter %.c,$(SRC)))
DEP := $(patsubst %.c,%.d,$(filter %.c,$(SRC)))
-include $(DEP)
$(NAME): $(OBJ)
make -C libft
@$(CC) $(CFLAGS) $(OBJ) $(LIBS) -o $@
%.d : %.c
@./depend.sh $*.o $(CFLAGS) $< > $@
@printf '\t%s' "$(CC) $(CFLAGS) -c -o $*.o $<" >> $@
@echo $@ >> all.log
clean:
make clean -C libft
rm -f $(OBJ)
rm -f $(shell cat all.log)
@rm -f all.log
clean_nolib:
rm -f $(OBJ)
rm -f $(shell cat all.log)
@rm -f all.log
fclean: clean_nolib
make fclean -C libft
rm -f $(NAME)
re: fclean all
.PHONY: all clean fclean re