diff --git a/libexec/trick/configuration_processor b/libexec/trick/configuration_processor index 09d6ee12..e139e957 100755 --- a/libexec/trick/configuration_processor +++ b/libexec/trick/configuration_processor @@ -58,7 +58,7 @@ print OUTFILE "Output for $0 version $version-$thread at " . localtime() . "\n\n # if no python is specified, turn off the python InputProcessor sim_object in S_define. if ( $sim{args}{p} == 0 ) { - $ENV{TRICK_SFLAGS} .= " -DTRICK_NO_INPUTPROCESSOR" ; + $ENV{TRICK_SYSTEM_SFLAGS} .= " -DTRICK_NO_INPUTPROCESSOR" ; } #-------------------------------------------------------------- diff --git a/libexec/trick/make_makefile_src b/libexec/trick/make_makefile_src index 972c2754..ebdb92f8 100755 --- a/libexec/trick/make_makefile_src +++ b/libexec/trick/make_makefile_src @@ -302,27 +302,27 @@ foreach my $ext ( sort keys %object_files_by_type ) { # Write out the compile rules for each type of file. print MAKEFILE "\${MODEL_c_OBJ} : \$(CURDIR)/build\%.o : \%.c\n" ; print MAKEFILE "\t\$(PRINT_COMPILE)\n\n" ; -print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CC) \$(TRICK_CFLAGS) -I\${ \$@\n\n" ; +\t\$(TRICK_CC) -E -C -xc++ \${TRICK_SFLAGS} \$(TRICK_SYSTEM_SFLAGS) S_define > \$@\n\n" ; # write out the override files we have read in foreach $k ( sort keys %files_by_dir ) { diff --git a/libexec/trick/make_makefile_swig b/libexec/trick/make_makefile_swig index c8c23803..07e5ca59 100755 --- a/libexec/trick/make_makefile_swig +++ b/libexec/trick/make_makefile_swig @@ -206,7 +206,7 @@ SWIG_PY_OBJECTS =" ; print MAKEFILE "\t\$(PRINT_SWIG)\n" ; print MAKEFILE "\t\$(ECHO_CMD)\$(SWIG) \$(TRICK_INCLUDE) \$(TRICK_DEFINES) \$(TRICK_VERSIONS) \$(SWIG_FLAGS) -c++ -python -includeall -ignoremissing -w201,303,362,389,401,451 -outdir trick -o $swig_dir/py_${swig_file_only}.cpp \$<\n" ; print MAKEFILE "\t\$(PRINT_COMPILE_SWIG)\n" ; - print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_IO_CXXFLAGS) \$(SWIG_CFLAGS) -c $swig_dir/py_${swig_file_only}.cpp -o \$@\n\n" ; + print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(SWIG_CFLAGS) -c $swig_dir/py_${swig_file_only}.cpp -o \$@\n\n" ; print LINK_PY_OBJS "$link_py_obj\n" ; $ii++ ; @@ -223,7 +223,7 @@ SWIG_PY_OBJECTS =" ; my $wd = abs_path(cwd()) ; print MAKEFILE " -\$(SWIG_MODULE_OBJECTS) : TRICK_CXXFLAGS += -Wno-unused-parameter -Wno-redundant-decls +\$(SWIG_MODULE_OBJECTS) : TRICK_SYSTEM_CXXFLAGS += -Wno-unused-parameter -Wno-redundant-decls OBJECTS += \$(SWIG_MODULE_OBJECTS) \$(S_MAIN): \$(SWIG_MODULE_OBJECTS) @@ -239,11 +239,11 @@ OBJECTS += \$(SWIG_MODULE_OBJECTS) print MAKEFILE "$swig_src_dir/py_top.o : $swig_src_dir/py_top.cpp\n" ; print MAKEFILE "\t\$(PRINT_COMPILE_SWIG)\n" ; - print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(SWIG_CFLAGS) -c \$< -o \$@\n\n" ; + print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(SWIG_CFLAGS) -c \$< -o \$@\n\n" ; print MAKEFILE "$swig_src_dir/init_swig_modules.o : $swig_src_dir/init_swig_modules.cpp\n" ; print MAKEFILE "\t\$(PRINT_COMPILE_SWIG)\n" ; - print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(SWIG_CFLAGS) -c \$< -o \$@\n\n" ; + print MAKEFILE "\t\$(ECHO_CMD)\$(TRICK_CPPC) \$(TRICK_CXXFLAGS) \$(TRICK_SYSTEM_CXXFLAGS) \$(SWIG_CFLAGS) -c \$< -o \$@\n\n" ; print MAKEFILE "TRICK_FIXED_PYTHON = \\ $swig_sim_dir/swig_double.py \\ diff --git a/libexec/trick/pm/gte.pm b/libexec/trick/pm/gte.pm index 8b553819..2f4097df 100644 --- a/libexec/trick/pm/gte.pm +++ b/libexec/trick/pm/gte.pm @@ -90,6 +90,7 @@ sub gte (@) { $def{"TRICK_ICG_NOCOMMENT"} = "" ; $def{"TRICK_ICG_EXCLUDE"} = "" ; $def{"TRICK_SWIG_EXCLUDE"} = "" ; + $def{"TRICK_EXT_LIB_DIRS"} = "" ; $def{"TRICK_LDFLAGS"} = "" ; $def{"TRICK_MAKE"} = "" ; $def{"TRICK_PATH"} = "$trick_home/bin" ; diff --git a/libexec/trick/pm/parse_s_define.pm b/libexec/trick/pm/parse_s_define.pm index deedb93a..3f104ca0 100644 --- a/libexec/trick/pm/parse_s_define.pm +++ b/libexec/trick/pm/parse_s_define.pm @@ -178,9 +178,9 @@ sub parse_s_define ($) { my @preprocess_output; # Get Include Paths From $TRICK_CFLAGS - @{$$sim_ref{inc_paths}} = $ENV{"TRICK_CFLAGS"} =~ /-I\s*(\S+)/g ; + @{$$sim_ref{inc_paths}} = "$ENV{TRICK_CFLAGS} $ENV{TRICK_SYSTEM_CFLAGS}" =~ /-I\s*(\S+)/g ; - push @{$$sim_ref{inc_paths}} , ("$ENV{\"TRICK_HOME\"}/trick_source" , "../include") ; + push @{$$sim_ref{inc_paths}} , ("$ENV{TRICK_HOME}/trick_source" , "../include") ; my @valid_inc_paths ; foreach (@{$$sim_ref{inc_paths}}) { @@ -209,8 +209,8 @@ sub parse_s_define ($) { if (-e $s_define_file) { my $cmd; - $cmd = "$CC -C -E -xc $ENV{TRICK_SFLAGS} $s_define_file"; - #print "$cmd\n" ; + $cmd = "$CC -C -E -xc $ENV{TRICK_SFLAGS} $ENV{TRICK_SYSTEM_SFLAGS} $s_define_file"; + print "$cmd\n" ; @preprocess_output = `$cmd`; diff --git a/share/trick/makefiles/Makefile.common b/share/trick/makefiles/Makefile.common index fea05fab..15087b35 100644 --- a/share/trick/makefiles/Makefile.common +++ b/share/trick/makefiles/Makefile.common @@ -41,6 +41,9 @@ export TRICK_GTE_EXT export TRICK_HOST_CPU := $(shell export TRICK_CC=$(TRICK_CC) && $(TRICK_HOME)/bin/trick-gte TRICK_HOST_CPU) export TRICK_EXEC_LINK_LIBS = ${PTHREAD_LIBS} $(PYTHON_LIB) $(PLATFORM_LIBS) -lm -ldl -lz export TRICK_LIBS = ${RPATH} -L${TRICK_LIB_DIR} -ltrick -ltrick_pyip -ltrick_comm -ltrick_math -ltrick_units -ltrick_mm +export TRICK_SYSTEM_CFLAGS +export TRICK_SYSTEM_CXXFLAGS +export TRICK_SYSTEM_SFLAGS IO_SRC_DIR := io_src/ OBJ_DIR := object_${TRICK_HOST_CPU} @@ -65,33 +68,33 @@ ifeq ($(MAKELEVEL),0) export TRICK_INCLUDES := -I${TRICK_HOME}/trick_source -I${TRICK_HOME}/include -I${TRICK_HOME}/include/trick/compat export TRICK_VERSIONS := -DTRICK_VER=$(TRICK_MAJOR) -DTRICK_MINOR=$(TRICK_MINOR) -TRICK_CFLAGS += $(TRICK_INCLUDES) $(TRICK_VERSIONS) -fpic +TRICK_SYSTEM_CFLAGS = $(TRICK_INCLUDES) $(TRICK_VERSIONS) -fpic ifdef TRICK_CXXFLAGS - TRICK_CXXFLAGS += $(TRICK_INCLUDES) $(TRICK_VERSIONS) -fpic + TRICK_SYSTEM_CXXFLAGS += $(TRICK_INCLUDES) $(TRICK_VERSIONS) -fpic else - TRICK_CXXFLAGS := ${TRICK_CFLAGS} + TRICK_SYSTEM_CXXFLAGS := ${TRICK_CFLAGS} endif -TRICK_SFLAGS += -I${TRICK_HOME}/share/trick $(TRICK_INCLUDES) $(TRICK_VERSIONS) +TRICK_SYSTEM_SFLAGS += -I${TRICK_HOME}/share/trick $(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) +TRICK_SYSTEM_CFLAGS += $(TRICK_ADDITIONAL_CFLAGS) +TRICK_SYSTEM_CXXFLAGS += $(TRICK_ADDITIONAL_CXXFLAGS) # -fexceptions is included to propogate execptions through C code. -TRICK_CFLAGS += -fexceptions +TRICK_SYSTEM_CFLAGS += -fexceptions HAVE_ZEROCONF ?= 0 ifeq ($(HAVE_ZEROCONF),1) -TRICK_CFLAGS += -DHAVE_ZEROCONF -TRICK_CXXFLAGS += -DHAVE_ZEROCONF +TRICK_SYSTEM_CFLAGS += -DHAVE_ZEROCONF +TRICK_SYSTEM_CXXFLAGS += -DHAVE_ZEROCONF endif export USE_ER7_UTILS_INTEGRATORS := 0 ifneq ("$(wildcard $(TRICK_HOME)/trick_source/er7_utils)","") # if the er7_utils directory exists ER7_UTILS_HOME := $(TRICK_HOME)/trick_source/er7_utils USE_ER7_UTILS_INTEGRATORS := 1 - TRICK_CFLAGS += -DUSE_ER7_UTILS_INTEGRATORS - TRICK_CXXFLAGS += -DUSE_ER7_UTILS_INTEGRATORS + TRICK_SYSTEM_CFLAGS += -DUSE_ER7_UTILS_INTEGRATORS + TRICK_SYSTEM_CXXFLAGS += -DUSE_ER7_UTILS_INTEGRATORS endif endif # MAKELEVEL = 0 @@ -101,16 +104,16 @@ ifeq ($(USE_ER7_UTILS_INTEGRATORS), 1) endif ifeq ($(TRICK_FORCE_32BIT), 1) - TRICK_CFLAGS += -m32 - TRICK_CXXFLAGS += -m32 + TRICK_SYSTEM_CFLAGS += -m32 + TRICK_SYSTEM_CXXFLAGS += -m32 TRICK_LDFLAGS += -m32 LD_PARTIAL += -melf_i386 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 + TRICK_SYSTEM_CFLAGS += -fcolor-diagnostics + TRICK_SYSTEM_CXXFLAGS += -fcolor-diagnostics else GCC_MAJOR:=$(shell $(TRICK_CC) -dumpversion | cut -f1 -d.) GCC_MINOR:=$(shell $(TRICK_CC) -dumpversion | cut -f2 -d.) @@ -142,7 +145,9 @@ ifeq ($(HAVE_GSL),1) endif TRICK_INCLUDE = $(shell $(PERL) -e '@inc_paths = "${TRICK_CFLAGS}" =~ /-I\s*(\S+)/g ; foreach $$i (@inc_paths) { print "-I$$i " if (-e $$i)}') +TRICK_INCLUDE += $(shell $(PERL) -e '@inc_paths = "${TRICK_SYSTEM_CFLAGS}" =~ /-I\s*(\S+)/g ; foreach $$i (@inc_paths) { print "-I$$i " if (-e $$i)}') TRICK_DEFINES = $(shell $(PERL) -e '@defines = "${TRICK_CFLAGS}" =~ /-D\s*(\S+)/g ; foreach $$i (@defines) { print "-D$$i "}') +TRICK_DEFINES += $(shell $(PERL) -e '@defines = "${TRICK_SYSTEM_CFLAGS}" =~ /-D\s*(\S+)/g ; foreach $$i (@defines) { print "-D$$i "}') DEPFILE = $(PWD)/Makefile_deps DEPTEMPFILE = $(PWD)/Makefile_temp_depends diff --git a/share/trick/makefiles/Makefile.sim b/share/trick/makefiles/Makefile.sim index de2154d2..3c3a5c7c 100644 --- a/share/trick/makefiles/Makefile.sim +++ b/share/trick/makefiles/Makefile.sim @@ -53,15 +53,15 @@ S_source.hh : S_define | build # Automatic and manual ICG rules $(CURDIR)/build/Makefile_io_src : | S_source.hh $(PRINT_ICG) - $(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -m ${TRICK_CXXFLAGS} S_source.hh + $(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -m ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} S_source.hh ICG: $(PRINT_ICG) - $(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -m ${TRICK_CXXFLAGS} S_source.hh + $(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -m ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} S_source.hh force_ICG: $(PRINT_ICG) - $(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -f -m ${TRICK_CXXFLAGS} S_source.hh + $(ECHO_CMD)${TRICK_HOME}/bin/trick-ICG -f -m ${TRICK_CXXFLAGS} ${TRICK_SYSTEM_CXXFLAGS} S_source.hh # Create makefile for source code $(CURDIR)/build/Makefile_src: $(CURDIR)/build/Makefile_io_src diff --git a/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp b/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp index 643b3adf..6d97541e 100644 --- a/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp +++ b/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp @@ -417,18 +417,18 @@ void PrintAttributes::printIOMakefile() { std::cout << "Creating/updating io_src Makefile" << std::endl ; makefile_io_src.open("build/Makefile_io_src") ; - makefile_io_src << "TRICK_IO_CXXFLAGS := \\" << std::endl ; + makefile_io_src << "TRICK_SYSTEM_CXXFLAGS += \\" << std::endl ; makefile_io_src << " -Wno-invalid-offsetof \\" << std::endl ; makefile_io_src << " -Wno-old-style-cast \\" << std::endl ; makefile_io_src << " -Wno-write-strings \\" << std::endl ; makefile_io_src << " -Wno-unused-variable" << std::endl ; makefile_io_src << std::endl ; makefile_io_src << "ifeq ($(IS_CC_CLANG), 0)" << std::endl ; - makefile_io_src << " TRICK_IO_CXXFLAGS += -Wno-unused-local-typedefs" << std::endl ; + makefile_io_src << " TRICK_SYSTEM_CXXFLAGS += -Wno-unused-local-typedefs" << std::endl ; makefile_io_src << " GCCVERSIONGTEQ48 := $(shell perl -e 'printf \"\%d\\n\", " << "($(GCC_MAJOR)>4)||(($(GCC_MAJOR)==4)&&($(GCC_MINOR)>=8)) ;' )" << std::endl ; makefile_io_src << " ifeq ($(GCCVERSIONGTEQ48), 1)" << std::endl ; - makefile_io_src << " TRICK_IO_CXXFLAGS += -Wno-unused-but-set-variable" << std::endl ; + makefile_io_src << " TRICK_SYSTEM_CXXFLAGS += -Wno-unused-but-set-variable" << std::endl ; makefile_io_src << " endif" << std::endl ; makefile_io_src << "endif" << std::endl ; makefile_io_src << std::endl ; @@ -457,7 +457,7 @@ void PrintAttributes::printIOMakefile() { makefile_io_src << "$(IO_OBJ_FILES) : \%.o : \%.cpp" << std::endl ; makefile_io_src << "\t$(PRINT_IO_COMPILE)" << std::endl ; - makefile_io_src << "\t$(ECHO_CMD)$(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_IO_CXXFLAGS) -MMD -MP -c $< -o $@" << std::endl ; + makefile_io_src << "\t$(ECHO_CMD)$(TRICK_CPPC) $(TRICK_CXXFLAGS) $(TRICK_SYSTEM_CXXFLAGS) -MMD -MP -c $< -o $@" << std::endl ; makefile_io_src << std::endl ; makefile_io_src << "-include $(IO_OBJ_FILES:.o=.d)" << std::endl ; makefile_io_src << std::endl ;