Commit fddef241 by Jim Stichnoth

Subzero: Build both Debug and Release version of llvm2ice.

Separate objects are built with -O0 and -O2. Separate executables are built: build/Release/llvm2ice - Release build build/Debug/llvm2ice - Debug build The executable built depends on whether the DEBUG make variable is set: make -f Makefile.standalone make -f Makefile.standalone DEBUG=1 The llvm2ice file in the top-level directory is always removed and symlinked to the appropriate build. BUG= none R=jvoung@chromium.org Review URL: https://codereview.chromium.org/605093002
parent af2780c2
......@@ -37,6 +37,14 @@ else
endif
endif
ifdef DEBUG
OBJDIR = build/Debug
OPTLEVEL = -O0
else
OBJDIR = build/Release
OPTLEVEL = -O2
endif
$(info -----------------------------------------------)
$(info Using LLVM_SRC_PATH = $(LLVM_SRC_PATH))
$(info Using LLVM_BIN_PATH = $(LLVM_BIN_PATH))
......@@ -50,7 +58,6 @@ LLVM_LDFLAGS := `$(LLVM_BIN_PATH)/llvm-config --libs` \
`$(LLVM_BIN_PATH)/llvm-config --ldflags`
# It's recommended that CXX matches the compiler you used to build LLVM itself.
OPTLEVEL := -O0
CCACHE := `command -v ccache`
CXX := CCACHE_CPP2=yes $(CCACHE) $(CLANG_PATH)/clang++
......@@ -82,24 +89,28 @@ SRCS= \
llvm2ice.cpp \
PNaClTranslator.cpp
OBJS=$(patsubst %.cpp, build/%.o, $(SRCS))
OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(SRCS))
# Keep all the first target so it's the default.
all: llvm2ice
all: $(OBJDIR)/llvm2ice make_symlink
make_symlink: $(OBJDIR)/llvm2ice
rm -f llvm2ice
ln -s $(OBJDIR)/llvm2ice
.PHONY: all
.PHONY: all make_symlink
llvm2ice: $(OBJS)
$(OBJDIR)/llvm2ice: $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -ldl \
-Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib)
# TODO: Be more precise than "*.h" here and elsewhere.
$(OBJS): build/%.o: src/%.cpp src/*.h src/*.def
$(OBJS): $(OBJDIR)/%.o: src/%.cpp src/*.h src/*.def
$(CXX) -c $(CXXFLAGS) $< -o $@
$(OBJS): | build
$(OBJS): | $(OBJDIR)
build:
$(OBJDIR):
@mkdir -p $@
check-lit: llvm2ice
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment