2 # - create output for build.h
4 # Copyright (C) Stefan (metze) Metzmacher 2004
5 # Copyright (C) Jelmer Vernooij 2005
6 # Released under the GNU GPL
11 sub _add_define_section($)
17 /* $DEFINE->{COMMENT} */
18 #define $DEFINE->{KEY} $DEFINE->{VAL}
24 sub _prepare_build_h($)
30 foreach my $key (values %$depend) {
32 next if ($key->{TYPE} ne "LIBRARY" and
33 $key->{TYPE} ne "MODULE" and
34 $key->{TYPE} ne "SUBSYSTEM" and
35 $key->{TYPE} ne "BINARY");
36 next unless defined($key->{INIT_FUNCTIONS});
38 my $name = $key->{NAME};
40 $DEFINE->{COMMENT} = "$key->{TYPE} $key->{NAME} INIT";
41 $DEFINE->{KEY} = "STATIC_$name\_MODULES";
42 $DEFINE->{VAL} = "\\\n";
43 foreach (@{$key->{INIT_FUNCTIONS}}) {
44 $DEFINE->{VAL} .= "\t$_, \\\n";
46 my $fn = $key->{INIT_FUNCTION_TYPE};
48 if ($fn =~ /\(\*\)/) {
53 $output .= "$fn $n;\n";
58 $DEFINE->{VAL} .= "\t$key->{INIT_FUNCTION_SENTINEL} \n";
60 push(@defines,$DEFINE);
64 # loop over all BUILD_H define sections
66 foreach (@defines) { $output .= _add_define_section($_); }
71 ###########################################################
72 # This function creates include/build.h from the SMB_BUILD
75 # create_build_h($SMB_BUILD_CTX)
77 # $SMB_BUILD_CTX - the global SMB_BUILD context
79 # $output - the resulting output buffer
80 sub create_smb_build_h($$)
82 my ($CTX, $file) = @_;
84 open(BUILD_H,">$file") || die ("Can't open `$file'\n");
85 print BUILD_H "/* autogenerated by build/smb_build/main.pl */\n";
86 print BUILD_H _prepare_build_h($CTX);
89 print __FILE__.": creating $file\n";