make the SMB2 negotiated read and write size settable in smb.conf
[samba.git] / source / 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         $mkenv->_prepare_list($key, "OBJ_LIST");
48         push(@{$mkenv->{all_objs}}, "\$($key->{NAME}_OBJ_LIST)");
49 }
50
51 foreach my $key (values %$OUTPUT) {
52         next unless defined $key->{OUTPUT_TYPE};
53
54         $mkenv->MergedObj($key) if grep(/MERGED_OBJ/, @{$key->{OUTPUT_TYPE}});
55         $mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
56         if (defined($key->{PC_FILE})) {
57                 $mkenv->output("PC_FILES += $key->{BASEDIR}/$key->{PC_FILE}\n");
58         } 
59         $mkenv->SharedLibraryPrimitives($key) if ($key->{TYPE} eq "LIBRARY") and
60                                         grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
61         if ($key->{TYPE} eq "LIBRARY" and 
62             ${$key->{OUTPUT_TYPE}}[0] eq "SHARED_LIBRARY") {
63                 $shared_libs_used = 1;
64         }
65         $mkenv->SharedModulePrimitives($key) if ($key->{TYPE} eq "MODULE" or 
66                                                                    $key->{TYPE} eq "PYTHON") and
67                                         grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
68         $mkenv->PythonFiles($key) if defined($key->{PYTHON_FILES});
69         $mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER});
70         $mkenv->CFlags($key);
71 }
72
73 foreach my $key (values %$OUTPUT) {
74         next unless defined $key->{OUTPUT_TYPE};
75
76         $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and
77                                         grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
78         $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" or 
79                                                                    $key->{TYPE} eq "PYTHON") and
80                                         grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
81         $mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}});
82 }
83
84 $mkenv->write("data.mk");
85 header::create_smb_build_h($OUTPUT, "include/build.h");
86
87 summary::show($OUTPUT, \%config::config);
88
89 1;