mirror of
https://github.com/nasa/trick.git
synced 2024-12-24 07:16:41 +00:00
144 lines
4.7 KiB
Makefile
144 lines
4.7 KiB
Makefile
|
||
# $Id: Makefile.common 3788 2015-02-02 20:24:00Z jpenn1 $
|
||
|
||
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
|
||
export TRICK_CXXFLAGS
|
||
export TRICK_LDFLAGS
|
||
export TRICK_SFLAGS
|
||
export TRICK_ICG_EXCLUDE
|
||
export TRICK_ICG_NOCOMMENT
|
||
export TRICK_SWIG_EXCLUDE
|
||
export 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 [31mPlease rerun "${TRICK_HOME}/[1m[7mconfigure[0m" to get the newest configuration changes. Then follow by running "[2m[3m[4mmake -C $$TRICK_HOME clean all[0m")
|
||
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
|
||
|
||
export USE_ER7_UTILS_INTEGRATORS := 0
|
||
ifneq ("$(wildcard $(ER7_UTILS_HOME))","") # if the er7_utils directory exists
|
||
USE_ER7_UTILS_INTEGRATORS := 1
|
||
TRICK_CFLAGS += -DUSE_ER7_UTILS_INTEGRATORS -I${ER7_UTILS_HOME}/..
|
||
TRICK_CXXFLAGS += -DUSE_ER7_UTILS_INTEGRATORS -I${ER7_UTILS_HOME}/..
|
||
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
|
||
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
|
||
|