-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
39 lines (27 loc) · 792 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
CXX= g++ $(CCFLAGS)
EXAMPLE= example.o
PROBLEM= problem.o
SEMAPHORE= semaphore.o
MUTEX= mutex.o
OBJS = $(EXAMPLE) $(PROBLEM) $(SEMAPHORE) $(MUTEX)
LIBS= -pthread
CCFLAGS= -g
all: example problem semaphore mutex
example: $(EXAMPLE)
$(CXX) -o example $(EXAMPLE) $(LIBS)
problem: $(PROBLEM)
$(CXX) -o problem $(PROBLEM) $(LIBS)
semaphore: $(SEMAPHORE)
$(CXX) -o semaphore $(SEMAPHORE) $(LIBS)
mutex: $(MUTEX)
$(CXX) -o mutex $(MUTEX) $(LIBS)
clean:
rm -f $(OBJS) $(OBJS:.o=.d)
realclean:
rm -f $(OBJS) $(OBJS:.o=.d) example problem semaphore mutex
# These lines ensure that dependencies are handled automatically.
%.d: %.cc
$(SHELL) -ec '$(CC) -M $(CPPFLAGS) $< \
| sed '\''s/\($*\)\.o[ :]*/\1.o $@ : /g'\'' > $@; \
[ -s $@ ] || rm -f $@'
include $(OBJS:.o=.d)