From fc9c604056a78437359f8dbd5bf6b9af3b546993 Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Thu, 23 Jul 2015 10:30:55 -0500 Subject: [PATCH] Split CP up into components that can be called individually Renamed some output file to make it more obvious what produced them. refs #86 --- libexec/trick/make_makefile_src | 22 ++++++++++++++++--- libexec/trick/make_makefile_swig | 6 ++--- libexec/trick/pm/s_source.pm | 2 +- .../Interface_Code_Gen/PrintAttributes.cpp | 7 +++--- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/libexec/trick/make_makefile_src b/libexec/trick/make_makefile_src index ebdb92f8..4bc6b881 100755 --- a/libexec/trick/make_makefile_src +++ b/libexec/trick/make_makefile_src @@ -51,7 +51,7 @@ for my $f ( @ARGV ) { } } -open FILE, "build/header_lib_deps_files" or die 'cannot open build/header_lib_deps_files' ; +open FILE, "build/ICG_lib_deps" or die 'cannot open build/header_lib_deps' ; my (@top_lib_dep_file_names) = ; close FILE ; chomp @top_lib_dep_file_names ; @@ -227,7 +227,7 @@ else PRINT_COMPILE = \@echo \"Compiling  \$(subst \$(CURDIR)/build,build,\$<)\" PRINT_INC_LINK = \@echo \"Partial link \$(subst \$(CURDIR)/build,build,\${build/link_objs" or die "Could not open build/link_objs" ; +foreach $k ( sort keys %files_by_dir ) { + foreach my $ext ( qw{ c C cc cxx cpp c++ l y} ) { + my $print_ext ; + if ( $ext eq "c++" ) { + $print_ext = "CPLUSPLUS" ; + } else { + $print_ext = $ext ; + } + if ( scalar @{$files_by_dir{$k}{$ext}} ne 0 ) { + print LINKOBJS "build/lib/o_${print_ext}_$files_by_dir{$k}{dir_num}.o\n" ; + } + } +} +close LINKOBJS ; + # write out all of files as dependencies to Makefile_src open MAKEFILEDEPS, ">build/Makefile_src_deps" or die "Could not open build/Makefile_src_deps" ; print MAKEFILEDEPS "\$(CURDIR)/build/Makefile_src :" ; diff --git a/libexec/trick/make_makefile_swig b/libexec/trick/make_makefile_swig index 794de7a2..0898865b 100755 --- a/libexec/trick/make_makefile_swig +++ b/libexec/trick/make_makefile_swig @@ -69,7 +69,7 @@ sub read_files_to_process() { close FILE ; chomp @files_to_process ; - open FILE, "build/external_lib_header_files" or die 'could not open build/external_lib_header_files' ; + open FILE, "build/ICG_ext_lib" or die 'could not open build/ICG_ext_lib' ; @ext_lib_files = ; close FILE ; chomp @ext_lib_files ; @@ -187,7 +187,6 @@ SWIG_PY_OBJECTS =" ; push @{$python_modules{"root"}} , $f ; # } - my ($continue) = 1 ; my $md5_sum = md5_hex($f) ; # check if .sm file was accidentally ##included instead of #included if ( rindex($swig_f,".sm") != -1 ) { @@ -226,6 +225,7 @@ SWIG_PY_OBJECTS =" ; \$(SWIG_MODULE_OBJECTS) : TRICK_SYSTEM_CXXFLAGS += -Wno-unused-parameter -Wno-redundant-decls OBJECTS += \$(SWIG_MODULE_OBJECTS) +LINK_OBJECTS += \$(SWIG_MODULE_OBJECTS) \$(S_MAIN): \$(SWIG_MODULE_OBJECTS) \$(SWIG_MODULE_OBJECTS) : \$(SWIG_PY_OBJECTS) | \$(LIB_DIR) @@ -273,7 +273,7 @@ OBJECTS += \$(SWIG_MODULE_OBJECTS) } close SWIGLIB ; - open S_INSTANCE , "build/S_instances" or return ; + open S_INSTANCE , "build/CP_instances" or return ; my @instances = ; close S_INSTANCE ; open TOPFILE , ">build/top.i" or return ; diff --git a/libexec/trick/pm/s_source.pm b/libexec/trick/pm/s_source.pm index 59c2d940..4f29ebba 100644 --- a/libexec/trick/pm/s_source.pm +++ b/libexec/trick/pm/s_source.pm @@ -318,7 +318,7 @@ PURPOSE: close S_SOURCE ; - open S_INSTANCE, ">build/S_instances" or die "Couldn't open build/S_instances!\n"; + open S_INSTANCE, ">build/CP_instances" or die "Couldn't open build/CP_instances!\n"; print S_INSTANCE $$sim_ref{extern_instance_declarations} ; foreach my $integ_loop ( @{$$sim_ref{integ_loop}} ) { print S_INSTANCE "extern IntegLoopSimObject $$integ_loop{name} ;\n" ; diff --git a/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp b/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp index 6d97541e..ff61f05d 100644 --- a/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp +++ b/trick_source/codegen/Interface_Code_Gen/PrintAttributes.cpp @@ -463,6 +463,7 @@ void PrintAttributes::printIOMakefile() { makefile_io_src << std::endl ; makefile_io_src << "OBJECTS += $(LIB_DIR)/io_src.o" << std::endl ; + makefile_io_src << "LINK_OBJECTS += $(LIB_DIR)/io_src.o" << std::endl ; makefile_io_src << "$(S_MAIN) : $(LIB_DIR)/io_src.o" << std::endl ; makefile_io_src << std::endl ; makefile_io_src << "$(LIB_DIR)/io_src.o : $(IO_OBJ_FILES) | $(LIB_DIR)" << std::endl ; @@ -504,7 +505,7 @@ void PrintAttributes::printIOMakefile() { link_io_objs.close() ; ICG_processed.close() ; - ext_lib.open("build/external_lib_header_files") ; + ext_lib.open("build/ICG_ext_lib") ; for ( sit = ext_lib_io_files.begin() ; sit != ext_lib_io_files.end() ; sit++ ) { ext_lib << (*sit) << std::endl ; } @@ -515,7 +516,7 @@ void PrintAttributes::printHeaderLibraryDependencies() { std::ofstream header_lib_deps ; std::cout << "Searching header files for Library Dependencies" << std::endl ; - header_lib_deps.open("build/header_lib_deps_files") ; + header_lib_deps.open("build/ICG_lib_deps") ; std::map< std::string , std::string >::iterator mit ; for ( mit = all_io_files.begin() ; mit != all_io_files.end() ; mit++ ) { size_t found ; @@ -564,7 +565,7 @@ void PrintAttributes::printHeaderLibraryDependencies() { void PrintAttributes::printICGNoFiles() { if ( ! sim_services_flag ) { std::vector< std::string >::iterator it ; - std::ofstream icg_no_outfile("build/icg_no_found") ; + std::ofstream icg_no_outfile("build/ICG_no_found") ; for ( it = icg_no_files.begin() ; it != icg_no_files.end() ; it++ ) { icg_no_outfile << (*it) << std::endl ; }