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