Split CP up into components that can be called individually

Renamed some output file to make it more obvious what produced them.

refs #86
This commit is contained in:
Alex Lin 2015-07-23 10:30:55 -05:00
parent a2bc82f1e9
commit fc9c604056
4 changed files with 27 additions and 10 deletions

View File

@ -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) = <FILE> ; my (@top_lib_dep_file_names) = <FILE> ;
close FILE ; close FILE ;
chomp @top_lib_dep_file_names ; chomp @top_lib_dep_file_names ;
@ -227,7 +227,7 @@ else
PRINT_COMPILE = \@echo \"Compiling  \$(subst \$(CURDIR)/build,build,\$<)\" PRINT_COMPILE = \@echo \"Compiling  \$(subst \$(CURDIR)/build,build,\$<)\"
PRINT_INC_LINK = \@echo \"Partial link \$(subst \$(CURDIR)/build,build,\${<D})\" PRINT_INC_LINK = \@echo \"Partial link \$(subst \$(CURDIR)/build,build,\${<D})\"
PRINT_EXE_LINK = \@echo \"Final link  \$(subst \$(CURDIR)/,,\$(S_MAIN))\" PRINT_EXE_LINK = \@echo \"Final link  \$(subst \$(CURDIR)/,,\$(S_MAIN))\"
PRINT_S_DEF_DEPS = \@echo \"Get depends  for S_define\" PRINT_S_DEF_DEPS = \@echo \"Get depends  S_define\"
ECHO_CMD = \@ ECHO_CMD = \@
ifeq (\$(MAKECMDGOALS), all) ifeq (\$(MAKECMDGOALS), all)
\$(info Performing build with these compilation flags) \$(info Performing build with these compilation flags)
@ -380,7 +380,7 @@ S_main : \$(S_MAIN) build/S_define.deps S_sie.resource
\$(S_MAIN): \${TRICK_STATIC_LIB} \$(OBJECTS) \$(S_OBJECT_FILES) \$(S_MAIN): \${TRICK_STATIC_LIB} \$(OBJECTS) \$(S_OBJECT_FILES)
\t\$(PRINT_EXE_LINK) \t\$(PRINT_EXE_LINK)
\t\$(ECHO_CMD)\$(TRICK_LD) \$(TRICK_LDFLAGS) -o \$@ \\ \t\$(ECHO_CMD)\$(TRICK_LD) \$(TRICK_LDFLAGS) -o \$@ \\
\t\t\$(S_OBJECT_FILES) \$(OBJECTS) \\ \t\t\$(S_OBJECT_FILES) \$(LD_FILELIST)build/link_objs \$(LINK_OBJECTS)\\
\t\t\${TRICK_USER_LINK_LIBS} \${READ_ONLY_LIBS} \\ \t\t\${TRICK_USER_LINK_LIBS} \${READ_ONLY_LIBS} \\
\t\t\$(LD_WHOLE_ARCHIVE) \${TRICK_LIBS} \$(LD_NO_WHOLE_ARCHIVE)\\ \t\t\$(LD_WHOLE_ARCHIVE) \${TRICK_LIBS} \$(LD_NO_WHOLE_ARCHIVE)\\
\t\t\${TRICK_EXEC_LINK_LIBS} \t\t\${TRICK_EXEC_LINK_LIBS}
@ -425,6 +425,22 @@ print MAKEFILE "include build/Makefile_swig\n" ;
print MAKEFILE "-include S_overrides.mk\n" ; print MAKEFILE "-include S_overrides.mk\n" ;
close MAKEFILE ; close MAKEFILE ;
open LINKOBJS, ">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 # 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" ; open MAKEFILEDEPS, ">build/Makefile_src_deps" or die "Could not open build/Makefile_src_deps" ;
print MAKEFILEDEPS "\$(CURDIR)/build/Makefile_src :" ; print MAKEFILEDEPS "\$(CURDIR)/build/Makefile_src :" ;

View File

@ -69,7 +69,7 @@ sub read_files_to_process() {
close FILE ; close FILE ;
chomp @files_to_process ; 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 = <FILE> ; @ext_lib_files = <FILE> ;
close FILE ; close FILE ;
chomp @ext_lib_files ; chomp @ext_lib_files ;
@ -187,7 +187,6 @@ SWIG_PY_OBJECTS =" ;
push @{$python_modules{"root"}} , $f ; push @{$python_modules{"root"}} , $f ;
# } # }
my ($continue) = 1 ;
my $md5_sum = md5_hex($f) ; my $md5_sum = md5_hex($f) ;
# check if .sm file was accidentally ##included instead of #included # check if .sm file was accidentally ##included instead of #included
if ( rindex($swig_f,".sm") != -1 ) { 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 \$(SWIG_MODULE_OBJECTS) : TRICK_SYSTEM_CXXFLAGS += -Wno-unused-parameter -Wno-redundant-decls
OBJECTS += \$(SWIG_MODULE_OBJECTS) OBJECTS += \$(SWIG_MODULE_OBJECTS)
LINK_OBJECTS += \$(SWIG_MODULE_OBJECTS)
\$(S_MAIN): \$(SWIG_MODULE_OBJECTS) \$(S_MAIN): \$(SWIG_MODULE_OBJECTS)
\$(SWIG_MODULE_OBJECTS) : \$(SWIG_PY_OBJECTS) | \$(LIB_DIR) \$(SWIG_MODULE_OBJECTS) : \$(SWIG_PY_OBJECTS) | \$(LIB_DIR)
@ -273,7 +273,7 @@ OBJECTS += \$(SWIG_MODULE_OBJECTS)
} }
close SWIGLIB ; close SWIGLIB ;
open S_INSTANCE , "build/S_instances" or return ; open S_INSTANCE , "build/CP_instances" or return ;
my @instances = <S_INSTANCE> ; my @instances = <S_INSTANCE> ;
close S_INSTANCE ; close S_INSTANCE ;
open TOPFILE , ">build/top.i" or return ; open TOPFILE , ">build/top.i" or return ;

View File

@ -318,7 +318,7 @@ PURPOSE:
close S_SOURCE ; 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} ; print S_INSTANCE $$sim_ref{extern_instance_declarations} ;
foreach my $integ_loop ( @{$$sim_ref{integ_loop}} ) { foreach my $integ_loop ( @{$$sim_ref{integ_loop}} ) {
print S_INSTANCE "extern IntegLoopSimObject $$integ_loop{name} ;\n" ; print S_INSTANCE "extern IntegLoopSimObject $$integ_loop{name} ;\n" ;

View File

@ -463,6 +463,7 @@ void PrintAttributes::printIOMakefile() {
makefile_io_src << std::endl ; makefile_io_src << std::endl ;
makefile_io_src << "OBJECTS += $(LIB_DIR)/io_src.o" << 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 << "$(S_MAIN) : $(LIB_DIR)/io_src.o" << std::endl ;
makefile_io_src << std::endl ; makefile_io_src << std::endl ;
makefile_io_src << "$(LIB_DIR)/io_src.o : $(IO_OBJ_FILES) | $(LIB_DIR)" << 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() ; link_io_objs.close() ;
ICG_processed.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++ ) { for ( sit = ext_lib_io_files.begin() ; sit != ext_lib_io_files.end() ; sit++ ) {
ext_lib << (*sit) << std::endl ; ext_lib << (*sit) << std::endl ;
} }
@ -515,7 +516,7 @@ void PrintAttributes::printHeaderLibraryDependencies() {
std::ofstream header_lib_deps ; std::ofstream header_lib_deps ;
std::cout << "Searching header files for Library Dependencies" << std::endl ; 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 ; std::map< std::string , std::string >::iterator mit ;
for ( mit = all_io_files.begin() ; mit != all_io_files.end() ; mit++ ) { for ( mit = all_io_files.begin() ; mit != all_io_files.end() ; mit++ ) {
size_t found ; size_t found ;
@ -564,7 +565,7 @@ void PrintAttributes::printHeaderLibraryDependencies() {
void PrintAttributes::printICGNoFiles() { void PrintAttributes::printICGNoFiles() {
if ( ! sim_services_flag ) { if ( ! sim_services_flag ) {
std::vector< std::string >::iterator it ; 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++ ) { for ( it = icg_no_files.begin() ; it != icg_no_files.end() ; it++ ) {
icg_no_outfile << (*it) << std::endl ; icg_no_outfile << (*it) << std::endl ;
} }