-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
55 lines (42 loc) · 1.36 KB
/
Makefile
File metadata and controls
55 lines (42 loc) · 1.36 KB
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
.PHONY: all clean tar SampleClient runSampleClient
CXX=g++
AR=ar
# Source and object files
LIBSRC=src/MapReduceFramework.cpp src/JobStateManager.cpp src/Barrier.cpp
LIBOBJ=$(LIBSRC:.cpp=.o)
# Sample client
SAMPLE_CLIENT=sample_client
SAMPLE_CLIENT_SRC=example/SampleClient.cpp
# Compiler & linker flags
RM=rm
RMFLAGS=-f
INCS=-Iinclude
CXXFLAGS=-Wall -std=c++20 -pthread -g $(INCS)
LDFLAGS=-L. -lMapReduceFramework
# Tar packaging
TARFLAGS=-cvf
TARNAME=MapReduceFramework.tar
TARSRCS=$(LIBSRC) include/MapReduceClient.h include/MapReduceFramework.h \
include/JobStateManager.h include/Barrier.h Makefile CMakeLists.txt
# Library name
LIBRARY=libMapReduceFramework.a
# The default target, which builds the library
all: $(LIBRARY)
# Build static library
$(LIBRARY): $(LIBOBJ)
$(AR) rcs $@ $(LIBOBJ)
# Compile each source file into object
%.o: src/%.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
# A clean target that removes everything generated by the build process
clean:
$(RM) $(RMFLAGS) $(LIBRARY) $(LIBOBJ) $(SAMPLE_CLIENT)
# A target to create a tarball of the source files
tar: $(TARSRCS)
tar $(TARFLAGS) $(TARNAME) $(TARSRCS)
# A target to build the sample client using the library
SampleClient: $(LIBRARY) $(SAMPLE_CLIENT_SRC)
$(CXX) $(CXXFLAGS) $(SAMPLE_CLIENT_SRC) $(LDFLAGS) -o $(SAMPLE_CLIENT)
# Run the sample client
runSampleClient: SampleClient
./$(SAMPLE_CLIENT)