-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
51 lines (37 loc) · 1007 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
47
48
49
50
51
#compiler options
CXXFLAGS+=--std=c++11
#source files
SOURCES=$(wildcard *.cpp)
#object files
OBJECTS=$(SOURCES:.cpp=.o)
#main link objects
MOBJECTS=$(filter-out test%,$(OBJECTS))
#test link objects
TOBJECTS=$(filter-out main.o,$(OBJECTS))
#included libraries
INCLUDE=`pkg-config gtkmm-3.0 --cflags --libs`
#executable filename
EXECUTABLE=mice
all: div $(EXECUTABLE)
./mice
#Special symbols used:
#$^ - is all the dependencies (in this case =$(OBJECTS) )
#$@ - is the result name (in this case =$(EXECUTABLE) )
$(EXECUTABLE): $(MOBJECTS)
$(CXX) $(CXXFLAGS) $^ -o $@ $(INCLUDE)
test: CXXFLAGS+= -g
test: $(TOBJECTS)
$(CXX) $(CXXFLAGS) $^ -o $@ $(INCLUDE)
debug: CXXFLAGS+= -g
debug: div $(EXECUTABLE)
%.o: %.cpp *.h
$(CXX) $(CXXFLAGS) $(INCLUDE) -c $< -o $@
clean:
-rm -f $(EXECUTABLE) test $(OBJECTS)
div:
@echo
@echo 'X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-'
@echo '-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X'
@echo 'X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-'
@echo '-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X-X'
@echo