X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=make%2Fcalcdep.pl;h=55e0630fc80da3497470661fdd98a7dfde843282;hb=23e62cef071f8d037b2d163d60bcc85f5887776c;hp=890d8d2658e250b6b8330f082781bf01779761bc;hpb=7aa5e059a8f66d91bd8b69c58c657ceb70b4baff;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/make/calcdep.pl b/make/calcdep.pl index 890d8d265..55e0630fc 100755 --- a/make/calcdep.pl +++ b/make/calcdep.pl @@ -3,7 +3,7 @@ use strict; use warnings; use POSIX qw(getcwd); -sub find_output($); +sub find_output; sub gendep($); sub dep_cpp($$); sub dep_dir($); @@ -28,27 +28,42 @@ sub run() { open MAKE, '>real.mk' or die "Could not write real.mk: $!"; chdir "$ENV{SOURCEPATH}/src"; + if ($ENV{PURE_STATIC}) { + run_static(); + } else { + run_dynamic(); + } + close MAKE; +} + +sub run_dynamic() { + my $build = $ENV{BUILDPATH}; print MAKE <, , , "threadengines/threadengine_pthread.cpp") { my $out = find_output $file; dep_cpp $file, $out; next if $file =~ m#^socketengines/# && $file ne "socketengines/$ENV{SOCKETENGINE}.cpp"; push @core_deps, $out; } - - my @modlist; + for my $file () { my $out = find_output $file; dep_cpp $file, $out; - push @modlist, $out; + push @cmdlist, $out; } opendir my $moddir, 'modules'; @@ -72,6 +87,7 @@ END } my $core_mk = join ' ', @core_deps; + my $cmds = join ' ', @cmdlist; my $mods = join ' ', @modlist; print MAKE < inspircd: bin/inspircd + +commands: $cmds + modules: $mods -.PHONY: inspircd modules +.PHONY: all bad-target inspircd commands modules + +END +} + +sub run_static() { + print MAKE <, , , , + , , "threadengines/threadengine_pthread.cpp") { + my $out = find_output $file, 1; + if ($out =~ m#obj/([^/]+)/[^/]+.o$#) { + mkdir "$ENV{BUILDPATH}/obj/$1"; + } + dep_cpp $file, $out; + next if $file =~ m#^socketengines/# && $file ne "socketengines/$ENV{SOCKETENGINE}.cpp"; + push @deps, $out; + push @srcs, $file; + } + + my $core_mk = join ' ', @deps; + my $core_src = join ' ', @srcs; + print MAKE < + +bin/inspircd: obj/ld-extra.cmd $core_mk + \@\$(SOURCEPATH)/make/unit-cc.pl -l\$(VERBOSE) \$\@ \$^ \$> + +inspircd: bin/inspircd + +.PHONY: all bad-target inspircd END } -sub find_output($) { - my $file = shift; +sub find_output { + my($file, $static) = @_; my($path,$base) = $file =~ m#^((?:.*/)?)([^/]+)\.cpp# or die "Bad file $file"; if ($path eq 'modules/' || $path eq 'commands/') { - return "modules/$base.so"; + return $static ? "obj/$base.o" : "modules/$base.so"; } elsif ($path eq '' || $path eq 'modes/' || $path =~ /^[a-z]+engines\/$/) { return "obj/$base.o"; } elsif ($path =~ m#modules/(m_.*)/#) {