-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript_Makefile.sh
executable file
·73 lines (56 loc) · 1.63 KB
/
script_Makefile.sh
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
65
66
67
68
69
70
71
72
73
#!/bin/bash
echo '# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: qdegraev <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2015/12/07 08:41:32 by qdegraev #+# #+# #
# Updated: 2015/12/11 19:03:26 by qdegraev ### ########.fr #
# #
# **************************************************************************** #
LIBPATH = libft
LIB = $(LIBPATH)/libft.a
'
echo "NAME = $1
"
echo 'CC = gcc
VPATH = src
INCLUDES = include/
ifdef FLAGS
ifeq ($(FLAGS), no)
CFLAGS=
endif
ifeq ($(FLAGS), debug)
CFLAGS= -Wall -Wextra -Werror -ansi -pedantic -g
endif
else
CFLAGS = -Wall -Wextra -Werror
endif
LDFLAGS = -L libft -lft
'
echo -n "SRC = "
for file in `find ./src -maxdepth 1 -name "*.c" | xargs -n 1 basename`
do
echo -n " \\
$file"
done
echo '
OBJ = $(SRC:.c=.o)
all: $(LIB) $(NAME)
$(NAME): $(OBJ)
$(CC) $(LDFLAGS) -o $@ $^
%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $< -I $(INCLUDES)
$(LIB):
make -C $(LIBPATH)
clean:
make clean -C $(LIBPATH)
rm -f $(OBJ)
fclean: clean
make fclean -C $(LIBPATH)
rm -f $(NAME)
re: fclean all
.PHONY: all re clean flcean
'