summaryrefslogtreecommitdiff
path: root/source4/build/smb_build/main.pl
blob: 733b447e40638be01f11cd00a871e027e78ca44d (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Samba Build System					
# - the main program					
#							
#  Copyright (C) Stefan (metze) Metzmacher 2004	
#  Copyright (C) Jelmer Vernooij 2005
#  Released under the GNU GPL				

use smb_build::makefile;
use smb_build::header;
use smb_build::input;
use smb_build::config_mk;
use smb_build::output;
use smb_build::env;
use smb_build::cflags;
use smb_build::summary;
use config;
use strict;

my $INPUT = {};

my $mkfile = smb_build::config_mk::run_config_mk($INPUT, $config::config{srcdir}, "main.mk");

my $subsystem_output_type;

if (defined($ENV{"SUBSYSTEM_OUTPUT_TYPE"})) {
	$subsystem_output_type = $ENV{SUBSYSTEM_OUTPUT_TYPE};
} elsif ($config::config{BLDMERGED} eq "true") {
	$subsystem_output_type = "MERGEDOBJ";
} else {
	$subsystem_output_type = "OBJ_LIST";
}

my $library_output_type;
if (defined($ENV{"LIBRARY_OUTPUT_TYPE"})) {
	$library_output_type = $ENV{LIBRARY_OUTPUT_TYPE};
} elsif ($config::config{BLDSHARED} eq "true") {
	$library_output_type = "SHARED_LIBRARY";
} elsif ($config::config{BLDMERGED} eq "true") {
	$library_output_type = "MERGEDOBJ";
} else {
	$library_output_type = "OBJ_LIST";
}

my $module_output_type;
if (defined($ENV{"MODULE_OUTPUT_TYPE"})) {
	$module_output_type = $ENV{MODULE_OUTPUT_TYPE};
} elsif ($config::config{BLDSHARED} eq "true") {
	$module_output_type = "SHARED_LIBRARY";
} elsif ($config::config{BLDMERGED} eq "true") {
	$module_output_type = "MERGEDOBJ";
} else {
	$module_output_type = "OBJ_LIST";
}

my $DEPEND = smb_build::input::check($INPUT, \%config::enabled, 
	$subsystem_output_type, $library_output_type, $module_output_type);
my $OUTPUT = output::create_output($DEPEND, \%config::config);
$config::config{SUBSYSTEM_OUTPUT_TYPE} = $subsystem_output_type;
$config::config{LIBRARY_OUTPUT_TYPE} = $library_output_type;
$config::config{MODULE_OUTPUT_TYPE} = $module_output_type;
my $mkenv = new smb_build::makefile(\%config::config, $mkfile);

foreach my $key (values %$OUTPUT) {
	next unless defined $key->{OUTPUT_TYPE};

	$mkenv->MergedObj($key) if $key->{OUTPUT_TYPE} eq "MERGEDOBJ";
	$mkenv->ObjList($key) if $key->{OUTPUT_TYPE} eq "OBJLIST";
	$mkenv->StaticLibrary($key) if $key->{OUTPUT_TYPE} eq "STATIC_LIBRARY";
	$mkenv->PkgConfig($key) if ($key->{OUTPUT_TYPE} eq "SHARED_LIBRARY") and
						defined($key->{VERSION});
	$mkenv->SharedLibrary($key) if $key->{OUTPUT_TYPE} eq "SHARED_LIBRARY";
	$mkenv->Binary($key) if $key->{OUTPUT_TYPE} eq "BINARY";
	$mkenv->Manpage($key) if defined($key->{MANPAGE});
	$mkenv->Header($key) if defined($key->{PUBLIC_HEADERS});
	$mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER});

#	$mkenv->DependencyInfo($key) if $config::config{developer} eq "yes";
}

$mkenv->write("Makefile");
header::create_smb_build_h($OUTPUT, "include/build.h");

cflags::create_cflags($OUTPUT, "extra_cflags.txt");

summary::show($OUTPUT, \%config::config);

1;