summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorspecial <special@e03df62e-2008-0410-955e-edbf42e46eb7>2007-09-15 10:07:23 +0000
committerspecial <special@e03df62e-2008-0410-955e-edbf42e46eb7>2007-09-15 10:07:23 +0000
commit64f5e9a893ca8a68165f918c195b6a2cf284b58c (patch)
treed4a7043bdffd91d5ac5eb148985a0b9721520774 /configure
parentad189b60a19b7b8b4c56d4160d238d074d7a2c3e (diff)
Added support for subdirectories in module directories (for organization). I hate perl.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8039 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure56
1 files changed, 34 insertions, 22 deletions
diff --git a/configure b/configure
index d65b9850c..278bc9bbd 100755
--- a/configure
+++ b/configure
@@ -1274,34 +1274,21 @@ EOCHEESE
opendir(DIRHANDLE, "src/modules");
foreach $name (sort readdir(DIRHANDLE)) {
if ($name =~ /^m_(.+?)$/) {
- $crapola = "";
- $crap3 = "";
+ $mfrules = "";
+ $mobjs = "";
$mliflags = "";
+ $mfcount = 0;
# A module made of multiple files, in a dir, e.g. src/modules/m_spanningtree/
if (opendir(MDIRHANDLE, "src/modules/$name") != 0) {
- my $i = 0;
- print FILEHANDLE "$name.so: ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h";
- foreach $fname (sort readdir(MDIRHANDLE)) {
- if ($fname =~ /\.cpp$/) {
- $cmflags = getcompilerflags("src/modules/$name/$fname");
- $mliflags = $mliflags . " " . getlinkerflags("src/modules/$name/$fname");
- $deps = getdependencies("src/modules/$name/$fname");
- $oname = $fname;
- $oname =~ s/\.cpp$/.o/g;
- print FILEHANDLE " $name/$oname";
- $crapola = $crapola . "$name/$oname: $name/$fname ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $deps\n";
- $crapola = $crapola . " \$(CC) -pipe -I../../include -I. \$(FLAGS) $cmflags -export-dynamic -o $name/$oname -c $name/$fname\n\n";
- $crap3 = $crap3 . " $name/$oname";
- $i++;
- }
- }
- print "Composing Makefile rules for directory \033[1;32m$name\033[0m... (\033[1;32m$i files found\033[0m)\n";
+ read_module_directory("src/modules/$name", $name);
+ print "Composing Makefile rules for directory \033[1;32m$name\033[0m... (\033[1;32m$mfcount files found\033[0m)\n";
+ print FILEHANDLE "$name.so: ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $mobjs\n";
if ($config{IS_DARWIN} eq "YES") {
- print FILEHANDLE "\n \$(CC) -pipe -twolevel_namespace -undefined dynamic_lookup \$(FLAGS) -bundle -o $name.so $crap3\n";
+ print FILEHANDLE " \$(CC) -pipe -twolevel_namespace -undefined dynamic_lookup \$(FLAGS) $mliflags -bundle -o $name.so $mobjs\n";
} else {
- print FILEHANDLE "\n \$(CC) -pipe \$(FLAGS) -shared $mliflags -o $name.so $crap3\n";
+ print FILEHANDLE " \$(CC) -pipe \$(FLAGS) -shared $mliflags -o $name.so $mobjs\n";
}
- print FILEHANDLE "\n$crapola\n";
+ print FILEHANDLE "\n$mfrules\n";
closedir(MDIRHANDLE);
$crud = $crud . " install -m \$(INSTMODE) $name.so \$(MODPATH)\n";
}
@@ -1312,6 +1299,31 @@ EOCHEESE
print FILEHANDLE "modinst:\n \@echo \"Installing modules...\"\n" . $crud;
}
+sub read_module_directory {
+ my ($dpath, $reldpath) = @_;
+
+ if (opendir(MDIRHANDLE, $dpath) == 0) {
+ return;
+ }
+
+ foreach $fname (sort readdir(MDIRHANDLE)) {
+ if ($fname =~ /\.cpp$/) {
+ $cmflags = getcompilerflags("$dpath/$fname");
+ $mliflags = $mliflags . " " . getlinkerflags("$dpath/$fname");
+ $deps = getdependencies("$dpath/$fname");
+ $oname = $fname;
+ $oname =~ s/\.cpp$/.o/g;
+ $mfrules = $mfrules . "$reldpath/$oname: $reldpath/$fname ../../include/modules.h ../../include/users.h ../../include/channels.h ../../include/base.h ../../include/inspircd_config.h ../../include/inspircd.h ../../include/configreader.h $deps\n";
+ $mfrules = $mfrules . " \$(CC) -pipe -I../../include -I. \$(FLAGS) $cmflags -export-dynamic -o $reldpath/$oname -c $reldpath/$fname\n\n";
+ $mobjs = $mobjs . " $reldpath/$oname";
+ $mfcount++;
+ }
+ elsif ((-d "$dpath/$fname") && !($fname eq ".") && !($fname eq "..")) {
+ read_module_directory($dpath."/".$fname, $reldpath."/".$fname);
+ }
+ }
+}
+
sub write_dynamic_makefile {
my $i = 0;