diff --git a/auto/Makefile b/auto/Makefile index d443a59..3c79e8b 100644 --- a/auto/Makefile +++ b/auto/Makefile @@ -61,7 +61,11 @@ $(I.DEST)/glew.h: $(EXT)/.dummy cp -f $(SRC)/glew_pre.h $@ $(BIN)/make_header.pl GLAPIENTRY GL $(CORE)/GL_VERSION* >> $@ $(BIN)/make_header.pl GLAPIENTRY GL $(EXT)/GL_* >> $@ - $(BIN)/make_struct.pl GL $(CORE)/GL_VERSION* $(EXT)/GL_* >> $@ + echo -e "/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n#define GLEW_EXPORT\n#else\n#define GLEW_EXPORT GLEWAPI\n#endif /* GLEW_MX */\n\n#if defined(GLEW_MX) && defined(_WIN32)\nstruct GLEWContextStruct\n{\n#endif /* GLEW_MX */" >> $@ + $(BIN)/make_struct_fun.pl GLEW_EXPORT $(CORE)/GL_VERSION* $(EXT)/GL_* >> $@ + echo -e "\n#if defined(GLEW_MX) && !defined(_WIN32)\nstruct GLEWContextStruct\n{\n#endif /* GLEW_MX */\n" >> $@ + $(BIN)/make_struct_var.pl GLEW_EXPORT $(CORE)/GL_VERSION* $(EXT)/GL_* >> $@ + echo -e "\n#ifdef GLEW_MX\n}; /* GLEWContextStruct */\n#endif /* GLEW_MX */\n" >> $@ perl -e 's/GLEW_EXPORT GLboolean __GLEW_VERSION_1_2;/GLEW_EXPORT GLboolean __GLEW_VERSION_1_1;\nGLEW_EXPORT GLboolean __GLEW_VERSION_1_2;/' -pi.bak $@ rm -f $@.bak cat $(SRC)/glew_post.h >> $@ @@ -69,14 +73,21 @@ $(I.DEST)/glew.h: $(EXT)/.dummy $(I.DEST)/wglew.h: $(EXT)/.dummy cp -f $(SRC)/wglew_pre.h $@ $(BIN)/make_header.pl WINAPI WGL $(EXT)/WGL_* >> $@ - $(BIN)/make_struct.pl WGL $(EXT)/WGL_* >> $@ + echo -e "/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n#define WGLEW_EXPORT\n#else\n#define WGLEW_EXPORT GLEWAPI\n#endif /* GLEW_MX */\n\n#ifdef GLEW_MX\nstruct WGLEWContextStruct\n{\n#endif /* GLEW_MX */" >> $@ + $(BIN)/make_struct_fun.pl WGLEW_EXPORT $(EXT)/WGL_* >> $@ + $(BIN)/make_struct_var.pl WGLEW_EXPORT $(EXT)/WGL_* >> $@ + echo -e "\n#ifdef GLEW_MX\n}; /* WGLEWContextStruct */\n#endif /* GLEW_MX */\n" >> $@ cat $(SRC)/wglew_post.h >> $@ $(I.DEST)/glxew.h: $(EXT)/.dummy cp -f $(SRC)/glxew_pre.h $@ $(BIN)/make_header.pl '' GLX $(CORE)/GLX_VERSION* >> $@ $(BIN)/make_header.pl '' GLX $(EXT)/GLX_* >> $@ - $(BIN)/make_struct.pl GLX $(CORE)/GLX_VERSION* $(EXT)/GLX_* >> $@ + echo -e "/* ------------------------------------------------------------------------- */\n\n#ifdef GLEW_MX\n#define GLXEW_EXPORT\n#else\n#define GLXEW_EXPORT extern\n#endif /* GLEW_MX */" >> $@ + $(BIN)/make_struct_fun.pl GLXEW_EXPORT $(CORE)/GLX_VERSION* $(EXT)/GLX_* >> $@ + echo -e "\n#if defined(GLEW_MX)\nstruct GLXEWContextStruct\n{\n#endif /* GLEW_MX */\n" >> $@ + $(BIN)/make_struct_var.pl GLXEW_EXPORT $(CORE)/GLX_VERSION* $(EXT)/GLX_* >> $@ + echo -e "\n#ifdef GLEW_MX\n}; /* GLXEWContextStruct */\n#endif /* GLEW_MX */\n" >> $@ perl -e 's/GLEW_EXPORT GLboolean __GLXEW_VERSION_1_2;/GLEW_EXPORT GLboolean __GLXEW_VERSION_1_0;\nGLEW_EXPORT GLboolean __GLXEW_VERSION_1_1;\nGLEW_EXPORT GLboolean __GLXEW_VERSION_1_2;/' -pi.bak $@ cat $(SRC)/glxew_post.h >> $@ $(BIN)/fix_OML_sync_control.sh $@ diff --git a/auto/bin/make_struct.pl b/auto/bin/make_struct.pl deleted file mode 100755 index bea96a9..0000000 --- a/auto/bin/make_struct.pl +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/perl -## -## Copyright (C) 2004, 2003 Marcelo E. Magallon -## Copyright (C) 2004, 2003 Milan Ikits -## -## This program is distributed under the terms and conditions of the GNU -## General Public License Version 2 as published by the Free Software -## Foundation or, at your option, any later version. - -use strict; -use warnings; - -do 'bin/make.pl'; - -# function pointer declaration -sub make_pfn_decl($%) -{ - return "GLEW_EXPORT PFN" . (uc $_[0]) . "PROC " . prefixname($_[0]) . ";"; -} - -my @extlist = (); -my %extensions = (); - -our $type = shift; - -if (@ARGV) -{ - @extlist = @ARGV; -} else { - local $/; - @extlist = split "\n", (<>); -} - -print "/* ------------------------------------------------------------------------- */\n\n"; -print "#ifdef GLEW_MX\n"; -print "#define GLEW_EXPORT\n"; -print "#else\n"; -print "#define GLEW_EXPORT GLEWAPI\n"; -print "#endif /* GLEW_MX */\n\n"; -print "#if defined(GLEW_MX) && defined(_WIN32)\n"; -print "struct " . $type . "EWContextStruct\n{\n"; -print "#endif /* GLEW_MX */\n"; - -foreach my $ext (sort @extlist) -{ - my ($extname, $exturl, $types, $tokens, $functions, $exacts) = parse_ext($ext); - output_decls($functions, \&make_pfn_decl); -} - -print "\n#if defined(GLEW_MX) && !defined(_WIN32)\n"; -print "struct " . $type . "EWContextStruct\n{\n"; -print "#endif /* GLEW_MX */\n\n"; - -foreach my $ext (sort @extlist) -{ - my ($extname, $exturl, $types, $tokens, $functions, $exacts) = parse_ext($ext); - my $extvar = $extname; - $extvar =~ s/GL(X*)_/GL$1EW_/; - print "GLEW_EXPORT GLboolean " . prefix_varname($extvar) . ";\n"; -} - -print "\n#ifdef GLEW_MX\n"; -print "}; /* " . $type . "EWContextStruct */\n"; -print "#endif /* GLEW_MX */\n\n"; diff --git a/auto/bin/make_struct_fun.pl b/auto/bin/make_struct_fun.pl new file mode 100755 index 0000000..75ae9e8 --- /dev/null +++ b/auto/bin/make_struct_fun.pl @@ -0,0 +1,39 @@ +#!/usr/bin/perl +## +## Copyright (C) 2004, 2003 Marcelo E. Magallon +## Copyright (C) 2004, 2003 Milan Ikits +## +## This program is distributed under the terms and conditions of the GNU +## General Public License Version 2 as published by the Free Software +## Foundation or, at your option, any later version. + +use strict; +use warnings; + +do 'bin/make.pl'; + +# function pointer declaration +sub make_pfn_decl($%) +{ + our $export; + return $export . " PFN" . (uc $_[0]) . "PROC " . prefixname($_[0]) . ";"; +} + +my @extlist = (); +my %extensions = (); + +our $export = shift; + +if (@ARGV) +{ + @extlist = @ARGV; +} else { + local $/; + @extlist = split "\n", (<>); +} + +foreach my $ext (sort @extlist) +{ + my ($extname, $exturl, $types, $tokens, $functions, $exacts) = parse_ext($ext); + output_decls($functions, \&make_pfn_decl); +} diff --git a/auto/bin/make_struct_var.pl b/auto/bin/make_struct_var.pl new file mode 100755 index 0000000..04ed7c3 --- /dev/null +++ b/auto/bin/make_struct_var.pl @@ -0,0 +1,34 @@ +#!/usr/bin/perl +## +## Copyright (C) 2004, 2003 Marcelo E. Magallon +## Copyright (C) 2004, 2003 Milan Ikits +## +## This program is distributed under the terms and conditions of the GNU +## General Public License Version 2 as published by the Free Software +## Foundation or, at your option, any later version. + +use strict; +use warnings; + +do 'bin/make.pl'; + +my @extlist = (); +my %extensions = (); + +our $export = shift; + +if (@ARGV) +{ + @extlist = @ARGV; +} else { + local $/; + @extlist = split "\n", (<>); +} + +foreach my $ext (sort @extlist) +{ + my ($extname, $exturl, $types, $tokens, $functions, $exacts) = parse_ext($ext); + my $extvar = $extname; + $extvar =~ s/GL(X*)_/GL$1EW_/; + print $export . " GLboolean " . prefix_varname($extvar) . ";\n"; +}