-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
40 lines (30 loc) · 673 Bytes
/
makefile
File metadata and controls
40 lines (30 loc) · 673 Bytes
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
#compiler and flags
CC = cc
CFLAGS = -Wall -Wextra -Werror
RM = rm -f
# Name of the library
NAME = philosopher
# Source files and object files
SRC = src/free.c src/init.c src/main.c \
src/monitore.c src/routine.c src/routine1.c \
src/threads.c src/time.c src/utilis.c
OBJ = $(SRC:.c=.o)
# Header files
HEADER = include/philo.h
all: $(NAME)
# Create philo
$(NAME): $(OBJ)
$(CC) $(OBJ) -o $(NAME)
# Compile object files
%.o: %.c $(HEADER)
$(CC) $(CFLAGS) -c $< -o $@
# Remove object files
clean:
$(RM) $(OBJ)
# Remove object files and the library
fclean: clean
$(RM) $(NAME)
# Rebuild the library
re: fclean all
# Phony targets
.PHONY: all clean fclean re