1 ###########################################################
2 ### SMB Build System ###
3 ### - create output for smb_build.h ###
5 ### Copyright (C) Stefan (metze) Metzmacher 2004 ###
6 ### Released under the GNU GPL ###
7 ###########################################################
12 sub _add_define_section($)
18 /* $DEFINE->{COMMENT} */
19 #define $DEFINE->{KEY} $DEFINE->{VAL}
25 sub _prepare_smb_build_h($)
31 # loop over all binaries
33 foreach my $key (values %{$depend}) {
34 next if ($key->{TYPE} ne "BINARY");
36 my $NAME = $key->{NAME};
43 $DEFINE->{COMMENT} = "BINARY $NAME INIT";
44 $DEFINE->{KEY} = $name . "_init_subsystems";
45 $DEFINE->{VAL} = "do { \\\n";
46 foreach my $subkey (@{$key->{SUBSYSTEM_INIT_FUNCTIONS}}) {
47 $DEFINE->{VAL} .= "\t\textern NTSTATUS $subkey(void); \\\n";
50 foreach my $subkey (@{$key->{SUBSYSTEM_INIT_FUNCTIONS}}) {
51 $DEFINE->{VAL} .= "\t\tif (NT_STATUS_IS_ERR($subkey())) exit(1); \\\n";
53 $DEFINE->{VAL} .= "\t} while(0)";
55 push(@defines,$DEFINE);
61 foreach my $key (values %{$depend}) {
62 next if $key->{TYPE} ne "MODULE";
63 next if $key->{ENABLE} ne "YES";
64 next if $key->{OUTPUT_TYPE} ne "SHARED_LIBRARY";
66 my $name = $key->{NAME};
67 my $func = $key->{INIT_FUNCTION};
72 $DEFINE->{COMMENT} = "$name is built shared";
73 $DEFINE->{KEY} = $func;
74 $DEFINE->{VAL} = "init_module";
76 push(@defines,$DEFINE);
80 # loop over all SMB_BUILD_H define sections
83 foreach my $key (@defines) {
84 $output .= _add_define_section($key);
90 ###########################################################
91 # This function creates include/smb_build.h from the SMB_BUILD
94 # create_smb_build_h($SMB_BUILD_CTX)
96 # $SMB_BUILD_CTX - the global SMB_BUILD context
98 # $output - the resulting output buffer
99 sub create_smb_build_h($)
102 my $output = "/* autogenerated by config.smb_build.pl */\n";
104 $output .= _prepare_smb_build_h($CTX);
106 open(SMB_BUILD_H,"> include/smb_build.h") || die ("Can't open include/smb_build.h\n");
108 print SMB_BUILD_H $output;
112 print "config.smb_build.pl: creating include/smb_build.h\n";