Skip to content

Commit

Permalink
Better impl. of DEBUG_CXXFLAGS in Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
gejun committed Sep 26, 2017
1 parent b155009 commit 84936b1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ include config.mk
CPPFLAGS+=-DBTHREAD_USE_FAST_PTHREAD_MUTEX -D__const__= -D_GNU_SOURCE -DUSE_SYMBOLIZE -DNO_TCMALLOC -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -DBRPC_REVISION=\"$(shell git rev-parse --short HEAD)\"
CXXFLAGS+=$(CPPFLAGS) -O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-invalid-offsetof -Wno-unused-parameter -fno-omit-frame-pointer -std=c++0x
CFLAGS+=$(CPPFLAGS) -O2 -pipe -Wall -W -fPIC -fstrict-aliasing -Wno-unused-parameter -fno-omit-frame-pointer
DEBUG_CXXFLAGS = $(CXXFLAGS) -DUNIT_TEST -DBVAR_NOT_LINK_DEFAULT_VARIABLES
DEBUG_CXXFLAGS = $(filter-out -DNDEBUG,$(CXXFLAGS)) -DUNIT_TEST -DBVAR_NOT_LINK_DEFAULT_VARIABLES
DEBUG_CFLAGS = $(filter-out -DNDEBUG,$(CFLAGS)) -DUNIT_TEST
HDRPATHS=-I./src $(addprefix -I, $(HDRS))
LIBPATHS = $(addprefix -L, $(LIBS))
COMMA = ,
Expand Down Expand Up @@ -236,24 +237,24 @@ output/bin:protoc-gen-mcpack

%.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) -DNDEBUG $< -o $@
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@

%.dbg.o:%.cpp
@echo "Compiling $@"
@$(CXX) -c $(HDRPATHS) $(DEBUG_CXXFLAGS) $< -o $@

%.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) -DNDEBUG $< -o $@
@$(CXX) -c $(HDRPATHS) $(CXXFLAGS) $< -o $@

%.dbg.o:%.cc
@echo "Compiling $@"
@$(CXX) -c $(HDRPATHS) $(DEBUG_CXXFLAGS) $< -o $@

%.o:%.c
@echo "Compiling $@"
@$(CC) -c $(HDRPATHS) $(CFLAGS) -DNDEBUG $< -o $@
@$(CC) -c $(HDRPATHS) $(CFLAGS) $< -o $@

%.dbg.o:%.c
@echo "Compiling $@"
@$(CC) -c $(HDRPATHS) $(CFLAGS) $< -o $@
@$(CC) -c $(HDRPATHS) $(DEBUG_CFLAGS) $< -o $@

0 comments on commit 84936b1

Please sign in to comment.