4 ## This file is part of the aMule Project
6 ## Copyright (c) 2004-2011 Stu Redman ( sturedman@amule.org )
7 ## Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org )
9 ## This program is free software; you can redistribute it and/or
10 ## modify it under the terms of the GNU General Public License
11 ## as published by the Free Software Foundation; either
12 ## version 2 of the License, or (at your option) any later version.
14 ## This program is distributed in the hope that it will be useful,
15 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ## GNU General Public License for more details.
19 ## You should have received a copy of the GNU General Public License
20 ## along with this program; if not, write to the Free Software
21 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
24 # To speed up compilation we compile some files used in amule, amuled, amulegui
25 # into libs which we link to the apps.
26 # This concept can only work if the files (or their includes) don't use
27 # preprocessor macros used to tell these projects apart.
29 # This script checks for usage of these macros.
30 # It has to be run from the src dir after running configure to build the deps.
37 die 'run from src dir after making dependencies' unless -f
'.deps/amule-amule.Po';
39 my %checkedFiles; # key: path value: 0: ok 1: has AMULE_DAEMON 2: has CLIENT_GUI
45 @deps = glob('.deps/libmuleappcommon*.Po');
47 # libmuleappcore (ignore CLIENT_GUI usage)
48 @deps = glob('.deps/libmuleappcore*.Po');
50 # libmuleappgui (ignore AMULE_DAEMON usage)
51 @deps = glob('.deps/libmuleappgui*.Po');
55 @deps = glob('.deps/*.Po');
59 @deps = glob('.deps/*.Po');
64 my $checkAMULE_DAEMON = shift;
65 my $checkCLIENT_GUI = shift;
66 printf("check %d dependencies in %s\n", scalar @deps, getcwd
());
68 open(DEP
, $_) or die "can't open $_ : $!";
71 my $line = join(' ', @lines);
73 my @files = split(/\s+/, $line);
74 my $obj = shift @files;
76 foreach my $file (@files) {
77 next if $file =~ m
-^/usr/-; # skip system and wx includes
78 next if $file =~ m
-/wx/-;
79 next if $currentFiles{$file};
80 $currentFiles{$file} = 1;
81 my $status = $checkedFiles{$file};
82 unless (defined $status) {
84 open(SRC
, $file) or die "can't open $file : $!";
86 $status |= 1 if /^\s*\#.+AMULE_DAEMON/;
87 $status |= 2 if /^\s*\#.+CLIENT_GUI/;
90 $checkedFiles{$file} = $status;
92 print "$obj: AMULE_DAEMON used in $file\n" if $checkAMULE_DAEMON && ($status & 1);
93 print "$obj: CLIENT_GUI used in $file\n" if $checkCLIENT_GUI && ($status & 2);