diff options
author | Stefan Metzmacher <metze@samba.org> | 2004-05-13 10:20:53 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:53:36 -0500 |
commit | f236700ef67d4f93ec56ec7808584552e94e0dfe (patch) | |
tree | 3572ba5a82860e9dc60661161997b77704867cdc /source4/build/smb_build/smb_build_h.pl | |
parent | b2d1f7890765fca5a119d43f4906e885c245005f (diff) | |
download | samba-f236700ef67d4f93ec56ec7808584552e94e0dfe.tar.gz samba-f236700ef67d4f93ec56ec7808584552e94e0dfe.tar.bz2 samba-f236700ef67d4f93ec56ec7808584552e94e0dfe.zip |
r665: merge over the new build system from my tmp branch
to the main SAMBA_4_0 tree.
NOTE: that it's not completely ready, but it's functional:-)
metze
(This used to be commit c78a2ddb28ec50d6570a83b1f66f18a5c3621731)
Diffstat (limited to 'source4/build/smb_build/smb_build_h.pl')
-rw-r--r-- | source4/build/smb_build/smb_build_h.pl | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/source4/build/smb_build/smb_build_h.pl b/source4/build/smb_build/smb_build_h.pl new file mode 100644 index 0000000000..7a829dd684 --- /dev/null +++ b/source4/build/smb_build/smb_build_h.pl @@ -0,0 +1,84 @@ +########################################################### +### SMB Build System ### +### - create output for smb_build.h ### +### ### +### Copyright (C) Stefan (metze) Metzmacher 2004 ### +### Released under the GNU GPL ### +########################################################### + +sub _add_define_section($) +{ + my $DEFINE = shift; + my $output = ""; + + $output .= " +/* $DEFINE->{COMMENT} */ +#define $DEFINE->{KEY} $DEFINE->{VAL} +"; + + return $output; +} + +sub _prepare_smb_build_h($) +{ + my $CTX = shift; + my $output = ""; + + # + # loop over all subsystems + # + foreach my $key (sort keys %{$CTX->{DEPEND}{SUBSYSTEMS}}) { + my $NAME = $CTX->{INPUT}{SUBSYSTEMS}{$key}{NAME}; + my $DEFINE = (); + my $name = lc($NAME); + + $DEFINE->{COMMENT} = "SUBSYSTEM $NAME INIT"; + $DEFINE->{KEY} = "static_init_$name"; + $DEFINE->{VAL} = "do { \\\n"; + foreach my $subkey (@{$CTX->{DEPEND}{SUBSYSTEMS}{$key}{STATIC_MODULES_LIST}}) { + $DEFINE->{VAL} .= "\t\t$subkey\_init(); \\\n"; + } + $DEFINE->{VAL} .= "\t} while(0)"; + + push(@{$CTX->{OUTPUT}{SMB_BUILD_H}},$DEFINE); + } + + # + # loop over all SMB_BUILD_H define sections + # + foreach my $key (@{$CTX->{OUTPUT}{SMB_BUILD_H}}) { + $output .= _add_define_section($key); + } + + return $output; +} + +########################################################### +# This function creates include/smb_build.h from the SMB_BUILD +# context +# +# create_smb_build_h($SMB_BUILD_CTX) +# +# $SMB_BUILD_CTX - the global SMB_BUILD context +# +# $output - the resulting output buffer +sub create_smb_build_h($) +{ + my $CTX = shift; + my $output = "/* autogenerated by config.smb_build.pl */\n"; + + $output .= _prepare_smb_build_h($CTX); + + # + # TODO: check if directory include/ exists + # + + open(SMB_BUILD_H,"> include/smb_build.h") || die ("Can't open include/smb_build.h\n"); + + print SMB_BUILD_H $output; + + close(SMB_BUILD_H); + + print "config.smb_build.pl: creating include/smb_build.h\n"; + return; +} |