2015-02-26 15:02:31 +00:00
|
|
|
|
|
|
|
# The config_${HOST_TYPE}.mk file provides LLVM_HOME
|
2015-06-01 15:28:29 +00:00
|
|
|
include ${TRICK_HOME}/share/trick/makefiles/Makefile.common
|
2015-02-26 15:02:31 +00:00
|
|
|
|
2015-06-10 19:19:00 +00:00
|
|
|
CC := $(shell $(LLVM_HOME)/bin/llvm-config --bindir)/clang
|
|
|
|
CXX := $(shell $(LLVM_HOME)/bin/llvm-config --bindir)/clang++
|
2015-07-16 20:36:36 +00:00
|
|
|
CXXFLAGS := -g -I$(shell $(LLVM_HOME)/bin/llvm-config --includedir) -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti -std=c++11
|
2015-02-26 15:02:31 +00:00
|
|
|
|
2015-06-10 19:19:00 +00:00
|
|
|
CLANG_MINOR_GTEQ5 := $(shell expr `$(LLVM_HOME)/bin/llvm-config --version | cut -f2 -d. ` \>= 5 )
|
2015-06-04 18:17:53 +00:00
|
|
|
|
2015-06-10 19:19:00 +00:00
|
|
|
LLVMLDFLAGS := $(shell $(LLVM_HOME)/bin/llvm-config --ldflags)
|
2015-06-04 18:17:53 +00:00
|
|
|
|
|
|
|
OBJ_DIR := object_$(TRICK_HOST_CPU)
|
2015-02-26 15:02:31 +00:00
|
|
|
|
|
|
|
ifeq ($(IS_CC_CLANG), 0)
|
|
|
|
CXXFLAGS += -DGCC_MAJOR=$(GCC_MAJOR) -DGCC_MINOR=$(GCC_MINOR)
|
|
|
|
endif
|
|
|
|
|
2015-06-01 15:28:29 +00:00
|
|
|
ICG := ${TRICK_HOME}/bin/trick-ICG
|
2015-02-26 15:02:31 +00:00
|
|
|
|
|
|
|
SOURCES = $(wildcard *.cpp)
|
|
|
|
OBJECTS = $(addprefix $(OBJ_DIR)/, $(subst .cpp,.o,$(SOURCES)))
|
|
|
|
|
|
|
|
# Include the units conversion source from trick_utils.
|
|
|
|
UNITS_CONV_SRC = ${TRICK_HOME}/trick_source/trick_utils/units/src/units_conv.c
|
2015-06-01 15:28:29 +00:00
|
|
|
UNITS_CONV_INCLUDE = -I${TRICK_HOME}/include
|
2015-02-26 15:02:31 +00:00
|
|
|
UNITS_CONV_OBJ = $(OBJ_DIR)/units_conv.o
|
|
|
|
|
|
|
|
CLANGLIBS = \
|
|
|
|
-lclangFrontend \
|
|
|
|
-lclangDriver \
|
|
|
|
-lclangSerialization \
|
|
|
|
-lclangParse \
|
|
|
|
-lclangSema \
|
|
|
|
-lclangAnalysis \
|
|
|
|
-lclangEdit \
|
|
|
|
-lclangAST \
|
|
|
|
-lclangLex \
|
|
|
|
-lclangBasic \
|
|
|
|
|
2015-06-04 18:17:53 +00:00
|
|
|
ifeq ($(TRICK_HOST_TYPE),Linux)
|
2015-06-10 19:19:00 +00:00
|
|
|
CLANGLIBS += $(shell $(LLVM_HOME)/bin/llvm-config --libs)
|
2015-06-04 18:17:53 +00:00
|
|
|
ifeq ($(CLANG_MINOR_GTEQ5),1)
|
|
|
|
CXXFLAGS += -std=c++11
|
2015-05-28 00:28:55 +00:00
|
|
|
# Fedora 21 adds -ledit as a system lib, but it isn't installed, or required.
|
2015-06-10 19:19:00 +00:00
|
|
|
CLANGLIBS += $(filter-out -ledit,$(shell $(LLVM_HOME)/bin/llvm-config --system-libs))
|
2015-06-04 18:17:53 +00:00
|
|
|
endif
|
|
|
|
endif
|
2015-02-26 15:02:31 +00:00
|
|
|
|
2015-06-04 18:17:53 +00:00
|
|
|
ifeq ($(TRICK_HOST_TYPE),Darwin)
|
|
|
|
CXXFLAGS += -std=c++11
|
2015-06-10 19:19:00 +00:00
|
|
|
CLANGLIBS += -lLLVMOption -lLLVMMCParser -lLLVMBitReader -lLLVMMC -lLLVMSupport $(shell $(LLVM_HOME)/bin/llvm-config --system-libs)
|
2015-06-17 15:32:20 +00:00
|
|
|
CLANGLIBS += -lc++abi
|
2015-06-04 18:17:53 +00:00
|
|
|
endif
|
2015-02-26 15:02:31 +00:00
|
|
|
|
2015-06-04 18:17:53 +00:00
|
|
|
all: $(ICG)
|
2015-02-26 15:02:31 +00:00
|
|
|
|
2015-06-04 18:17:53 +00:00
|
|
|
$(ICG): $(OBJECTS) $(UNITS_CONV_OBJ)
|
|
|
|
$(CXX) -o $@ $(OBJECTS) $(UNITS_CONV_OBJ) $(LLVMLDFLAGS) $(CLANGLIBS)
|
2015-02-26 15:02:31 +00:00
|
|
|
|
|
|
|
# Only FieldDescription.cpp includes the units conversion header.
|
|
|
|
$(OBJ_DIR)/FieldDescription.o : CXXFLAGS += $(UNITS_CONV_INCLUDE)
|
2015-06-04 18:17:53 +00:00
|
|
|
$(OBJ_DIR)/HeaderSearchDirs.o : CXXFLAGS += -DLLVM_HOME=\"${LLVM_HOME}\"
|
2015-02-26 15:02:31 +00:00
|
|
|
$(OBJ_DIR)/main.o : CXXFLAGS += $(UNITS_CONV_INCLUDE)
|
|
|
|
|
|
|
|
$(OBJECTS): $(OBJ_DIR)/%.o : %.cpp
|
|
|
|
$(CXX) $(CXXFLAGS) -c $< -o $@
|
|
|
|
|
|
|
|
$(UNITS_CONV_OBJ): $(UNITS_CONV_SRC)
|
|
|
|
$(CC) $(UNITS_CONV_INCLUDE) -c $< -o $@
|
|
|
|
|
|
|
|
$(OBJECTS) $(UNITS_CONV_OBJ) : | $(OBJ_DIR)
|
|
|
|
|
|
|
|
$(OBJ_DIR):
|
|
|
|
mkdir -p $(OBJ_DIR)
|
|
|
|
|
|
|
|
clean:
|
2015-06-04 18:17:53 +00:00
|
|
|
rm -rf $(OBJ_DIR) $(ICG)
|