r14670: Fix module extensions
[bbaumbach/samba-autobuild/.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 strict;
11
12 use base 'smb_build::env';
13
14 sub new($$$)
15 {
16         my ($myname, $config, $mkfile) = @_;
17         my $self = new smb_build::env($config);
18         
19         bless($self, $myname);
20
21         $self->{manpages} = [];
22         $self->{sbin_progs} = [];
23         $self->{bin_progs} = [];
24         $self->{static_libs} = [];
25         $self->{shared_libs} = [];
26         $self->{installable_shared_libs} = [];
27         $self->{headers} = [];
28         $self->{shared_modules} = [];
29         $self->{plugins} = [];
30         $self->{install_plugins} = "";
31         $self->{uninstall_plugins} = "";
32         $self->{pc_files} = [];
33         $self->{proto_headers} = [];
34         $self->{output} = "";
35
36         $self->{mkfile} = $mkfile;
37
38         $self->output("#!gmake\n");
39         $self->output("################################################\n");
40         $self->output("# Autogenerated by build/smb_build/makefile.pm #\n");
41         $self->output("################################################\n");
42         $self->output("\n");
43
44         if (!$self->{automatic_deps}) {
45                 $self->output("ALL_PREDEP = proto\n");
46         }
47
48         $self->output("default: all\n\n");
49
50         $self->_prepare_path_vars();
51         $self->_prepare_compiler_linker();
52
53         return $self;
54 }
55
56 sub output($$)
57 {
58         my ($self, $text) = @_;
59
60         $self->{output} .= $text;
61 }
62
63 sub _prepare_path_vars($)
64 {
65         my ($self) = @_;
66
67         $self->output(<< "__EOD__"
68 prefix = $self->{config}->{prefix}
69 exec_prefix = $self->{config}->{exec_prefix}
70 selftest_prefix = $self->{config}->{selftest_prefix}
71 VPATH = $self->{config}->{srcdir}:heimdal/lib/asn1:heimdal/lib/krb5:heimdal/lib/gssapi:heimdal/lib/hdb:heimdal/lib/roken:heimdal/lib/des
72 srcdir = $self->{config}->{srcdir}
73 builddir = $self->{config}->{builddir}
74
75 BASEDIR = $self->{config}->{prefix}
76 BINDIR = $self->{config}->{bindir}
77 SBINDIR = $self->{config}->{sbindir}
78 LIBDIR = $self->{config}->{libdir}
79 MODULESDIR = $self->{config}->{modulesdir}
80 INCLUDEDIR = $self->{config}->{includedir}
81 CONFIGDIR = $self->{config}->{sysconfdir}
82 DATADIR = $self->{config}->{datadir}
83 SWATDIR = $self->{config}->{datadir}/swat
84 JSDIR = $self->{config}->{datadir}/js
85 SETUPDIR = $self->{config}->{datadir}/setup
86 VARDIR = $self->{config}->{localstatedir}
87 LOGFILEBASE = $self->{config}->{logfilebase}
88 NCALRPCDIR = $self->{config}->{localstatedir}/ncalrpc
89 LOCKDIR = $self->{config}->{lockdir}
90 PIDDIR = $self->{config}->{piddir}
91 MANDIR = $self->{config}->{mandir}
92 PRIVATEDIR = $self->{config}->{privatedir}
93 WINBINDD_SOCKET_DIR = $self->{config}->{winbindd_socket_dir}
94
95 __EOD__
96 );
97 }
98
99 sub _prepare_compiler_linker($)
100 {
101         my ($self) = @_;
102
103         my $devld_local = "";
104         my $devld_install = "";
105
106         $self->{duplicate_build} = 0;
107         if ($self->{config}->{LIBRARY_OUTPUT_TYPE} eq "SHARED_LIBRARY") {
108                 if ($self->{developer}) {
109                         $self->{duplicate_build} = 1;
110                         $devld_local = " -Wl,-rpath,\$(builddir)/bin";
111                 }
112                 $devld_install = " -Wl,-rpath-link,\$(builddir)/bin";
113         }
114
115         $self->output(<< "__EOD__"
116 SHELL=$self->{config}->{SHELL}
117
118 PERL=$self->{config}->{PERL}
119
120 CPP=$self->{config}->{CPP}
121 CPPFLAGS=$self->{config}->{CPPFLAGS}
122
123 CC=$self->{config}->{CC}
124 CFLAGS=-I\$(srcdir)/include -I\$(srcdir) -I\$(srcdir)/lib -D_SAMBA_BUILD_ -DHAVE_CONFIG_H $self->{config}->{CFLAGS} \$(CPPFLAGS)
125 PICFLAG=$self->{config}->{PICFLAG}
126 HOSTCC=$self->{config}->{HOSTCC}
127
128 LOCAL_LINK_FLAGS=$devld_local
129 INSTALL_LINK_FLAGS=$devld_install
130
131 LD=$self->{config}->{LD} 
132 LDFLAGS=$self->{config}->{LDFLAGS} -L\$(builddir)/bin
133
134 STLD=$self->{config}->{AR}
135 STLD_FLAGS=-rc -L\$(builddir)/bin
136
137 SHLD=$self->{config}->{CC}
138 SHLD_FLAGS=$self->{config}->{LDSHFLAGS} -L\$(builddir)/bin
139 SHLIBEXT=$self->{config}->{SHLIBEXT}
140
141 XSLTPROC=$self->{config}->{XSLTPROC}
142
143 LEX=$self->{config}->{LEX}
144 YACC=$self->{config}->{YACC}
145 YAPP=$self->{config}->{YAPP}
146 PIDL_ARGS=$self->{config}->{PIDL_ARGS}
147
148 GCOV=$self->{config}->{GCOV}
149
150 DEFAULT_TEST_TARGET=$self->{config}->{DEFAULT_TEST_TARGET}
151
152 __EOD__
153 );
154 }
155
156 sub _prepare_mk_files($)
157 {
158         my $self = shift;
159         my @tmp = ();
160
161         foreach (@smb_build::config_mk::parsed_files) {
162                 s/ .*$//g;
163                 push (@tmp, $_);
164         }
165
166         $self->output("MK_FILES = " . array2oneperline(\@tmp) . "\n");
167 }
168
169 sub array2oneperline($)
170 {
171         my $array = shift;
172         my $output = "";
173
174         foreach (@$array) {
175                 next unless defined($_);
176
177                 $output .= " \\\n\t\t$_";
178         }
179
180         return $output;
181 }
182
183 sub _prepare_list($$$)
184 {
185         my ($self,$ctx,$var) = @_;
186
187         my $tmplist = array2oneperline($ctx->{$var});
188         return if ($tmplist eq "");
189
190         $self->output("$ctx->{TYPE}\_$ctx->{NAME}_$var =$tmplist\n");
191 }
192
193 sub SharedLibrary($$)
194 {
195         my ($self,$ctx) = @_;
196
197         my $installdir;
198         my $init_obj = "";
199         
200         if ($self->{duplicate_build}) {
201                 $installdir = $ctx->{RELEASEDIR};
202         } else {
203                 $installdir = $ctx->{DEBUGDIR};
204         }
205
206         if ($ctx->{TYPE} eq "LIBRARY") {
207                 push (@{$self->{shared_libs}}, "$ctx->{DEBUGDIR}/$ctx->{LIBRARY_REALNAME}");
208                 push (@{$self->{installable_shared_libs}}, "$installdir/$ctx->{LIBRARY_REALNAME}") if (defined($ctx->{SO_VERSION}));
209         } elsif ($ctx->{TYPE} eq "MODULE") {
210                 push (@{$self->{shared_modules}}, "$ctx->{TARGET}");
211                 push (@{$self->{plugins}}, "$installdir/$ctx->{LIBRARY_REALNAME}");
212
213                 $self->{install_plugins} .= "\t\@echo Installing $installdir/$ctx->{LIBRARY_REALNAME} as \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{LIBRARY_REALNAME}\n";
214                 $self->{install_plugins} .= "\t\@mkdir -p \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/\n";
215                 $self->{install_plugins} .= "\t\@cp $installdir/$ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{LIBRARY_REALNAME}\n";
216                 $self->{uninstall_plugins} .= "\t\@echo Uninstalling \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{LIBRARY_REALNAME}\n";
217                 $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$ctx->{LIBRARY_REALNAME}\n";
218                 if (defined($ctx->{ALIASES})) {
219                         foreach (@{$ctx->{ALIASES}}) {
220                                 $self->{install_plugins} .= "\t\@ln -fs $ctx->{LIBRARY_REALNAME} \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$_.\$(SHLIBEXT)\n";
221                                 $self->{uninstall_plugins} .= "\t\@-rm \$(DESTDIR)\$(MODULESDIR)/$ctx->{SUBSYSTEM}/$_.\$(SHLIBEXT)\n";
222                         }
223                 }
224         }
225
226         $self->_prepare_list($ctx, "OBJ_LIST");
227         $self->_prepare_list($ctx, "CFLAGS");
228         $self->_prepare_list($ctx, "DEPEND_LIST");
229         $self->_prepare_list($ctx, "LINK_LIST");
230         $self->_prepare_list($ctx, "LINK_FLAGS");
231
232         push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)");
233
234         if ($ctx->{TYPE} eq "MODULE" and defined($ctx->{INIT_FUNCTION})) {
235                 my $init_fn = $ctx->{INIT_FUNCTION_TYPE};
236                 $init_fn =~ s/\(\*\)/init_module/;
237                 my $proto_fn = $ctx->{INIT_FUNCTION_TYPE};
238                 $proto_fn =~ s/\(\*\)/$ctx->{INIT_FUNCTION}/;
239
240                 $self->output(<< "__EOD__"
241 bin/$ctx->{NAME}_init_module.c:
242         \@echo Creating \$\@
243         \@echo \"#include \\\"includes.h\\\"\" > \$\@
244         \@echo \"$proto_fn;\" >> \$\@
245         \@echo -e \"_PUBLIC_ $init_fn \\n{\\n\\treturn $ctx->{INIT_FUNCTION}();\\n}\\n\" >> \$\@
246 __EOD__
247 );
248                 $init_obj = "bin/$ctx->{NAME}_init_module.o";
249         }
250
251         my $soarg = "";
252         my $soargdebug = "";
253         if ($self->{config}->{SONAMEFLAG} ne "" and 
254                 defined($ctx->{LIBRARY_SONAME})) {
255                 $soarg = "$self->{config}->{SONAMEFLAG}$ctx->{LIBRARY_SONAME} ";
256                 if ($ctx->{LIBRARY_REALNAME} ne $ctx->{LIBRARY_SONAME}) {
257                         $soargdebug = "\n\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{DEBUGDIR}/$ctx->{LIBRARY_SONAME}";
258                 }
259         }
260
261         if ($self->{duplicate_build}) {
262                 $self->output(<< "__EOD__"
263 #
264
265 $ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) $init_obj
266         \@echo Linking \$\@
267         \@mkdir -p $ctx->{DEBUGDIR}
268         \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \$(LOCAL_LINK_FLAGS) \\
269                 \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) $soarg \\
270                 $init_obj \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)$soargdebug
271 __EOD__
272 );
273                 if (defined($ctx->{ALIASES})) {
274                         foreach (@{$ctx->{ALIASES}}) {
275                                 $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{DEBUGDIR}/$_.\$(SHLIBEXT)\n");
276                         }
277                 }
278
279                 $self->output("\n");
280         }
281
282         $self->output(<< "__EOD__"
283 #
284
285 $installdir/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) $init_obj
286         \@echo Linking \$\@
287         \@mkdir -p $installdir
288         \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
289                 \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) $soarg \\
290                 $init_obj \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
291
292 __EOD__
293 );
294 }
295
296 sub MergedObj($$)
297 {
298         my ($self,$ctx) = @_;
299
300         return unless $ctx->{TARGET};
301
302         $self->_prepare_list($ctx, "OBJ_LIST");
303         $self->_prepare_list($ctx, "CFLAGS");
304         $self->_prepare_list($ctx, "DEPEND_LIST");
305
306         push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)");
307                 
308         $self->output("$ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n");
309
310         $self->output("\t\@echo \"Pre-Linking $ctx->{TYPE} $ctx->{NAME}\"\n");
311         $self->output("\t@\$(LD) -r \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) -o $ctx->{TARGET}\n");
312         $self->output("\n");
313 }
314
315 sub ObjList($$)
316 {
317         my ($self,$ctx) = @_;
318
319         return unless $ctx->{TARGET};
320
321         push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)");
322                 
323         $self->_prepare_list($ctx, "OBJ_LIST");
324         $self->_prepare_list($ctx, "CFLAGS");
325         $self->_prepare_list($ctx, "DEPEND_LIST");
326         $self->output("$ctx->{TARGET}: ");
327         $self->output("\$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n");
328         $self->output("\t\@touch $ctx->{TARGET}\n");
329 }
330
331 sub StaticLibrary($$)
332 {
333         my ($self,$ctx) = @_;
334
335         push (@{$self->{static_libs}}, $ctx->{OUTPUT});
336
337         $self->_prepare_list($ctx, "OBJ_LIST");
338         $self->_prepare_list($ctx, "CFLAGS");
339
340         $self->_prepare_list($ctx, "DEPEND_LIST");
341         $self->_prepare_list($ctx, "LINK_LIST");
342         $self->_prepare_list($ctx, "LINK_FLAGS");
343
344         push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)");
345                 
346         $self->output(<< "__EOD__"
347 #
348 $ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) 
349         \@echo Linking \$@
350         \@\$(STLD) \$(STLD_FLAGS) \$@ \\
351                 \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)
352
353 __EOD__
354 );
355 }
356
357 sub Header($$)
358 {
359         my ($self,$ctx) = @_;
360
361         foreach (@{$ctx->{PUBLIC_HEADERS}}) {
362                 push (@{$self->{headers}}, "$ctx->{BASEDIR}/$_");
363         }
364 }
365
366 sub Binary($$)
367 {
368         my ($self,$ctx) = @_;
369
370         my $installdir;
371         
372         if ($self->{duplicate_build}) {
373                 $installdir = "bin/install";
374         } else {
375                 $installdir = "bin";
376         }
377
378         push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)");
379                 
380         unless (defined($ctx->{INSTALLDIR})) {
381         } elsif ($ctx->{INSTALLDIR} eq "SBINDIR") {
382                 push (@{$self->{sbin_progs}}, "$installdir/$ctx->{BINARY}");
383         } elsif ($ctx->{INSTALLDIR} eq "BINDIR") {
384                 push (@{$self->{bin_progs}}, "$installdir/$ctx->{BINARY}");
385         }
386
387         push (@{$self->{binaries}}, "bin/$ctx->{BINARY}");
388
389         $self->_prepare_list($ctx, "OBJ_LIST");
390         $self->_prepare_list($ctx, "CFLAGS");
391         $self->_prepare_list($ctx, "DEPEND_LIST");
392         $self->_prepare_list($ctx, "LINK_LIST");
393         $self->_prepare_list($ctx, "LINK_FLAGS");
394
395         if ($self->{duplicate_build}) {
396         $self->output(<< "__EOD__"
397 #
398 bin/$ctx->{BINARY}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) 
399         \@echo Linking \$\@
400         \@\$(CC) \$(LDFLAGS) -o \$\@ \$(LOCAL_LINK_FLAGS) \$(INSTALL_LINK_FLAGS) \\
401                 \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST) \\
402                 \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) 
403
404 __EOD__
405 );
406         }
407
408 $self->output(<< "__EOD__"
409 $installdir/$ctx->{BINARY}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) 
410         \@echo Linking \$\@
411         \@\$(CC) \$(LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
412                 \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST) \\
413                 \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) 
414
415 __EOD__
416 );
417 }
418
419 sub Manpage($$)
420 {
421         my ($self,$ctx) = @_;
422
423         my $dir = $ctx->{BASEDIR};
424         
425         $dir =~ s/^\.\///g;
426
427         push (@{$self->{manpages}}, "$dir/$ctx->{MANPAGE}");
428 }
429
430 sub PkgConfig($$)
431 {
432         my ($self,$ctx) = @_;
433         
434         my $link_name = $ctx->{NAME};
435
436         $link_name =~ s/^LIB//g;
437         $link_name = lc($link_name);
438
439         return if (not defined($ctx->{DESCRIPTION}));
440
441         my $path = "$ctx->{BASEDIR}/$link_name.pc";
442
443         push (@{$self->{pc_files}}, $path);
444
445         smb_build::env::PkgConfig($self,
446                 $path,
447                 $link_name,
448                 "-l$link_name",
449                 "",
450                 "$ctx->{VERSION}",
451                 $ctx->{DESCRIPTION},
452                 defined($ctx->{INIT_FUNCTIONS})
453         ); 
454 }
455
456 sub ProtoHeader($$)
457 {
458         my ($self,$ctx) = @_;
459
460         my $dir = $ctx->{BASEDIR};
461
462         $dir =~ s/^\.\///g;
463
464         my $target = "";
465
466         my $comment = "Creating ";
467         if (defined($ctx->{PRIVATE_PROTO_HEADER})) {
468                 $target.= "$dir/$ctx->{PRIVATE_PROTO_HEADER}";
469                 $comment.= "$dir/$ctx->{PRIVATE_PROTO_HEADER}";
470                 if (defined($ctx->{PUBLIC_PROTO_HEADER})) {
471                         $comment .= " and ";
472                         $target.= " ";
473                 }
474                 push (@{$self->{proto_headers}}, "$dir/$ctx->{PRIVATE_PROTO_HEADER}");
475         } else {
476                 $ctx->{PRIVATE_PROTO_HEADER} = $ctx->{PUBLIC_PROTO_HEADER};
477         }
478         
479         if (defined($ctx->{PUBLIC_PROTO_HEADER})) {
480                 $comment.= "$dir/$ctx->{PUBLIC_PROTO_HEADER}";
481                 $target .= "$dir/$ctx->{PUBLIC_PROTO_HEADER}";
482                 push (@{$self->{proto_headers}}, "$dir/$ctx->{PUBLIC_PROTO_HEADER}");
483         } else {
484                 $ctx->{PUBLIC_PROTO_HEADER} = $ctx->{PRIVATE_PROTO_HEADER};
485         }       
486
487         $self->output("$dir/$ctx->{PUBLIC_PROTO_HEADER}: \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST:.o=.c)\n");
488         $self->output("\t\@echo \"$comment\"\n");
489
490         $self->output("\t\@\$(PERL) \$(srcdir)/script/mkproto.pl --private=$dir/$ctx->{PRIVATE_PROTO_HEADER} --public=$dir/$ctx->{PUBLIC_PROTO_HEADER} \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n\n");
491 }
492
493 sub write($$)
494 {
495         my ($self,$file) = @_;
496
497         $self->output("MANPAGES = ".array2oneperline($self->{manpages})."\n");
498         $self->output("BIN_PROGS = " . array2oneperline($self->{bin_progs}) . "\n");
499         $self->output("SBIN_PROGS = " . array2oneperline($self->{sbin_progs}) . "\n");
500         $self->output("BINARIES = " . array2oneperline($self->{binaries}) . "\n");
501         $self->output("STATIC_LIBS = " . array2oneperline($self->{static_libs}) . "\n");
502         $self->output("SHARED_LIBS = " . array2oneperline($self->{shared_libs}) . "\n");
503         $self->output("INSTALLABLE_SHARED_LIBS = " . array2oneperline($self->{installable_shared_libs}) . "\n");
504         $self->output("PUBLIC_HEADERS = " . array2oneperline($self->{headers}) . "\n");
505         $self->output("PC_FILES = " . array2oneperline($self->{pc_files}) . "\n");
506         $self->output("ALL_OBJS = " . array2oneperline($self->{all_objs}) . "\n");
507         $self->output("PROTO_HEADERS = " . array2oneperline($self->{proto_headers}) .  "\n");
508         $self->output("SHARED_MODULES = " . array2oneperline($self->{shared_modules}) . "\n");
509         $self->output("PLUGINS = " . array2oneperline($self->{plugins}) . "\n");
510
511         $self->output("\ninstallplugins: \$(PLUGINS)\n".$self->{install_plugins}."\n");
512         $self->output("\nuninstallplugins:\n".$self->{uninstall_plugins}."\n");
513
514         # nasty hack to allow running locally
515         if ($self->{duplicate_build}) {
516                 $self->output("bin/libdynconfig.\$(SHLIBEXT).0.0.1: dynconfig-devel.o\n");
517                 $self->output("bin/libdynconfig.\$(SHLIBEXT).0.0.1: LIBRARY_DYNCONFIG_OBJ_LIST=dynconfig-devel.o\n");
518         }
519
520         $self->_prepare_mk_files();
521
522         $self->output($self->{mkfile});
523
524         if ($self->{automatic_deps}) {
525                 $self->output("
526 ifneq (\$(MAKECMDGOALS),clean)
527 ifneq (\$(MAKECMDGOALS),distclean)
528 ifneq (\$(MAKECMDGOALS),realdistclean)
529 -include \$(DEP_FILES)
530 endif
531 endif
532 endif
533 ");
534         } else {
535                 $self->output("include static_deps.mk\n");
536         }
537
538         open(MAKEFILE,">$file") || die ("Can't open $file\n");
539         print MAKEFILE $self->{output};
540         close(MAKEFILE);
541
542         print __FILE__.": creating $file\n";
543 }
544
545 1;