From beca9138512a5f57396397f7df5d771abb3508f6 Mon Sep 17 00:00:00 2001 From: gabime Date: Tue, 14 Oct 2014 05:16:16 +0300 Subject: [PATCH] updated example makefiles --- example/example.cpp | 2 +- example/makefile | 20 ++++++++++++++------ example/makefile.clang | 25 +++++++++++++++++-------- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/example/example.cpp b/example/example.cpp index 6dc6e384..c00f868e 100644 --- a/example/example.cpp +++ b/example/example.cpp @@ -9,7 +9,7 @@ #include "c11log/sinks/file_sinks.h" using namespace std; -int main2(int argc, char* argv[]) +int main(int, char* []) { auto console = c11log::factory::stdout_logger(); diff --git a/example/makefile b/example/makefile index 39a9f14c..306b890d 100644 --- a/example/makefile +++ b/example/makefile @@ -3,19 +3,27 @@ CXXFLAGS = -march=native -Wall -Wextra -Wshadow -pedantic -std=c++11 -pthread -I CXX_RELEASE_FLAGS = -O3 -flto CXX_DEBUG_FLAGS= -g -OUTBIN = example -all: example.cpp - $(CXX) example.cpp -o $(OUTBIN) $(CXXFLAGS) $(CXX_RELEASE_FLAGS) +all: example bench +debug: example-debug bench-debug + +example: example.cpp + $(CXX) example.cpp -o example $(CXXFLAGS) $(CXX_RELEASE_FLAGS) + +bench: bench.cpp + $(CXX) bench.cpp -o bench $(CXXFLAGS) $(CXX_RELEASE_FLAGS) -debug: example.cpp - $(CXX) example.cpp -o $(OUTBIN)-debug $(CXXFLAGS) $(CXX_DEBUG_FLAGS) +example-debug: example.cpp + $(CXX) example.cpp -o example-debug $(CXXFLAGS) $(CXX_DEBUG_FLAGS) + +bench-debug: bench.cpp + $(CXX) bench.cpp -o bench-debug $(CXXFLAGS) $(CXX_DEBUG_FLAGS) clean: - rm -f *.txt $(OUTBIN) $(OUTBIN)-debug + rm -f *.o *.txt example example-debug bench bench-debug rebuild: clean all diff --git a/example/makefile.clang b/example/makefile.clang index 0f738d49..fb8de71d 100644 --- a/example/makefile.clang +++ b/example/makefile.clang @@ -1,22 +1,31 @@ CXX = clang++ CXXFLAGS = -march=native -Wall -Wextra -Wshadow -pedantic -std=c++11 -pthread -I../include -B/usr/lib/gold-ld/ -CXX_RELEASE_FLAGS = -O3 +CXX_RELEASE_FLAGS = -O3 -flto CXX_DEBUG_FLAGS= -g -OUTBIN = example-clang -all: example.cpp - $(CXX) example.cpp -o $(OUTBIN) $(CXXFLAGS) $(CXX_RELEASE_FLAGS) +all: example bench +debug: example-debug bench-debug + +example: example.cpp + $(CXX) example.cpp -o example-clang $(CXXFLAGS) $(CXX_RELEASE_FLAGS) + +bench: bench.cpp + $(CXX) bench.cpp -o bench-clang $(CXXFLAGS) $(CXX_RELEASE_FLAGS) -debug: example.cpp - $(CXX) example.cpp -o $(OUTBIN)-debug $(CXXFLAGS) $(CXX_DEBUG_FLAFS) +example-debug: example.cpp + $(CXX) example.cpp -o example-clang-debug $(CXXFLAGS) $(CXX_DEBUG_FLAGS) + +bench-debug: bench.cpp + $(CXX) bench.cpp -o bench-clang-debug $(CXXFLAGS) $(CXX_DEBUG_FLAGS) clean: - rm -f *.txt $(OUTBIN) $(OUTBIN)-debug - + rm -f *.o *.txt example-clang example-clang-debug bench-clang bench-clang-debug + + rebuild: clean all rebuild-debug: clean debug