libnet: Make UserInfo accept a SID as input as well, fix wb_cmd_getpwuid
[nivanova/samba-autobuild/.git] / source4 / build / smb_build / main.pl
1 # Samba Build System                                    
2 # - the main program                                    
3 #                                                       
4 #  Copyright (C) Stefan (metze) Metzmacher 2004 
5 #  Copyright (C) Jelmer Vernooij 2005
6 #  Released under the GNU GPL                           
7
8 use smb_build::makefile;
9 use smb_build::header;
10 use smb_build::input;
11 use smb_build::config_mk;
12 use smb_build::output;
13 use smb_build::summary;
14 use smb_build::config;
15 use strict;
16
17 my $INPUT = {};
18 my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, $config::config{builddir}, "main.mk");
19
20 my $subsys_output_type = ["MERGED_OBJ"];
21
22 my $library_output_type;
23 if ($config::config{USESHARED} eq "true") {
24         $library_output_type = ["SHARED_LIBRARY", "STATIC_LIBRARY"];
25 } else {
26         $library_output_type = ["STATIC_LIBRARY"];
27         push (@$library_output_type, "SHARED_LIBRARY") if 
28                                                 ($config::config{BLDSHARED} eq "true")
29 }
30
31 my $module_output_type;
32 if ($config::config{USESHARED} eq "true") {
33         $module_output_type = ["SHARED_LIBRARY"];
34 } else {
35         $module_output_type = ["MERGED_OBJ"];
36 }
37
38 my $DEPEND = smb_build::input::check($INPUT, \%config::enabled,
39                                      $subsys_output_type,
40                                      $library_output_type,
41                                      $module_output_type);
42 my $OUTPUT = output::create_output($DEPEND, \%config::config);
43 my $mkenv = new smb_build::makefile(\%config::config, $mkfile);
44
45 my $shared_libs_used = 0;
46 foreach my $key (values %$OUTPUT) {
47         push(@{$mkenv->{all_objs}}, "\$($key->{NAME}_OBJ_FILES)");
48 }
49
50 foreach my $key (values %$OUTPUT) {
51         next unless defined $key->{OUTPUT_TYPE};
52
53         $mkenv->MergedObj($key) if grep(/MERGED_OBJ/, @{$key->{OUTPUT_TYPE}});
54         $mkenv->StaticLibraryPrimitives($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
55         if (defined($key->{PC_FILE})) {
56                 $mkenv->output("PC_FILES += $key->{BASEDIR}/$key->{PC_FILE}\n");
57         } 
58         $mkenv->SharedLibraryPrimitives($key) if ($key->{TYPE} eq "LIBRARY") and
59                                         grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
60         if ($key->{TYPE} eq "LIBRARY" and 
61             ${$key->{OUTPUT_TYPE}}[0] eq "SHARED_LIBRARY") {
62                 $shared_libs_used = 1;
63         }
64         $mkenv->SharedModulePrimitives($key) if ($key->{TYPE} eq "MODULE" or 
65                                                                    $key->{TYPE} eq "PYTHON") and
66                                         grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
67         $mkenv->PythonFiles($key) if defined($key->{PYTHON_FILES});
68         $mkenv->CFlags($key);
69 }
70
71 foreach my $key (values %$OUTPUT) {
72         next unless defined $key->{OUTPUT_TYPE};
73
74         $mkenv->Integrated($key) if grep(/INTEGRATED/, @{$key->{OUTPUT_TYPE}});
75 }
76
77 foreach my $key (values %$OUTPUT) {
78         next unless defined $key->{OUTPUT_TYPE};
79         $mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
80
81         $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and
82                                         grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
83         $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" or 
84                                                                    $key->{TYPE} eq "PYTHON") and
85                                         grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
86         $mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}});
87         $mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER});
88 }
89
90 $mkenv->write("data.mk");
91 header::create_smb_build_h($OUTPUT, "include/build.h");
92
93 summary::show($OUTPUT, \%config::config);
94
95 1;