Ignore:
Timestamp:
15/02/2010 12:43:03 (2 years ago)
Author:
chris
Message:

Add support for linking to qdbm and other imported libraries with
external build systems.

Rewrite some library dependency code for readability.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/trunk/infrastructure/makebuildenv.pl.in

    r2598 r2607  
    258258        my @md; # module dependencies 
    259259        my @lo; # link line options 
    260         for(@deps) 
     260        for (@deps) 
    261261        { 
    262262                if(/\A-l/) 
     
    274274        # make directories, but not if we're using an external library and this a library module 
    275275        my ($s,$d) = split /\//,$mod; 
    276         if($s ne 'lib' || $external_lib eq '') 
     276        if ($s ne 'lib' or $external_lib eq '') 
    277277        { 
    278278                mkdir "release/$s",0755; 
     
    372372} 
    373373 
     374# Then write a makefile for each module 
    374375print "done\n\nGenerating Makefiles...\n"; 
    375376 
    376377my %module_resources_win32; 
    377378 
    378 # Then write a makefile for each module 
    379379for my $mod (@implicit_deps, @modules) 
    380380{ 
     
    776776        print MAKE $deps_makeinfo if $bsd_make; 
    777777         
    778         # get the list of library things to add -- in order of dependency so things link properly 
    779         my $lib_files = join(' ',map {($_ =~ m/lib\/(.+)\Z/)?('$(OUTBASE)/'.$_.'/'.$1.'.a'):undef} (reverse(@all_deps_for_module))); 
     778        # get the list of library things to add -- in order of dependency  
     779        # so things link properly 
     780        my @lib_files; 
     781        foreach my $dep (reverse @all_deps_for_module) 
     782        { 
     783                if ($dep =~ m|^lib\/(.+)$|) 
     784                { 
     785                        push @lib_files, "\$(OUTBASE)/$dep/$1.a"; 
     786                } 
     787                elsif ($dep =~ m|^([^/]+)$|) 
     788                { 
     789                        push @lib_files, "../../$dep/lib$1.a"; 
     790                } 
     791        } 
    780792 
    781793        # need to see if the extra makefile fragments require extra object files 
     
    796808 
    797809        print MAKE $end_target,': ',$o_file_list; 
    798         print MAKE " ",$lib_files unless $target_is_library; 
     810        print MAKE " @lib_files" unless $target_is_library; 
    799811        print MAKE "\n"; 
    800812         
     
    823835                # need to be... least used first, in absolute order they appear in the modules.txt file 
    824836                my @libops; 
     837                 
    825838                sub libops_fill 
    826839                { 
    827                         my ($m,$r) = @_; 
    828                         push @$r,$_ for(@{$module_library_link_opts{$m}}); 
    829                         libops_fill($_,$r) for(@{$module_dependency{$m}}); 
    830                 } 
     840                        my ($module, $libops_ref) = @_; 
     841                         
     842                        my $library_link_opts = $module_library_link_opts{$module}; 
     843                        if ($library_link_opts) 
     844                        { 
     845                                push @$libops_ref, @$library_link_opts; 
     846                        } 
     847                         
     848                        my $deps = $module_dependency{$module}; 
     849                        foreach my $dep (@$deps) 
     850                        { 
     851                                libops_fill($dep, $libops_ref); 
     852                        } 
     853                } 
     854                 
    831855                libops_fill($mod,\@libops); 
     856                 
    832857                my $lo = ''; 
    833858                my %ldone; 
     
    842867                print MAKE "\t\$(_LINK) \$(LDFLAGS) $link_line_extra " . 
    843868                        "-o $end_target $o_file_list " . 
    844                         "$lib_files$lo $platform_lib_files\n"; 
     869                        "@lib_files $lo $platform_lib_files\n"; 
    845870        } 
    846871        # tests need to copy the test file over 
Note: See TracChangeset for help on using the changeset viewer.