summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-22 19:53:23 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-10-22 19:53:23 +0000
commitab6a7318e36bd8e0a259cd9eef3694a0f0e8684a (patch)
treec7b1a23d234224b6be12eb6f73501d73c85b6c74
parent6ded0e838fa1b173b4a37bc0369dc0f640b4c1ca (diff)
Remove the need for a bunch of the hard coded arrays/hashes by scanning the src/ dir for tag comments, like in modules
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8307 e03df62e-2008-0410-955e-edbf42e46eb7
-rwxr-xr-xconfigure129
-rw-r--r--src/base.cpp2
-rw-r--r--src/channels.cpp2
-rw-r--r--src/command_parse.cpp2
-rw-r--r--src/commands.cpp2
-rw-r--r--src/configreader.cpp2
-rw-r--r--src/cull_list.cpp2
-rw-r--r--src/dns.cpp2
-rw-r--r--src/dynamic.cpp2
-rw-r--r--src/filelogger.cpp2
-rw-r--r--src/hashcomp.cpp2
-rw-r--r--src/helperfuncs.cpp2
-rw-r--r--src/inspsocket.cpp2
-rw-r--r--src/inspstring.cpp2
-rw-r--r--src/mode.cpp5
-rw-r--r--src/modules.cpp2
-rw-r--r--src/server.cpp2
-rw-r--r--src/snomasks.cpp2
-rw-r--r--src/socket.cpp2
-rw-r--r--src/socketengine.cpp2
-rw-r--r--src/timer.cpp2
-rw-r--r--src/user_resolver.cpp2
-rw-r--r--src/userprocess.cpp2
-rw-r--r--src/users.cpp2
-rw-r--r--src/wildcard.cpp2
-rw-r--r--src/xline.cpp2
26 files changed, 121 insertions, 61 deletions
diff --git a/configure b/configure
index adc05f865..353142727 100755
--- a/configure
+++ b/configure
@@ -29,63 +29,6 @@ use make::opensslcert;
#
###############################################################################################
-# This is a list of all files in the core. Each cpp file is mapped to a shared object file,
-# whos file extension is omitted (these can vary from system to system).
-
-my %filelist = (
- "channels.cpp" => "libIRCDchannels",
- "mode.cpp" => "libIRCDmode",
- "xline.cpp" => "libIRCDxline",
- "inspstring.cpp" => "libIRCDstring",
- "dns.cpp" => "libIRCDasyncdns",
- "base.cpp" => "libIRCDbase",
- "configreader.cpp" => "libIRCDconfigreader",
- "inspsocket.cpp" => "libIRCDinspsocket",
- "commands.cpp" => "libIRCDcommands",
- "dynamic.cpp" => "libIRCDdynamic",
- "users.cpp" => "libIRCDusers",
- "modules.cpp" => "libIRCDmodules",
- "wildcard.cpp" => "libIRCDwildcard",
- "helperfuncs.cpp" => "libIRCDhelper",
- "hashcomp.cpp" => "libIRCDhash",
- "socket.cpp" => "libIRCDsocket",
- "socketengine.cpp" => "libIRCDsocketengine",
- "userprocess.cpp" => "libIRCDuserprocess",
- "cull_list.cpp" => "libIRCDcull_list",
- "command_parse.cpp" => "libIRCDcommand_parse",
- "timer.cpp" => "libIRCDtimer",
- "snomasks.cpp" => "libIRCDsnomasks",
- "server.cpp" => "libIRCDserver",
- "filelogger.cpp" => "libIRCDfilelogger",
- "user_resolver.cpp" => "libIRCDuserresolver",
-);
-
-# If you wish for a file to have special dependencies in the makefile, add an entry here.
-
-my %specialdeps = (
- "mode.cpp" => "\$(RELCPPFILES)",
-);
-
-# If you wish for a file to have extra make lines (in between the compile and link steps)
-# then insert them here.
-
-my %extrabuildlines = (
- "mode.cpp" => "\${MAKE} -C \"modes\" DIRNAME=\"src/modes\" CC=\"\$(CC)\" \$(MAKEARGS) CPPFILES=\"\$(CPPFILES)\"",
-);
-
-# If you wish for a file to be linked against extra objects or arctives, insert them here.
-
-my %extraobjects = (
- "mode.cpp" => "modes/modeclasses.a"
-);
-
-# If you wish to compile extra cpp sources into an object, define them here.
-# NOTE: Certain cpp files such as the socket engines have a value auto calculated
-# for this table so that their derived class is built.
-
-my %extrasources = (
-);
-
# If you wish to ignore a dependency throughout the entire core, add it here.
my @ignoredeps = (
@@ -107,6 +50,31 @@ my @immutabledeps = (
#
###############################################################################################
+# This is a list of all files in the core. Each cpp file is mapped to a shared object file,
+# whos file extension is omitted (these can vary from system to system). Auto detected by
+# scanning the src/*.cpp files for files containing /* $Core: */ identifiers.
+
+my %filelist = ();
+
+# If you wish for a file to have special dependencies in the makefile, add an entry here.
+
+my %specialdeps = ();
+
+# If you wish for a file to have extra make lines (in between the compile and link steps)
+# then insert them here.
+
+my %extrabuildlines = ();
+
+# If you wish for a file to be linked against extra objects or arctives, insert them here.
+
+my %extraobjects = ();
+
+# If you wish to compile extra cpp sources into an object, define them here.
+# NOTE: Certain cpp files such as the socket engines have a value auto calculated
+# for this table so that their derived class is built.
+
+my %extrasources = ();
+
GetOptions (
'enable-gnutls' => \$opt_use_gnutls,
@@ -1452,18 +1420,57 @@ sub calcdeps($)
return length($immutable) ? $immutable . " " . $retlist : $retlist;
}
-sub write_dynamic_makefile {
-
+sub write_dynamic_makefile
+{
my $i = 0;
my @cmdlist = ();
opendir(DIRHANDLE, "src/commands");
- foreach $name (sort readdir(DIRHANDLE)) {
- if ($name =~ /^cmd_(.+)\.cpp$/) {
+ foreach $name (sort readdir(DIRHANDLE))
+ {
+ if ($name =~ /^cmd_(.+)\.cpp$/)
+ {
$cmdlist[$i++] = $1;
}
}
closedir(DIRHANDLE);
+ print "Scanning src folder for core files";
+ opendir(DIRHANDLE, "src");
+ foreach $name (sort readdir(DIRHANDLE))
+ {
+ if ($name =~ /\.cpp$/)
+ {
+ open (CPP, "<src/$name") or die("Can't open src/$name to scan it! oh bugger");
+ while (chomp($line = <CPP>))
+ {
+ if ($line =~ /\/\* \$Core: (\w+) \*\//)
+ {
+ $filelist{$name} = $1;
+ print ".";
+ }
+ elsif ($line =~ /\/\* \$ExtraDeps: (.*?) \*\//)
+ {
+ $specialdeps{$name} = $1;
+ }
+ elsif ($line =~ /\/\* \$ExtraObjects: (.*?) \*\//)
+ {
+ $extraobjects{$name} = $1;
+ }
+ elsif ($line =~ /\/\* \$ExtraBuild: (.*?) \*\//)
+ {
+ $extrabuildlines{$name} = $1;
+ }
+ elsif ($line =~ /\/\* \$ExtraSources: (.*?) \*\//)
+ {
+ $extrasources{$name} = $1;
+ }
+ }
+ close CPP;
+ }
+ }
+ closedir(DIRHANDLE);
+ print " done!\n";
+
$se = "socketengine_select";
if (($has_kqueue) && ($config{USE_KQUEUE} eq "y")) {
$se = "socketengine_kqueue";
diff --git a/src/base.cpp b/src/base.cpp
index 9c002773b..c18b1f49b 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDbase */
+
#include "inspircd_config.h"
#include "base.h"
#include <time.h>
diff --git a/src/channels.cpp b/src/channels.cpp
index 8f0d2d744..cc5a2d7d5 100644
--- a/src/channels.cpp
+++ b/src/channels.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDchannels */
+
#include "inspircd.h"
#include <stdarg.h>
#include "wildcard.h"
diff --git a/src/command_parse.cpp b/src/command_parse.cpp
index fdc36d26c..a10a19fb9 100644
--- a/src/command_parse.cpp
+++ b/src/command_parse.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDcommand_parse */
+
#include "inspircd.h"
#include "wildcard.h"
#include "xline.h"
diff --git a/src/commands.cpp b/src/commands.cpp
index edb8a529e..4e4400385 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDcommands */
+
#include "inspircd.h"
#include "wildcard.h"
#include "xline.h"
diff --git a/src/configreader.cpp b/src/configreader.cpp
index 98092f57e..3d60226f1 100644
--- a/src/configreader.cpp
+++ b/src/configreader.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDconfigreader */
+
#include "inspircd.h"
#include <fstream>
#include "xline.h"
diff --git a/src/cull_list.cpp b/src/cull_list.cpp
index a80a5dd56..8dd1f6ae1 100644
--- a/src/cull_list.cpp
+++ b/src/cull_list.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDcull_list */
+
#include "inspircd.h"
#include "cull_list.h"
diff --git a/src/dns.cpp b/src/dns.cpp
index ec19ed397..c1f7758b0 100644
--- a/src/dns.cpp
+++ b/src/dns.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDasyncdns */
+
/*
dns.cpp - Nonblocking DNS functions.
Very very loosely based on the firedns library,
diff --git a/src/dynamic.cpp b/src/dynamic.cpp
index 2256b38fc..97660a7a3 100644
--- a/src/dynamic.cpp
+++ b/src/dynamic.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDdynamic */
+
#include "inspircd.h"
#include "dynamic.h"
#ifndef WIN32
diff --git a/src/filelogger.cpp b/src/filelogger.cpp
index 32a1f882f..57291efe3 100644
--- a/src/filelogger.cpp
+++ b/src/filelogger.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDfilelogger */
+
#include "inspircd.h"
#include <fstream>
#include "socketengine.h"
diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp
index 49befd634..f672f3fb2 100644
--- a/src/hashcomp.cpp
+++ b/src/hashcomp.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDhash */
+
#include "inspircd.h"
#include "hashcomp.h"
#ifndef WIN32
diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp
index 4fe1fb3b2..15629cd1f 100644
--- a/src/helperfuncs.cpp
+++ b/src/helperfuncs.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDhelper */
+
#include "inspircd.h"
#include <stdarg.h>
#include "wildcard.h"
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index 83754741f..f29f23351 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDinspsocket */
+
#include "socket.h"
#include "inspstring.h"
#include "socketengine.h"
diff --git a/src/inspstring.cpp b/src/inspstring.cpp
index 98e7228d5..b5bf73370 100644
--- a/src/inspstring.cpp
+++ b/src/inspstring.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDstring */
+
#include "inspstring.h"
/*
diff --git a/src/mode.cpp b/src/mode.cpp
index 1f6cc08b9..4aee282a2 100644
--- a/src/mode.cpp
+++ b/src/mode.cpp
@@ -11,6 +11,11 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDmode */
+/* $ExtraDeps: $(RELCPPFILES) */
+/* $ExtraObjects: modes/modeclasses.a */
+/* $ExtraBuild: ${MAKE} -C "modes" DIRNAME="src/modes" CC="$(CC)" $(MAKEARGS) CPPFILES="$(CPPFILES)" */
+
#include "inspircd.h"
#include "inspstring.h"
diff --git a/src/modules.cpp b/src/modules.cpp
index 5639f3088..e8a0babf0 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDmodules */
+
#include "inspircd.h"
#include "wildcard.h"
#include "xline.h"
diff --git a/src/server.cpp b/src/server.cpp
index 4568c43fd..f163bc733 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDserver */
+
#include <signal.h>
#include "exitcodes.h"
#include "inspircd.h"
diff --git a/src/snomasks.cpp b/src/snomasks.cpp
index 070d01d73..dea7cc446 100644
--- a/src/snomasks.cpp
+++ b/src/snomasks.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDsnomasks */
+
#include "inspircd.h"
#include <stdarg.h>
#include "snomasks.h"
diff --git a/src/socket.cpp b/src/socket.cpp
index e4d59716a..324f7633a 100644
--- a/src/socket.cpp
+++ b/src/socket.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDsocket */
+
#include "inspircd.h"
#include "socket.h"
#include "socketengine.h"
diff --git a/src/socketengine.cpp b/src/socketengine.cpp
index 3e4fc7815..06e490c42 100644
--- a/src/socketengine.cpp
+++ b/src/socketengine.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDsocketengine */
+
#include "inspircd.h"
#include "socketengine.h"
diff --git a/src/timer.cpp b/src/timer.cpp
index a79105f52..f9abf8114 100644
--- a/src/timer.cpp
+++ b/src/timer.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDtimer */
+
#include "inspircd.h"
#include "timer.h"
diff --git a/src/user_resolver.cpp b/src/user_resolver.cpp
index f23682b14..5fe2bebb3 100644
--- a/src/user_resolver.cpp
+++ b/src/user_resolver.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDuserresolver */
+
#include "inspircd.h"
UserResolver::UserResolver(InspIRCd* Instance, User* user, std::string to_resolve, QueryType qt, bool &cache) :
diff --git a/src/userprocess.cpp b/src/userprocess.cpp
index c4ce93d6a..70f0e246f 100644
--- a/src/userprocess.cpp
+++ b/src/userprocess.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDuserprocess */
+
#include "inspircd.h"
#include "wildcard.h"
#include "xline.h"
diff --git a/src/users.cpp b/src/users.cpp
index f86e18257..fec5694a4 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDusers */
+
#include "inspircd.h"
#include <stdarg.h>
#include "socketengine.h"
diff --git a/src/wildcard.cpp b/src/wildcard.cpp
index aaa619f2f..434421964 100644
--- a/src/wildcard.cpp
+++ b/src/wildcard.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDwildcard */
+
#include "inspircd.h"
#include "hashcomp.h"
#include "inspstring.h"
diff --git a/src/xline.cpp b/src/xline.cpp
index 4f9324825..93c9f795d 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -11,6 +11,8 @@
* ---------------------------------------------------
*/
+/* $Core: libIRCDxline */
+
#include "inspircd.h"
#include "wildcard.h"
#include "xline.h"