Index: Makefile.standalone |
diff --git a/Makefile.standalone b/Makefile.standalone |
index b6d0d179d196693e31da4af13c617421c05180bb..2caf82dddcf1f61d8c805c98b78bb0c635e19a5f 100644 |
--- a/Makefile.standalone |
+++ b/Makefile.standalone |
@@ -50,12 +50,11 @@ 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++ |
CXXFLAGS := $(LLVM_CXXFLAGS) -std=c++11 -Wall -Wextra -Werror -fno-rtti \ |
- -fno-exceptions $(OPTLEVEL) -g $(HOST_FLAGS) \ |
+ -fno-exceptions -g $(HOST_FLAGS) \ |
-Wno-error=unused-parameter -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 |
LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib |
@@ -82,24 +81,32 @@ SRCS= \ |
llvm2ice.cpp \ |
PNaClTranslator.cpp |
-OBJS=$(patsubst %.cpp, build/%.o, $(SRCS)) |
+OBJS_DBG=$(patsubst %.cpp, build/Debug/%.o, $(SRCS)) |
+OBJS_REL=$(patsubst %.cpp, build/Release/%.o, $(SRCS)) |
# Keep all the first target so it's the default. |
+# Note: llvm2ice_dbg is not built by default; "make llvm2ice_dbg" if needed. |
all: llvm2ice |
.PHONY: all |
-llvm2ice: $(OBJS) |
+llvm2ice: $(OBJS_REL) |
+ $(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -ldl \ |
+ -Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) |
+llvm2ice_dbg: $(OBJS_DBG) |
$(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 |
- $(CXX) -c $(CXXFLAGS) $< -o $@ |
+$(OBJS_DBG): build/Debug/%.o: src/%.cpp src/*.h src/*.def |
+ $(CXX) -c -O0 $(CXXFLAGS) $< -o $@ |
+$(OBJS_REL): build/Release/%.o: src/%.cpp src/*.h src/*.def |
+ $(CXX) -c -O2 $(CXXFLAGS) $< -o $@ |
-$(OBJS): | build |
+$(OBJS_DBG): | build/Debug |
+$(OBJS_REL): | build/Release |
-build: |
+build/Debug build/Release: |
@mkdir -p $@ |
check-lit: llvm2ice |
@@ -129,4 +136,4 @@ format-diff: |
$(CLANG_FORMAT_DIFF) -p1 -style=LLVM -i |
clean: |
- rm -rf llvm2ice *.o build/ |
+ rm -rf llvm2ice llvm2ice_dbg *.o build/ |