Use different object filenames between debug/non-debug builds
This commit is contained in:
parent
889499e3e8
commit
8b9452680a
32
src/Makefile
32
src/Makefile
|
@ -1,6 +1,19 @@
|
||||||
|
debug ?= yes
|
||||||
|
ifeq ($(debug),yes)
|
||||||
|
CPPFLAGS += -DKAK_DEBUG
|
||||||
|
suffix := .debug
|
||||||
|
else
|
||||||
|
ifeq ($(debug),no)
|
||||||
|
CXXFLAGS += -O3
|
||||||
|
suffix := .opt
|
||||||
|
else
|
||||||
|
$(error debug should be either yes or no)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
sources := $(wildcard *.cc)
|
sources := $(wildcard *.cc)
|
||||||
objects := $(addprefix ., $(sources:.cc=.o))
|
objects := $(addprefix ., $(sources:.cc=$(suffix).o))
|
||||||
deps := $(addprefix ., $(sources:.cc=.d))
|
deps := $(addprefix ., $(sources:.cc=$(suffix).d))
|
||||||
|
|
||||||
PREFIX ?= /usr/local
|
PREFIX ?= /usr/local
|
||||||
DESTDIR ?= # root dir
|
DESTDIR ?= # root dir
|
||||||
|
@ -23,24 +36,13 @@ else
|
||||||
LDFLAGS += -rdynamic
|
LDFLAGS += -rdynamic
|
||||||
endif
|
endif
|
||||||
|
|
||||||
debug ?= yes
|
|
||||||
ifeq ($(debug),yes)
|
|
||||||
CPPFLAGS += -DKAK_DEBUG
|
|
||||||
else
|
|
||||||
ifeq ($(debug),no)
|
|
||||||
CXXFLAGS += -O3
|
|
||||||
else
|
|
||||||
$(error debug should be either yes or no)
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
|
|
||||||
kak : $(objects)
|
kak : $(objects)
|
||||||
$(CXX) $(LDFLAGS) $(CXXFLAGS) $(objects) $(LIBS) -o $@
|
$(CXX) $(LDFLAGS) $(CXXFLAGS) $(objects) $(LIBS) -o $@
|
||||||
|
|
||||||
-include $(deps)
|
-include $(deps)
|
||||||
|
|
||||||
.%.o: %.cc
|
.%$(suffix).o: %.cc
|
||||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -MD -MP -MF $(addprefix ., $(<:.cc=.d)) -c -o $@ $<
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -MD -MP -MF $(addprefix ., $(<:.cc=$(suffix).d)) -c -o $@ $<
|
||||||
|
|
||||||
test:
|
test:
|
||||||
cd ../test && ./run
|
cd ../test && ./run
|
||||||
|
|
Loading…
Reference in New Issue
Block a user