Index: Makefile.standalone |
diff --git a/Makefile.standalone b/Makefile.standalone |
index cb0082cee3a5914a7151e50d27f8346a3bd03d80..fe5f2dc8671b00ff129ad4ce9204ca81b1c473d7 100644 |
--- a/Makefile.standalone |
+++ b/Makefile.standalone |
@@ -37,19 +37,41 @@ else |
endif |
endif |
+# The list of CXX defines that are dependent on build parameters. |
+CXX_DEFINES = |
+ |
+# The list of attributes associated with the built executable. |
+BUILD_ATTS = x86-32 p2i |
+ |
ifdef DEBUG |
OBJDIR = build/Debug |
OPTLEVEL = -O0 |
+ BUILD_ATTS += debug |
else |
OBJDIR = build/Release |
OPTLEVEL = -O2 |
+ BUILD_ATTS += release |
+endif |
+ |
+ifdef MINIMAL |
+ CXX_DEFINES += -DNO_TEXT_ASM -DNO_DUMP -DNO_LLVM_CL -DNO_LLVM_IR \ |
+ -DNO_LLVM_IR_AS_INPUT |
Karl
2014/10/21 21:14:18
Decided to always define the macros, and set to 0/
|
+ OBJDIR := $(OBJDIR)+Min |
+ BUILD_ATTS += no_text_asm no_dump no_llvm_cl no_llvm_ir no_llvm_ir_as_input |
+else |
+ CXX_DEFINES += -DALLOW_TEXT_ASM -DALLOW_DUMP -DALLOW_LLVM_CL \ |
+ -DALLOW_LLVM_IR -DALLOW_LLVM_IR_AS_INPUT |
+ BUILD_ATTS += allow_text_asm allow_dump allow_llvm_cl allow_llvm_ir \ |
+ allow_llvm_ir_as_input |
endif |
ifdef NOASSERT |
ASSERTIONS = -DNDEBUG |
+ BUILD_ATTS += noasserts |
else |
ASSERTIONS = |
OBJDIR := $(OBJDIR)+Asserts |
+ BUILD_ATTS += asserts |
endif |
$(info -----------------------------------------------) |
@@ -69,8 +91,9 @@ 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) $(ASSERTIONS) -g $(HOST_FLAGS) \ |
- -Wno-error=unused-parameter -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 |
+ -fno-exceptions $(OPTLEVEL) $(ASSERTIONS) $(CXX_DEFINES) -g \ |
+ $(HOST_FLAGS) -Wno-error=unused-parameter \ |
+ -I$(LIBCXX_INSTALL_PATH)/include/c++/v1 |
LDFLAGS := $(HOST_FLAGS) -L$(LIBCXX_INSTALL_PATH)/lib |
SRCS= \ |
@@ -103,15 +126,17 @@ OBJS=$(patsubst %.cpp, $(OBJDIR)/%.o, $(SRCS)) |
# Keep all the first target so it's the default. |
all: $(OBJDIR)/llvm2ice make_symlink |
-make_symlink: $(OBJDIR)/llvm2ice |
- rm -f llvm2ice |
+make_symlink: $(OBJDIR)/llvm2ice $(OBJDIR)/llvm2ice.build_atts |
+ rm -rf llvm2ice llvm2ice.build_atts |
ln -s $(OBJDIR)/llvm2ice |
+ ln -s $(OBJDIR)/llvm2ice.build_atts |
.PHONY: all make_symlink |
$(OBJDIR)/llvm2ice: $(OBJS) |
$(CXX) $(LDFLAGS) -o $@ $^ $(LLVM_LDFLAGS) -ldl \ |
-Wl,-rpath=$(abspath $(LIBCXX_INSTALL_PATH)/lib) |
+ echo "$(BUILD_ATTS)" > $@.build_atts |
# TODO: Be more precise than "*.h" here and elsewhere. |
$(OBJS): $(OBJDIR)/%.o: src/%.cpp src/*.h src/*.def |
@@ -149,4 +174,7 @@ format-diff: |
$(CLANG_FORMAT_DIFF) -p1 -style=LLVM -i |
clean: |
- rm -rf llvm2ice *.o build/ |
+ rm -rf llvm2ice llvm2ice.build_atts *.o $(OBJDIR) |
+ |
+clean-all: clean |
+ rm -rf build/ |