trick/makefiles/Makefile.common
2018-01-18 09:11:06 -06:00

149 lines
5.0 KiB
Makefile
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

ifeq ( $(shell test -e ${TRICK_HOME}/trick_source/er7_utils),0)
$(info ER7 Utils Exists#########)
endif
export TRICK_HOST_TYPE := $(shell export TRICK_HOME=$(TRICK_HOME) && $(TRICK_HOME)/bin/gte TRICK_HOST_TYPE)
export TRICK_VERSION := $(shell export TRICK_HOME=$(TRICK_HOME) && $(TRICK_HOME)/bin/trick_version -v)
export TRICK_MAJOR := $(shell export TRICK_HOME=$(TRICK_HOME) && $(TRICK_HOME)/bin/trick_version -y)
export TRICK_MINOR := $(shell export TRICK_HOME=$(TRICK_HOME) && $(TRICK_HOME)/bin/trick_version -m)
-include $(TRICK_HOME)/config_${TRICK_HOST_TYPE}.mk
ifndef TRICK_CC
export TRICK_CC := $(CC)
endif
ifndef TRICK_CPPC
export TRICK_CPPC := $(CXX)
endif
ifndef TRICK_LD
export TRICK_LD := $(LD)
endif
ifndef TRICK_SFLAGS
export TRICK_SFLAGS :=
endif
export TRICK_CFLAGS := $(TRICK_CFLAGS)
export TRICK_CXXFLAGS := $(TRICK_CXXFLAGS)
export TRICK_LDFLAGS := $(TRICK_LDFLAGS)
export TRICK_SFLAGS := $(TRICK_SFLAGS)
export TRICK_ICG_EXCLUDE := $(TRICK_ICG_EXCLUDE)
export TRICK_ICG_NOCOMMENT := $(TRICK_ICG_NOCOMMENT)
export TRICK_SWIG_EXCLUDE := $(TRICK_SWIG_EXCLUDE)
export TRICK_PYTHON_PATH := $(TRICK_PYTHON_PATH)
export TRICK_GTE_EXT := $(TRICK_GTE_EXT)
export TRICK_HOST_CPU := $(shell export TRICK_CC=$(TRICK_CC) && $(TRICK_HOME)/bin/gte TRICK_HOST_CPU)
ifndef CONFIG_MK
ifneq ($(MAKECMDGOALS), clean)
$(error Please run $(TRICK_HOME)/configure before running make)
endif
endif
# Check if configure script has modifications
ifeq ($(shell test ${TRICK_HOME}/configure -nt \
${TRICK_HOME}/config_${TRICK_HOST_TYPE}.mk && echo "NEW_CONFIG"), NEW_CONFIG)
# Ignore check if using installation path of /usr/local/trick (i.e. SLAX CD)
# Timestamps during ISO creation may be misleading due to file copy prodecures
TEMP = $(shell echo "${TRICK_HOME}" | sed -e 's/\/usr\/local\/trick.*/LINUXLIVE/')
ifneq ($(TEMP), LINUXLIVE)
# Force running of the configure script if it is newer than config_*.mk)
$(warning Please rerun "${TRICK_HOME}/configure" to get the newest configuration changes. Then follow by running "make -C $$TRICK_HOME clean all")
endif
endif
# Do this section only once
ifndef TRICK_MAKE_COMMON
export TRICK_MAKE_COMMON := 1
export TRICK_INCLUDES := -I${TRICK_HOME}/trick_source -I../include
export TRICK_VERSIONS := -DTRICK_VER=$(TRICK_MAJOR) -DTRICK_MINOR=$(TRICK_MINOR)
TRICK_CFLAGS += $(TRICK_INCLUDES) $(TRICK_VERSIONS) -fpic
ifdef TRICK_CXXFLAGS
TRICK_CXXFLAGS += $(TRICK_INCLUDES) $(TRICK_VERSIONS) -fpic
else
TRICK_CXXFLAGS := ${TRICK_CFLAGS}
endif
TRICK_SFLAGS += $(TRICK_INCLUDES) $(TRICK_VERSIONS)
# append additional c and cxx flags defined in config_*.mk files.
TRICK_CFLAGS += $(TRICK_ADDITIONAL_CFLAGS)
TRICK_CXXFLAGS += $(TRICK_ADDITIONAL_CXXFLAGS)
# -fexceptions is included to propogate execptions through C code.
TRICK_CFLAGS += -fexceptions
ifeq ($(HAVE_ZEROCONF),1)
TRICK_CFLAGS += -DHAVE_ZEROCONF
TRICK_CXXFLAGS += -DHAVE_ZEROCONF
endif
ifeq ($(USE_ER7_UTILS), 1)
ER7_UTILS_HOME := $(TRICK_HOME)/trick_source/er7_utils
TRICK_CFLAGS += -DUSE_ER7_UTILS_INTEGRATORS
TRICK_CXXFLAGS += -DUSE_ER7_UTILS_INTEGRATORS
ifneq ($(wildcard ${ER7_UTILS_HOME}/CheckpointHelper),)
USE_ER7_UTILS_CHECKPOINTHELPER = 1
TRICK_SYSTEM_CFLAGS += -DUSE_ER7_UTILS_CHECKPOINTHELPER
TRICK_SYSTEM_CXXFLAGS += -DUSE_ER7_UTILS_CHECKPOINTHELPER
endif
endif
endif #TRICK_MAKE_COMMON
ifeq ($(TRICK_FORCE_32BIT), 1)
TRICK_CFLAGS += -m32
TRICK_CXXFLAGS += -m32
TRICK_LDFLAGS += -m32
endif
IS_CC_CLANG = $(shell ${TRICK_CPPC} -xc /dev/null -dM -E | grep -c __clang__)
ifeq ($(IS_CC_CLANG), 1)
TRICK_CFLAGS += -fcolor-diagnostics
TRICK_CXXFLAGS += -fcolor-diagnostics
else
GCC_MAJOR:=$(shell $(TRICK_CC) -dumpversion | cut -f1 -d.)
GCC_MINOR:=$(shell $(TRICK_CC) -dumpversion | cut -f2 -d.)
endif
ifneq ($(HDF5),)
ifneq ($(HDF5),/usr)
HDF5_LIB := -L$(HDF5)/lib -lhdf5_hl -lhdf5 -lsz
HAVE_HDF5_HOME_LIB64 := $(shell test -e ${HDF5}/lib64 && echo "1")
ifeq ($(HAVE_HDF5_HOME_LIB64),1)
HDF5_LIB = -L$(HDF5)/lib64 $(HDF5_LIB)
endif
else
HDF5_LIB = -lhdf5_hl -lhdf5
endif
endif
HAVE_GSL := $(shell test -e ${GSL_HOME}/include/gsl && echo "1")
ifeq ($(HAVE_GSL),1)
ifneq ($(GSL_HOME),/usr)
HAVE_GSL_HOME_LIB64 := $(shell test -e ${GSL_HOME}/lib64 && echo "1")
ifeq ($(HAVE_GSL_HOME_LIB64),1)
TRICK_EXEC_LINK_LIBS += -L$(GSL_HOME)/lib64
endif
TRICK_EXEC_LINK_LIBS += -L$(GSL_HOME)/lib
endif
TRICK_EXEC_LINK_LIBS += -lgsl -lgslcblas
TRICK_CFLAGS += -D_HAVE_GSL
TRICK_CXXFLAGS += -D_HAVE_GSL
endif
TRICK_INCLUDE = $(shell $(PERL) -e '@inc_paths = "${TRICK_CFLAGS}" =~ /-I\s*(\S+)/g ; foreach $$i (@inc_paths) { print "-I$$i "}')
TRICK_DEFINES = $(shell $(PERL) -e '@defines = "${TRICK_CFLAGS}" =~ /-D\s*(\S+)/g ; foreach $$i (@defines) { print "-D$$i "}')
IO_SRC_DIR := io_src/
OBJ_DIR := object_${TRICK_HOST_CPU}
TRICK_LIB_DIR := ${TRICK_HOME}/lib_${TRICK_HOST_CPU}
TRICK_BIN_DIR := ${TRICK_HOME}/bin_${TRICK_HOST_CPU}
MASTER := ${TRICK_LIB_DIR}/master.o
TRICK_LIBS := ${TRICK_LIB_DIR}/libtrick.a ${TRICK_LIB_DIR}/libtrick_pyip.a
DEPFILE = $(PWD)/Makefile_deps
DEPTEMPFILE = $(PWD)/Makefile_temp_depends