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 "SUBSYSTEM" and
34 $key->{TYPE} ne "BINARY");
35 next unless defined($key->{INIT_FUNCTIONS});
37 $DEFINE->{COMMENT} = "$key->{TYPE} $key->{NAME} INIT";
38 $DEFINE->{KEY} = "STATIC_$key->{NAME}_MODULES";
39 $DEFINE->{VAL} = "{ \\\n";
40 foreach (@{$key->{INIT_FUNCTIONS}}) {
41 $DEFINE->{VAL} .= "\t$_, \\\n";
42 my $fn = $key->{INIT_FUNCTION_TYPE};
43 unless(defined($fn)) { $fn = "NTSTATUS (*) (void)"; }
48 $DEFINE->{VAL} .= "\tNULL \\\n }";
50 push(@defines,$DEFINE);
54 # loop over all BUILD_H define sections
56 foreach (@defines) { $output .= _add_define_section($_); }
61 ###########################################################
62 # This function creates include/build.h from the SMB_BUILD
65 # create_build_h($SMB_BUILD_CTX)
67 # $SMB_BUILD_CTX - the global SMB_BUILD context
69 # $output - the resulting output buffer
70 sub create_smb_build_h($$)
72 my ($CTX, $file) = @_;
74 open(BUILD_H,">$file") || die ("Can't open `$file'\n");
75 print BUILD_H "/* autogenerated by build/smb_build/main.pl */\n";
76 print BUILD_H _prepare_build_h($CTX);
79 print __FILE__.": creating $file\n";