1#! /bin/sh 2exec perl -w -x $0 ${1+"$@"} 3#!perl -w 4#line 5 5 6# Purpose: A script to generate a dll.h file from the library name 7# in a consistent way. 8 9# 10# fsm 11# 12 13my $program = "vxl_make_dll_h.pl"; 14my $library = $ARGV[0]; 15 16# 17die "usage : $program <library>\n" unless defined($library) && !($library eq ""); 18 19# only allow alpha-numeric characters. 20# should convert '-' to '_' ? 21die "$program : character \'$1\' is not allowed\n" if ($library =~ m/([^a-zA-Z_0-9])/); 22 23# upper-casify : 24$LIBRARY = $library; 25$LIBRARY =~ tr/a-z/A-Z/; 26 27# if win32 and not buiding the DLL then you need a dllimport 28# Only if you are building a DLL linked application. 29print "#ifndef ${library}_dll_h_\n"; 30print "#define ${library}_dll_h_\n"; 31print "\n"; 32print "// this is a generated file. it was generated by\n"; 33print "// vxl/bin/$program with argument \'${library}\'\n"; 34print "\n"; 35print "#define ${LIBRARY}_DLL_DATA\n"; 36print "\n"; 37print "#if defined(WIN32) && !defined(BUILDING_${LIBRARY}_DLL)\n"; 38print "# ifdef BUILD_DLL\n"; 39print "# undef ${LIBRARY}_DLL_DATA\n"; 40print "# define ${LIBRARY}_DLL_DATA _declspec(dllimport)\n"; 41print "# endif // BUILD_DLL\n"; 42print "#endif // WIN32 and !BUILDING_${LIBRARY}_DLL\n"; 43print "\n"; 44print "#endif\n"; 45