forked from PlatformLab/NanoLog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GNUmakefile
49 lines (37 loc) · 1.54 KB
/
GNUmakefile
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
#####################################################################
#
# This is a sample makefile on how to compile with C++17 NanoLog
# (i.e. Non-preprocessor version of NanoLog).
#
# The main requirements are
# (a) include the NanoLog runtime directory with -I when compiling
# (b) link the NanoLog runtime library (-lNanoLog) and external
# libraries (-pthread -lrt) into the final executable
#
#####################################################################
# -DNDEBUG and -O3 should always be passed for high performance
CXXFLAGS= -std=c++17 -DNDEBUG -O3 -g
CXX=g++
NANOLOG_RUNTIME_DIR=../runtime
all: sampleApplication decompressor
# (a) Make the user object files include the NanoLog header (-I)
%.o: %.cc
$(CXX) -I $(NANOLOG_RUNTIME_DIR) -c -o $@ $< $(CXXFLAGS)
# (b) Make the final application linking NanoLog, pthreads, and POSIX aio
sampleApplication: main.o libNanoLog.a
$(CXX) $(CXXFLAGS) -o sampleApplication main.o -L. -lNanoLog -pthread -lrt
clean:
@rm -f *.o sampleApplication /tmp/logFile compressedLog
# These (optional) rules copy in the NanoLog library and decompressor.
# An alternative is to run "make" in the runtime directory and copy out
# the library and decompressor executable.
libNanoLog.a:
$(MAKE) libNanoLog.a -C $(NANOLOG_RUNTIME_DIR)
cp $(NANOLOG_RUNTIME_DIR)/libNanoLog.a .
decompressor:
$(MAKE) decompressor -C $(NANOLOG_RUNTIME_DIR)
cp $(NANOLOG_RUNTIME_DIR)/decompressor .
# Cleans up the NanoLog files as well
clean-all: clean
@rm -f libNanoLog.a decompressor
$(MAKE) clean-all -C $(NANOLOG_RUNTIME_DIR)