Automatically write AC_SUBST() vars to mkconfig.mk and use them.
[ira/wip.git] / source / build / smb_build / makefile.pm
1 # Samba Build System
2 # - create output for Makefile
3 #
4 #  Copyright (C) Stefan (metze) Metzmacher 2004
5 #  Copyright (C) Jelmer Vernooij 2005
6 #  Released under the GNU GPL
7
8 package smb_build::makefile;
9 use smb_build::env;
10 use smb_build::output;
11 use File::Basename;
12 use strict;
13
14 use base 'smb_build::env';
15 use Cwd 'abs_path';
16
17 sub new($$$)
18 {
19         my ($myname, $config, $mkfile) = @_;
20         my $self = new smb_build::env($config);
21         
22         bless($self, $myname);
23
24         $self->{manpages} = [];
25         $self->{sbin_progs} = [];
26         $self->{bin_progs} = [];
27         $self->{torture_progs} = [];
28         $self->{static_libs} = [];
29         $self->{python_dsos} = [];
30         $self->{python_pys} = [];
31         $self->{shared_libs} = [];
32         $self->{installable_shared_libs} = [];
33         $self->{headers} = [];
34         $self->{shared_modules} = [];
35         $self->{plugins} = [];
36         $self->{install_plugins} = "";
37         $self->{uninstall_plugins} = "";
38         $self->{pc_files} = [];
39         $self->{proto_headers} = [];
40         $self->{output} = "";
41
42         $self->{mkfile} = $mkfile;
43
44         $self->output("#!gmake\n");
45         $self->output("################################################\n");
46         $self->output("# Autogenerated by build/smb_build/makefile.pm #\n");
47         $self->output("################################################\n");
48         $self->output("\n");
49         $self->output("include mkconfig.mk\n");
50
51         $self->output("default: all\n\n");
52
53         $self->_prepare_compiler_linker();
54
55         if (!$self->{automatic_deps}) {
56                 $self->output("ALL_PREDEP = proto\n");
57                 $self->output(".NOTPARALLEL:\n");
58         }
59
60         return $self;
61 }
62
63 sub output($$)
64 {
65         my ($self, $text) = @_;
66
67         $self->{output} .= $text;
68 }
69
70 sub _prepare_compiler_linker($)
71 {
72         my ($self) = @_;
73
74         my $builddir_headers = "";
75         my $libdir;
76         my $extra_link_flags = "";
77
78         if ($self->{config}->{USESHARED} eq "true") {
79                 $libdir = "\$(builddir)/bin/shared";
80                 $extra_link_flags = "-Wl,-rpath-link,\$(builddir)/bin/shared";
81         } else {
82                 $libdir = "\$(builddir)/bin/static";
83         }
84         
85         if (!(abs_path($self->{config}->{srcdir}) eq abs_path($self->{config}->{builddir}))) {
86             $builddir_headers= "-I\$(builddir)/include -I\$(builddir) -I\$(builddir)/lib ";
87         }
88
89         $self->output(<< "__EOD__"
90
91 CPPFLAGS=$builddir_headers-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -I\$(srcdir)/lib/replace -I\$(srcdir)/lib/talloc -D_SAMBA_BUILD_=4 -DHAVE_CONFIG_H $self->{config}->{CPPFLAGS}
92
93 INSTALL_LINK_FLAGS=$extra_link_flags
94
95 BNLD=$self->{config}->{LD} 
96 BNLD_FLAGS=$self->{config}->{LDFLAGS} -L$libdir
97
98 SHLD_FLAGS=$self->{config}->{SHLD_FLAGS} -L\$(builddir)/bin/shared
99
100 MDLD_FLAGS=$self->{config}->{MDLD_FLAGS} -L\$(builddir)/bin/shared
101
102 HOSTCC_FLAGS=-D_SAMBA_HOSTCC_ \$(CFLAGS)
103
104 HOSTLD_FLAGS=$self->{config}->{LDFLAGS}
105
106 __EOD__
107 );
108 }
109
110 sub _prepare_mk_files($)
111 {
112         my $self = shift;
113         my @tmp = ();
114
115         foreach (@smb_build::config_mk::parsed_files) {
116                 s/ .*$//g;
117                 push (@tmp, $_);
118         }
119
120         if ($self->{gnu_make}) {
121                 $self->output("
122 ifneq (\$(MAKECMDGOALS),clean)
123 ifneq (\$(MAKECMDGOALS),distclean)
124 ifneq (\$(MAKECMDGOALS),realdistclean)
125 ");
126         }
127
128         $self->output("MK_FILES = " . array2oneperline(\@tmp) . "\n");
129
130         if ($self->{gnu_make}) {
131                 $self->output("
132 endif
133 endif
134 endif
135 ");
136         }
137 }
138
139 sub array2oneperline($)
140 {
141         my $array = shift;
142         my $output = "";
143
144         foreach (@$array) {
145                 next unless defined($_);
146
147                 $output .= " \\\n\t\t$_";
148         }
149
150         return $output;
151 }
152
153 sub _prepare_list_ex($$$$$)
154 {
155         my ($self,$ctx,$var,$pre,$post) = @_;
156         my @tmparr = ();
157
158         push(@tmparr, $pre) if defined($pre);
159         push(@tmparr, @{$ctx->{$var}}) if defined($ctx->{$var});
160         push(@tmparr, $post) if defined($post);
161
162         my $tmplist = array2oneperline(\@tmparr);
163         return if ($tmplist eq "");
164
165         $self->output("$ctx->{TYPE}\_$ctx->{NAME}_$var =$tmplist\n");
166 }
167
168 sub _prepare_list($$$)
169 {
170         my ($self,$ctx,$var) = @_;
171
172         $self->_prepare_list_ex($ctx, $var, undef, undef);
173 }
174
175 sub Integrated($$)
176 {
177         my ($self,$ctx) = @_;
178
179         $self->_prepare_list($ctx, "OBJ_LIST");
180         $self->_prepare_list($ctx, "FULL_OBJ_LIST");
181         $self->_prepare_list($ctx, "LINK_FLAGS");
182 }
183
184 sub SharedModule($$)
185 {
186         my ($self,$ctx) = @_;
187
188         my $init_obj = "";
189
190         my $sane_subsystem = lc($ctx->{SUBSYSTEM});
191         $sane_subsystem =~ s/^lib//;
192         
193         if ($ctx->{TYPE} eq "PYTHON") {
194                 push (@{$self->{python_dsos}}, 
195                         "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}");
196         } else {
197                 push (@{$self->{shared_modules}}, "$ctx->{TARGET_SHARED_LIBRARY}");
198                 push (@{$self->{plugins}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}");
199                 $self->{install_plugins} .= "\t\@echo Installing $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
200                 $self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(modulesdir)/$sane_subsystem/\n";
201                 $self->{install_plugins} .= "\t\@cp $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
202                 $self->{uninstall_plugins} .= "\t\@echo Uninstalling \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
203                 $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$ctx->{LIBRARY_REALNAME}\n";
204                 if (defined($ctx->{ALIASES})) {
205                         foreach (@{$ctx->{ALIASES}}) {
206                                 $self->{install_plugins} .= "\t\@rm -f \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
207                                 $self->{install_plugins} .= "\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
208                                 $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(modulesdir)/$sane_subsystem/$_.\$(SHLIBEXT)\n";
209                         }
210                 }
211         }
212
213         $self->output("$ctx->{TYPE}_$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
214         $self->_prepare_list($ctx, "OBJ_LIST");
215         $self->_prepare_list($ctx, "FULL_OBJ_LIST");
216         $self->_prepare_list($ctx, "DEPEND_LIST");
217         $self->_prepare_list($ctx, "LINK_FLAGS");
218
219         push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
220
221         if (defined($ctx->{INIT_FUNCTION}) and $ctx->{TYPE} ne "PYTHON") {
222                 my $init_fn = $ctx->{INIT_FUNCTION_TYPE};
223                 $init_fn =~ s/\(\*\)/init_module/;
224                 my $proto_fn = $ctx->{INIT_FUNCTION_TYPE};
225                 $proto_fn =~ s/\(\*\)/$ctx->{INIT_FUNCTION}/;
226
227                 $self->output(<< "__EOD__"
228 bin/$ctx->{NAME}_init_module.c:
229         \@echo Creating \$\@
230         \@echo \"#include \\\"includes.h\\\"\" > \$\@
231         \@echo \"$proto_fn;\" >> \$\@
232         \@echo \"_PUBLIC_ $init_fn\" >> \$\@
233         \@echo \"{\" >> \$\@
234         \@echo \"       return $ctx->{INIT_FUNCTION}();\" >> \$\@
235         \@echo \"}\" >> \$\@
236         \@echo \"\" >> \$\@
237 __EOD__
238 );
239                 $init_obj = "bin/$ctx->{NAME}_init_module.o";
240         }
241
242         $self->output(<< "__EOD__"
243 #
244
245 $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST) $init_obj
246         \@echo Linking \$\@
247         \@mkdir -p $ctx->{SHAREDDIR}
248         \@\$(MDLD) \$(MDLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
249                 \$($ctx->{TYPE}_$ctx->{NAME}\_FULL_OBJ_LIST) $init_obj \\
250                 \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS)
251 __EOD__
252 );
253
254         if (defined($ctx->{ALIASES})) {
255                 foreach (@{$ctx->{ALIASES}}) {
256                         $self->output("\t\@rm -f $ctx->{SHAREDDIR}/$_.\$(SHLIBEXT)\n");
257                         $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$_.\$(SHLIBEXT)\n");
258                 }
259         }
260         $self->output("\n");
261 }
262
263 sub SharedLibrary($$)
264 {
265         my ($self,$ctx) = @_;
266
267         my $has_static_lib = 0;
268
269         push (@{$self->{shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
270         push (@{$self->{installable_shared_libs}}, "$ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
271
272         $has_static_lib = 1 if grep(/STATIC_LIBRARY/, @{$ctx->{OUTPUT_TYPE}});
273
274         if (not $has_static_lib) {
275                 $self->output("$ctx->{TYPE}_$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
276                 $self->_prepare_list($ctx, "OBJ_LIST");
277                 $self->_prepare_list($ctx, "FULL_OBJ_LIST");
278         }
279         $self->_prepare_list($ctx, "DEPEND_LIST");
280         $self->_prepare_list($ctx, "LINK_FLAGS");
281 #       $self->_prepare_list_ex($ctx, "LINK_FLAGS", "-Wl,--whole-archive", "-Wl,--no-whole-archive");
282
283         push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
284
285         my $soarg = "";
286         my $lns = "";
287         if ($self->{config}->{SONAMEFLAG} ne "#" and defined($ctx->{LIBRARY_SONAME})) {
288                 $soarg = "$self->{config}->{SONAMEFLAG}$ctx->{LIBRARY_SONAME}";
289                 if ($ctx->{LIBRARY_REALNAME} ne $ctx->{LIBRARY_SONAME}) {
290                         $lns .= "\n\t\@rm -f $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}";
291                         $lns .= "\n\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_SONAME}";
292                 }
293         }
294
295         if (defined($ctx->{LIBRARY_SONAME})) {
296                 $lns .= "\n\t\@rm -f $ctx->{SHAREDDIR}/$ctx->{LIBRARY_DEBUGNAME}";
297                 $lns .= "\n\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{SHAREDDIR}/$ctx->{LIBRARY_DEBUGNAME}";
298         }
299
300         $self->output(<< "__EOD__"
301 #
302
303 $ctx->{SHAREDDIR}/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
304         \@echo Linking \$\@
305         \@mkdir -p $ctx->{SHAREDDIR}
306         \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
307                 \$($ctx->{TYPE}_$ctx->{NAME}\_FULL_OBJ_LIST) \\
308                 \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) \\
309                 $soarg$lns
310 __EOD__
311 );
312         $self->output("\n");
313 }
314
315 sub StaticLibrary($$)
316 {
317         my ($self,$ctx) = @_;
318
319         return unless (defined($ctx->{OBJ_FILES}));
320
321         push (@{$self->{static_libs}}, $ctx->{TARGET_STATIC_LIBRARY}) if ($ctx->{TYPE} eq "LIBRARY");
322
323         $self->output("$ctx->{TYPE}_$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
324         $self->_prepare_list($ctx, "OBJ_LIST");
325         $self->_prepare_list($ctx, "FULL_OBJ_LIST");
326
327         push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
328
329         $self->output(<< "__EOD__"
330 #
331 $ctx->{TARGET_STATIC_LIBRARY}: \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
332         \@echo Linking \$@
333         \@rm -f \$@
334         \@mkdir -p $ctx->{STATICDIR}
335         \@\$(STLD) \$(STLD_FLAGS) \$@ \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
336
337 __EOD__
338 );
339 }
340
341 sub Header($$)
342 {
343         my ($self,$ctx) = @_;
344
345         foreach (@{$ctx->{PUBLIC_HEADERS}}) {
346                 push (@{$self->{headers}}, output::add_dir_str($ctx->{BASEDIR}, $_));
347         }
348 }
349
350 sub Binary($$)
351 {
352         my ($self,$ctx) = @_;
353
354         my $installdir;
355         my $extradir = "";
356
357         if (defined($ctx->{INSTALLDIR}) && $ctx->{INSTALLDIR} =~ /^TORTUREDIR/) {
358                 $extradir = "/torture" . substr($ctx->{INSTALLDIR}, length("TORTUREDIR"));
359         }
360         my $localdir = "bin$extradir";
361
362         $installdir = "bin$extradir";
363
364         push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)");
365                 
366         unless (defined($ctx->{INSTALLDIR})) {
367         } elsif ($ctx->{INSTALLDIR} eq "SBINDIR") {
368                 push (@{$self->{sbin_progs}}, "$installdir/$ctx->{BINARY}");
369         } elsif ($ctx->{INSTALLDIR} eq "BINDIR") {
370                 push (@{$self->{bin_progs}}, "$installdir/$ctx->{BINARY}");
371         } elsif ($ctx->{INSTALLDIR} =~ /^TORTUREDIR/) {
372                 push (@{$self->{torture_progs}}, "$installdir/$ctx->{BINARY}");
373         }
374
375         push (@{$self->{binaries}}, "$localdir/$ctx->{BINARY}");
376
377         $self->_prepare_list($ctx, "OBJ_LIST");
378         $self->_prepare_list($ctx, "FULL_OBJ_LIST");
379         $self->_prepare_list($ctx, "DEPEND_LIST");
380         $self->_prepare_list($ctx, "LINK_FLAGS");
381
382 $self->output(<< "__EOD__"
383 $installdir/$ctx->{BINARY}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)
384         \@echo Linking \$\@
385 __EOD__
386         );
387
388         if (defined($ctx->{USE_HOSTCC}) && $ctx->{USE_HOSTCC} eq "YES") {
389                 $self->output(<< "__EOD__"
390         \@\$(HOSTLD) \$(HOSTLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
391                 \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS)
392 __EOD__
393                 );
394         } else {
395                 $self->output(<< "__EOD__"
396         \@\$(BNLD) \$(BNLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
397                 \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) 
398
399 __EOD__
400                 );
401         }
402 }
403
404 sub PythonFiles($$)
405 {
406         my ($self,$ctx) = @_;
407
408         foreach (@{$ctx->{PYTHON_FILES}}) {
409                 my $target = "bin/python/".basename($_);
410                 my $source = output::add_dir_str($ctx->{BASEDIR}, $_);
411                 $self->output("$target: $source\n" .
412                                           "\tmkdir -p \$(builddir)/bin/python\n" .
413                               "\tcp $source \$@\n\n");
414                 push (@{$self->{python_pys}}, $target);
415         }
416 }
417
418 sub Manpage($$)
419 {
420         my ($self,$ctx) = @_;
421
422         my $path = output::add_dir_str($ctx->{BASEDIR}, $ctx->{MANPAGE});
423         push (@{$self->{manpages}}, $path);
424 }
425
426 sub ProtoHeader($$)
427 {
428         my ($self,$ctx) = @_;
429
430         my $target = "";
431         my $comment = "Creating ";
432
433         my $priv = undef;
434         my $pub = undef;
435
436         if (defined($ctx->{PRIVATE_PROTO_HEADER})) {
437                 $priv = output::add_dir_str($ctx->{BASEDIR}, $ctx->{PRIVATE_PROTO_HEADER});
438                 $target .= $priv;
439                 $comment .= $priv;
440                 if (defined($ctx->{PUBLIC_PROTO_HEADER})) {
441                         $comment .= " and ";
442                         $target.= " ";
443                 }
444                 push (@{$self->{proto_headers}}, $priv);
445         } else {
446                 $ctx->{PRIVATE_PROTO_HEADER} = $ctx->{PUBLIC_PROTO_HEADER};
447                 $priv = output::add_dir_str($ctx->{BASEDIR}, $ctx->{PRIVATE_PROTO_HEADER});
448         }
449
450         if (defined($ctx->{PUBLIC_PROTO_HEADER})) {
451                 $pub = output::add_dir_str($ctx->{BASEDIR}, $ctx->{PUBLIC_PROTO_HEADER});
452                 $comment .= $pub;
453                 $target .= $pub;
454                 push (@{$self->{proto_headers}}, $pub);
455         } else {
456                 $ctx->{PUBLIC_PROTO_HEADER} = $ctx->{PRIVATE_PROTO_HEADER};
457                 $pub = output::add_dir_str($ctx->{BASEDIR}, $ctx->{PUBLIC_PROTO_HEADER});
458         }
459
460         $self->output("$pub: $ctx->{MK_FILE} \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST:.o=.c) \$(srcdir)/script/mkproto.pl\n");
461         $self->output("\t\@echo \"$comment\"\n");
462         $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --srcdir=\$(srcdir) --builddir=\$(builddir) --private=$priv --public=$pub \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n\n");
463 }
464
465 sub write($$)
466 {
467         my ($self,$file) = @_;
468
469         $self->output("MANPAGES = ".array2oneperline($self->{manpages})."\n");
470         $self->output("BIN_PROGS = " . array2oneperline($self->{bin_progs}) . "\n");
471         $self->output("SBIN_PROGS = " . array2oneperline($self->{sbin_progs}) . "\n");
472         $self->output("TORTURE_PROGS = " . array2oneperline($self->{torture_progs}) . "\n");
473         $self->output("BINARIES = " . array2oneperline($self->{binaries}) . "\n");
474         $self->output("STATIC_LIBS = " . array2oneperline($self->{static_libs}) . "\n");
475         $self->output("SHARED_LIBS = " . array2oneperline($self->{shared_libs}) . "\n");
476         $self->output("PYTHON_DSOS = " . array2oneperline($self->{python_dsos}) . "\n");
477         $self->output("PYTHON_PYS = " . array2oneperline($self->{python_pys}) . "\n");
478         $self->output("INSTALLABLE_SHARED_LIBS = " . array2oneperline($self->{installable_shared_libs}) . "\n");
479         $self->output("PUBLIC_HEADERS = " . array2oneperline($self->{headers}) . "\n");
480         $self->output("PC_FILES = " . array2oneperline($self->{pc_files}) . "\n");
481         $self->output("ALL_OBJS = " . array2oneperline($self->{all_objs}) . "\n");
482         $self->output("PROTO_HEADERS = " . array2oneperline($self->{proto_headers}) .  "\n");
483         $self->output("SHARED_MODULES = " . array2oneperline($self->{shared_modules}) . "\n");
484         $self->output("PLUGINS = " . array2oneperline($self->{plugins}) . "\n");
485
486         $self->output("\ninstallplugins: \$(PLUGINS)\n".$self->{install_plugins}."\n");
487         $self->output("\nuninstallplugins:\n".$self->{uninstall_plugins}."\n");
488
489         $self->_prepare_mk_files();
490
491         $self->output($self->{mkfile});
492
493         if ($self->{automatic_deps}) {
494                 $self->output("
495 ifneq (\$(MAKECMDGOALS),clean)
496 ifneq (\$(MAKECMDGOALS),distclean)
497 ifneq (\$(MAKECMDGOALS),realdistclean)
498 ifneq (\$(SKIP_DEP_FILES),yes)
499 -include \$(DEP_FILES)
500 endif
501 endif
502 endif
503 endif
504
505 ifneq (\$(SKIP_DEP_FILES),yes)
506 clean::
507         \@echo Removing dependency files
508         \@find . -name '*.d' -o -name '*.hd' | xargs rm -f
509 endif
510 ");
511         } else {
512                 $self->output("include \$(srcdir)/static_deps.mk\n");
513         }
514
515         open(MAKEFILE,">$file") || die ("Can't open $file\n");
516         print MAKEFILE $self->{output};
517         close(MAKEFILE);
518
519         print __FILE__.": creating $file\n";
520 }
521
522 1;