-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (41 loc) · 1.27 KB
/
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
47
48
49
50
51
52
53
54
55
56
57
NAME = daemon-foldermonitor
SRC_DIR = src/
OBJ_DIR = obj/
INC_DIR = includes/
LIB = -l sqlite3 -pthread
SRC_FILES = main.cpp \
DbWriter.cpp \
DirectoryMonitor.cpp \
FileReader.cpp \
MigrationManager.cpp
HEADERS = $(INC_DIR)DbWriter.hpp \
$(INC_DIR)DirectoryMonitor.hpp \
$(INC_DIR)FileReader.hpp \
$(INC_DIR)IDB.hpp \
$(INC_DIR)MigrationManager.hpp
SRC = $(addprefix $(SRC_DIR), $(SRC_FILES))
OBJ = $(addprefix $(OBJ_DIR), $(SRC_FILES:.cpp=.o))
CC = g++ -std=c++11
CFLAGS = -Wall -Werror -Wextra
INC = -I $(INC_DIR)
C_RED = \033[31m
C_GREEN = \033[32m
C_MAGENTA = \033[35m
C_NONE = \033[0m
all: $(NAME)
$(NAME): $(HEADERS) $(OBJ_DIR) $(OBJ)
@$(CC) $(CFLAGS) $(OBJ) $(LIB) $(INC) -o $(NAME)
@printf "$(C_MAGENTA)$(NAME):$(C_NONE) %-25s$(C_GREEN)[done]$(C_NONE)\n" $@
$(OBJ_DIR):
@mkdir obj
@printf "$(C_MAGENTA)$(NAME):$(C_NONE) %-25s$(C_GREEN)[done]$(C_NONE)\n" $@
$(OBJ_DIR)%.o: $(SRC_DIR)%.cpp $(HEADERS)
@$(CC) $(CFLAGS) -c $(INC) $< -o $@
@printf "$(C_MAGENTA)$(NAME):$(C_NONE) %-25s$(C_GREEN)[done]$(C_NONE)\n" $@
clean:
@rm -rf $(OBJ_DIR)*
@printf "$(C_MAGENTA)$(NAME):$(C_NONE) %-25s$(C_RED)[done]$(C_NONE)\n" $@
fclean: clean
@rm -rf $(NAME)
@printf "$(C_MAGENTA)$(NAME):$(C_NONE) %-25s$(C_RED)[done]$(C_NONE)\n" $@
re: fclean all