3 # Copyright (C) 2004, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
4 # Copyright (C) 2001 Internet Software Consortium.
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
10 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 # AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 # PERFORMANCE OF THIS SOFTWARE.
18 # Id: makedefs.pl,v 1.10 2009/01/17 23:47:43 tbox Exp
21 # This script goes through all of the lib header files and creates a .def file
22 # for each DLL for Win32. It recurses as necessary through the subdirectories
24 # This program should only be run if it is necessary to regenerate
25 # the .def files. Normally these files should be updated by hand, adding
26 # new functions to the end and removing obsolete ones.
27 # If you do regenerate them you will also need to modify them by hand to
28 # to pick up those routines not detected by this program (like openlog).
30 # Search String: ^(([_a-z0-9])*( ))*prefix_[_a-z0-9]+_[a-z0-9]+( )*\(
33 @prefixlist = ("isc", "isccfg","dns", "isccc", "libres");
34 @prefixlist = ("isccc");
35 @iscdirlist = ("isc/include/isc","isc/win32/include/isc");
36 @iscprefixlist = ("isc", "isc", "cfg");
38 @isccfgdirlist = ("isccfg/include/isccfg");
39 @isccfgprefixlist = ("cfg");
41 @iscccdirlist = ("isccc/include/isccc");
42 @iscccprefixlist = ("isccc");
44 @dnsdirlist = ("dns/include/dns","dns/sec/dst/include/dst");
45 @dnsprefixlist = ("dns", "dst");
47 @lwresdirlist = ("lwres/include/lwres");
48 @lwresprefixlist = ("lwres");
50 # Run the changes for each directory in the directory list
53 createoutfile
($iscprefixlist[0]);
54 foreach $dir (@iscdirlist) {
55 createdeffile
($dir, $iscprefixlist[$ind]);
61 createoutfile
($isccfgprefixlist[0]);
62 foreach $dir (@isccfgdirlist) {
63 createdeffile
($dir, $isccfgprefixlist[$ind]);
69 createoutfile
($dnsprefixlist[0]);
70 foreach $dir (@dnsdirlist) {
71 createdeffile
($dir, $dnsprefixlist[$ind]);
77 createoutfile
($iscccprefixlist[0]);
78 foreach $dir (@iscccdirlist) {
79 createdeffile
($dir, $iscccprefixlist[$ind]);
85 createoutfile
($lwresprefixlist[0]);
86 foreach $dir (@lwresdirlist) {
87 createdeffile
($dir, $lwresprefixlist[$ind]);
101 # Get the List of files in the directory to be processed.
103 #^(([_a-z0-9])*( ))*prefix_[_a-z]+_[a-z]+( )*\(
105 $pattern = "\^\(\(\[\_a\-z0\-9\]\)\*\( \)\)\*\(\\*\( \)\+\)\*$prefix";
106 $pattern = "$pattern\_\[\_a\-z0\-9\]\+_\[a\-z0\-9\]\+\( \)\*\\\(";
108 opendir(DIR
,$xdir) || die "No Directory: $!";
109 @files = grep(/\.h$/i, readdir(DIR
));
112 foreach $filename (sort @files) {
114 # Open the file and locate the pattern.
116 open (HFILE
, "$xdir/$filename") ||
117 die "Can't open file $filename : $!";
123 $space = rindex($func, " ") + 1;
125 # strip out return values
126 $func = substr($func, $space, 100);
128 print OUTDEFFILE
"$func\n";
131 # Set up the Patterns
136 # This is the routine that applies the changes
138 # output the result to the platform specific directory.
140 $outfile = "lib$_[0].def";
142 open (OUTDEFFILE
, ">$outfile")
143 || die "Can't open output file $outfile: $!";
144 print OUTDEFFILE
"LIBRARY lib$_[0]\n";
145 print OUTDEFFILE
"\n";
146 print OUTDEFFILE
"; Exported Functions\n";
147 print OUTDEFFILE
"EXPORTS\n";
148 print OUTDEFFILE
"\n";