mirror of
https://github.com/nasa/trick.git
synced 2025-01-10 06:52:52 +00:00
cb58e0c770
So the previous commit broke on the mac. There were missing changes in TranslationUnitVisitor.cpp. Also there are fixes for clang 3.9 that were not included yet.
82 lines
2.6 KiB
Makefile
82 lines
2.6 KiB
Makefile
|
|
# The config_${HOST_TYPE}.mk file provides LLVM_HOME
|
|
include ${TRICK_HOME}/makefiles/Makefile.common
|
|
|
|
CXXFLAGS := -g -I$(shell $(LLVM_HOME)/bin/llvm-config --includedir) -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti
|
|
|
|
CLANG_MAJOR := $(shell $(LLVM_HOME)/bin/llvm-config --version | cut -f1 -d.)
|
|
CLANG_MINOR := $(shell $(LLVM_HOME)/bin/llvm-config --version | cut -f2 -d.)
|
|
CLANG_PATCHLEVEL := $(shell $(LLVM_HOME)/bin/llvm-config --version | cut -f3 -d.)
|
|
# check to see if version is greater than 3.5
|
|
CLANG_MINOR_GTEQ5 := $(shell [ $(CLANG_MAJOR) -gt 3 -o \( $(CLANG_MAJOR) -eq 3 -a $(CLANG_MINOR) -ge 5 \) ] && echo 1)
|
|
|
|
LLVMLDFLAGS := $(shell $(LLVM_HOME)/bin/llvm-config --ldflags)
|
|
|
|
OBJ_DIR := object_$(TRICK_HOST_CPU)
|
|
|
|
ICG := ICG_$(shell uname -s)_$(shell uname -m)
|
|
|
|
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
|
|
UNITS_CONV_INCLUDE = -I${TRICK_HOME}/trick_source/trick_utils/units/include
|
|
UNITS_CONV_OBJ = $(OBJ_DIR)/units_conv.o
|
|
|
|
CLANGLIBS = \
|
|
-lclangFrontend \
|
|
-lclangDriver \
|
|
-lclangSerialization \
|
|
-lclangParse \
|
|
-lclangSema \
|
|
-lclangAnalysis \
|
|
-lclangEdit \
|
|
-lclangAST \
|
|
-lclangLex \
|
|
-lclangBasic \
|
|
|
|
CXXFLAGS += -DLIBCLANG_MAJOR=$(CLANG_MAJOR) -DLIBCLANG_MINOR=$(CLANG_MINOR)
|
|
ifneq ($(CLANG_PATCHLEVEL),)
|
|
CXXFLAGS += -DLIBCLANG_PATCHLEVEL=$(CLANG_PATCHLEVEL)
|
|
endif
|
|
|
|
ifeq ($(TRICK_HOST_TYPE),Linux)
|
|
CLANGLIBS += $(shell $(LLVM_HOME)/bin/llvm-config --libs)
|
|
ifeq ($(CLANG_MINOR_GTEQ5),1)
|
|
# Fedora 21 adds -ledit as a system lib, but it isn't installed, or required.
|
|
CLANGLIBS += $(filter-out -ledit,$(shell $(LLVM_HOME)/bin/llvm-config --system-libs))
|
|
endif
|
|
endif
|
|
|
|
ifeq ($(TRICK_HOST_TYPE),Darwin)
|
|
CXXFLAGS += -std=c++11
|
|
CLANGLIBS += $(shell $(LLVM_HOME)/bin/llvm-config --libs)
|
|
CLANGLIBS += $(shell $(LLVM_HOME)/bin/llvm-config --system-libs)
|
|
CLANGLIBS += -lc++abi
|
|
endif
|
|
|
|
all: $(ICG)
|
|
|
|
$(ICG): $(OBJECTS) $(UNITS_CONV_OBJ)
|
|
$(CXX) -o $@ $(OBJECTS) $(UNITS_CONV_OBJ) $(CLANGLIBS) $(LLVMLDFLAGS)
|
|
|
|
# Only FieldDescription.cpp includes the units conversion header.
|
|
$(OBJ_DIR)/FieldDescription.o : CXXFLAGS += $(UNITS_CONV_INCLUDE)
|
|
$(OBJ_DIR)/HeaderSearchDirs.o : CXXFLAGS += -DLLVM_HOME=\"${LLVM_HOME}\"
|
|
$(OBJ_DIR)/main.o : CXXFLAGS += $(UNITS_CONV_INCLUDE) -DTRICK_VERSION=\"${TRICK_VERSION}\"
|
|
|
|
$(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:
|
|
rm -rf $(OBJ_DIR) $(ICG)
|