-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
62 lines (48 loc) · 1.25 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
58
59
60
61
62
# C++ compiler.
CC =g++
PROJECT_NAME :=Shutters
# Compilation and linking flags.
CC_FLAGS = -c -MMD -MP -O3 -m32 -Wall -std=c++0x
LD_FLAGS = -m32 -static
# Target
TARGET = shutters
# Header files directory
SRCDIR = ./src/
INCDIR = ./inc/
OBJDIR = ./obj/
# Sources
SRCS = $(wildcard $(SRCDIR)*.cpp)
# Object files
OBJS = $(addprefix $(OBJDIR),$(notdir $(SRCS:.cpp=.o)))
# The dependency file names.
DEPS := $(OBJS:.o=.d)
$(TARGET): $(OBJS)
@echo "\`\` building: $@"
@$(CC) $(LD_FLAGS) -o $@ $^
@echo "$(PROJECT_NAME) installed correctly."
obj/%.o: src/%.cpp | $(OBJDIR)
@echo "\`\` compiling: $<"
@$(CC) $(CC_FLAGS) -I$(INCDIR) -o $@ $<
# Read dependency files and handle them
-include $(DEPS)
$(OBJDIR):
@mkdir -p $(OBJDIR)
clean:
@echo "Removing $(PROJECT_NAME)..."
@rm -rf $(OBJDIR)
@rm $(TARGET)
@echo "$(PROJECT_NAME) removed correctly."
rmtmp:
@rm -f *~
@rm -rf $(SRCDIR)*~
@rm -rf $(INCDIR)*~
@echo "Temporary files removed correctly."
help:
@echo "Help for $(PROJECT_NAME) Makefile:"
@echo "\t-make:\t\tcompiling and install $(PROJECT_NAME)"
@echo "\t-make clean:\tremove $(PROJECT_NAME)"
@echo "\t-make rmtmp:\tremove temporary files from the project"
@echo "\t-make help:\thelp of the program."
tests:
@echo "Run tests:"
@./run_test.sh