summaryrefslogtreecommitdiff
path: root/ACE/apps/soreduce/soreduce.cpp
blob: ef6097283ede6e23270e7356f45e596934ffd475 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// $Id$

// File: soreduce.cpp

// Author: Phil Mesnier

// theory of operation:
//  1. Build a complete set of applications
//  2. apply "nm" to each of the .o files that make up the libraries to subset
//     filter the results into two files for each, one with exported names, the
//     other with imported names.
//  3. apply "nm" to all of the elements which use ace & tao. build a list of
//     imported names
//  4. Repeat the following steps until no entries remain in the list of
//     imports
//  4.1 Take a name from the list of imports, locate the module containing the
//      export of that name
//  4.2 Add the exporting module to the list of required modules, add its list
//      of exports to the list of resolved exports, add its imported names to
//      the list of imports.
//  4.4 Traverse the list of imported names to eliminate any found in the list
//      of exported names.
//  4.5 go to step 4.1
//  5. construct a new makefile for all required modules.
//
//  Currently works only with GNU nm

#include <ace/Log_Msg.h>

#include "SO_Group.h"

ACE_RCSID (src, soreduce, "$Id$")

int
ACE_TMAIN (int argc, ACE_TCHAR *argv[])
{
  SO_Group group;

  ACE_DEBUG ((LM_DEBUG, "discovering libraries\n"));
  
  for (int i = 1; i < argc; group.add_executable (argv[i++]))
    {
      // No action.
    }
  
  ACE_DEBUG ((LM_DEBUG, "loading object modules\n"));
  group.load_modules ();
  group.list_libs ();
  
  ACE_DEBUG ((LM_DEBUG, "Starting analysis\n"));
  group.analize ();
  
  ACE_DEBUG ((LM_DEBUG, "Writing results\n"));
  group.write_results ();
  
  ACE_DEBUG ((LM_DEBUG, "Done.\n"));
  return 0;
}