r15064: Remove the change until I find proper solution
[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 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} -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, "CFLAGS");
235         $self->_prepare_list($ctx, "DEPEND_LIST");
236         $self->_prepare_list($ctx, "LINK_LIST");
237         $self->_prepare_list($ctx, "LINK_FLAGS");
238
239         push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)");
240
241         if ($ctx->{TYPE} eq "MODULE" and defined($ctx->{INIT_FUNCTION})) {
242                 my $init_fn = $ctx->{INIT_FUNCTION_TYPE};
243                 $init_fn =~ s/\(\*\)/init_module/;
244                 my $proto_fn = $ctx->{INIT_FUNCTION_TYPE};
245                 $proto_fn =~ s/\(\*\)/$ctx->{INIT_FUNCTION}/;
246
247                 $self->output(<< "__EOD__"
248 bin/$ctx->{NAME}_init_module.c:
249         \@echo Creating \$\@
250         \@echo \"#include \\\"includes.h\\\"\" > \$\@
251         \@echo \"$proto_fn;\" >> \$\@
252         \@echo -e \"_PUBLIC_ $init_fn \\n{\\n\\treturn $ctx->{INIT_FUNCTION}();\\n}\\n\" >> \$\@
253 __EOD__
254 );
255                 $init_obj = "bin/$ctx->{NAME}_init_module.o";
256         }
257
258         my $soarg = "";
259         my $soargdebug = "";
260         if ($self->{config}->{SONAMEFLAG} ne "" and 
261                 defined($ctx->{LIBRARY_SONAME})) {
262                 $soarg = "$self->{config}->{SONAMEFLAG}$ctx->{LIBRARY_SONAME} ";
263                 if ($ctx->{LIBRARY_REALNAME} ne $ctx->{LIBRARY_SONAME}) {
264                         $soargdebug = "\n\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{DEBUGDIR}/$ctx->{LIBRARY_SONAME}";
265                 }
266         }
267
268         my $singlesoarg = "";
269         
270         if ($ctx->{DEBUGDIR} ne $installdir) {
271                 $self->output(<< "__EOD__"
272 #
273
274 $ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) $init_obj
275         \@echo Linking \$\@
276         \@mkdir -p $ctx->{DEBUGDIR}
277         \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \$(LOCAL_LINK_FLAGS) \\
278                 \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) $soarg \\
279                 $init_obj \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)$soargdebug
280 __EOD__
281 );
282                 if (defined($ctx->{ALIASES})) {
283                         foreach (@{$ctx->{ALIASES}}) {
284                                 $self->output("\t\@ln -fs $ctx->{LIBRARY_REALNAME} $ctx->{DEBUGDIR}/$_.\$(SHLIBEXT)\n");
285                         }
286                 }
287
288                 $self->output("\n");
289         } else {
290                 if ($self->{config}->{SONAMEFLAG} ne "" and 
291                         defined($ctx->{LIBRARY_SONAME}) and 
292                         $ctx->{LIBRARY_REALNAME} ne $ctx->{LIBRARY_SONAME}) {
293                         $singlesoarg = "\n\t\@ln -fs $ctx->{LIBRARY_REALNAME} $installdir/$ctx->{LIBRARY_SONAME}";
294                 }
295
296         }
297
298         $self->output(<< "__EOD__"
299 #
300
301 $installdir/$ctx->{LIBRARY_REALNAME}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) $init_obj
302         \@echo Linking \$\@
303         \@mkdir -p $installdir
304         \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
305                 \$($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) $soarg \\
306                 $init_obj \$($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST)$singlesoarg
307
308 __EOD__
309 );
310 }
311
312 sub MergedObj($$)
313 {
314         my ($self,$ctx) = @_;
315
316         return unless $ctx->{TARGET};
317
318         $self->_prepare_list($ctx, "OBJ_LIST");
319         $self->_prepare_list($ctx, "CFLAGS");
320         $self->_prepare_list($ctx, "DEPEND_LIST");
321
322         push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)");
323                 
324         $self->output("$ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n");
325
326         $self->output("\t\@echo \"Pre-Linking $ctx->{TYPE} $ctx->{NAME}\"\n");
327         $self->output("\t@\$(LD) -r \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) -o $ctx->{TARGET}\n");
328         $self->output("\n");
329 }
330
331 sub ObjList($$)
332 {
333         my ($self,$ctx) = @_;
334
335         return unless $ctx->{TARGET};
336
337         push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)");
338                 
339         $self->_prepare_list($ctx, "OBJ_LIST");
340         $self->_prepare_list($ctx, "CFLAGS");
341         $self->_prepare_list($ctx, "DEPEND_LIST");
342         $self->output("$ctx->{TARGET}: ");
343         $self->output("\$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)\n");
344         $self->output("\t\@touch $ctx->{TARGET}\n");
345 }
346
347 sub StaticLibrary($$)
348 {
349         my ($self,$ctx) = @_;
350
351         push (@{$self->{static_libs}}, $ctx->{TARGET});
352
353         $self->_prepare_list($ctx, "OBJ_LIST");
354         $self->_prepare_list($ctx, "CFLAGS");
355
356         $self->_prepare_list($ctx, "DEPEND_LIST");
357         $self->_prepare_list($ctx, "LINK_LIST");
358         $self->_prepare_list($ctx, "LINK_FLAGS");
359
360         push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)");
361                 
362         $self->output(<< "__EOD__"
363 #
364 $ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) 
365         \@echo Linking \$@
366         \@\$(STLD) \$(STLD_FLAGS) \$@ \\
367                 \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)
368
369 __EOD__
370 );
371 }
372
373 sub Header($$)
374 {
375         my ($self,$ctx) = @_;
376
377         my $dir = $ctx->{BASEDIR};
378
379         $dir =~ s/^\.\///g;
380
381         foreach (@{$ctx->{PUBLIC_HEADERS}}) {
382                 push (@{$self->{headers}}, "$dir/$_");
383         }
384 }
385
386 sub Binary($$)
387 {
388         my ($self,$ctx) = @_;
389
390         my $installdir;
391         
392         if ($self->{duplicate_build}) {
393                 $installdir = "bin/install";
394         } else {
395                 $installdir = "bin";
396         }
397
398         push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST)");
399                 
400         unless (defined($ctx->{INSTALLDIR})) {
401         } elsif ($ctx->{INSTALLDIR} eq "SBINDIR") {
402                 push (@{$self->{sbin_progs}}, "$installdir/$ctx->{BINARY}");
403         } elsif ($ctx->{INSTALLDIR} eq "BINDIR") {
404                 push (@{$self->{bin_progs}}, "$installdir/$ctx->{BINARY}");
405         }
406
407         push (@{$self->{binaries}}, "bin/$ctx->{BINARY}");
408
409         $self->_prepare_list($ctx, "OBJ_LIST");
410         $self->_prepare_list($ctx, "CFLAGS");
411         $self->_prepare_list($ctx, "DEPEND_LIST");
412         $self->_prepare_list($ctx, "LINK_LIST");
413         $self->_prepare_list($ctx, "LINK_FLAGS");
414
415         if ($self->{duplicate_build}) {
416         $self->output(<< "__EOD__"
417 #
418 bin/$ctx->{BINARY}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) 
419         \@echo Linking \$\@
420         \@\$(CC) \$(LDFLAGS) -o \$\@ \$(LOCAL_LINK_FLAGS) \$(INSTALL_LINK_FLAGS) \\
421                 \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST) \\
422                 \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) 
423
424 __EOD__
425 );
426         }
427
428 $self->output(<< "__EOD__"
429 $installdir/$ctx->{BINARY}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST) 
430         \@echo Linking \$\@
431         \@\$(CC) \$(LDFLAGS) -o \$\@ \$(INSTALL_LINK_FLAGS) \\
432                 \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_LIST) \\
433                 \$\($ctx->{TYPE}_$ctx->{NAME}_LINK_FLAGS) 
434
435 __EOD__
436 );
437 }
438
439 sub Manpage($$)
440 {
441         my ($self,$ctx) = @_;
442
443         my $dir = $ctx->{BASEDIR};
444         
445         $dir =~ s/^\.\///g;
446
447         push (@{$self->{manpages}}, "$dir/$ctx->{MANPAGE}");
448 }
449
450 sub PkgConfig($$)
451 {
452         my ($self,$ctx) = @_;
453         
454         my $link_name = $ctx->{NAME};
455
456         $link_name =~ s/^LIB//g;
457         $link_name = lc($link_name);
458
459         return if (not defined($ctx->{DESCRIPTION}));
460
461         my $path = "$ctx->{BASEDIR}/$link_name.pc";
462
463         push (@{$self->{pc_files}}, $path);
464
465         smb_build::env::PkgConfig($self,
466                 $path,
467                 $link_name,
468                 "-l$link_name",
469                 "",
470                 "$ctx->{VERSION}",
471                 $ctx->{DESCRIPTION},
472                 defined($ctx->{INIT_FUNCTIONS})
473         ); 
474 }
475
476 sub ProtoHeader($$)
477 {
478         my ($self,$ctx) = @_;
479
480         my $dir = $ctx->{BASEDIR};
481
482         $dir =~ s/^\.\///g;
483
484         my $target = "";
485
486         my $comment = "Creating ";
487         if (defined($ctx->{PRIVATE_PROTO_HEADER})) {
488                 $target.= "$dir/$ctx->{PRIVATE_PROTO_HEADER}";
489                 $comment.= "$dir/$ctx->{PRIVATE_PROTO_HEADER}";
490                 if (defined($ctx->{PUBLIC_PROTO_HEADER})) {
491                         $comment .= " and ";
492                         $target.= " ";
493                 }
494                 push (@{$self->{proto_headers}}, "$dir/$ctx->{PRIVATE_PROTO_HEADER}");
495         } else {
496                 $ctx->{PRIVATE_PROTO_HEADER} = $ctx->{PUBLIC_PROTO_HEADER};
497         }
498         
499         if (defined($ctx->{PUBLIC_PROTO_HEADER})) {
500                 $comment.= "$dir/$ctx->{PUBLIC_PROTO_HEADER}";
501                 $target .= "$dir/$ctx->{PUBLIC_PROTO_HEADER}";
502                 push (@{$self->{proto_headers}}, "$dir/$ctx->{PUBLIC_PROTO_HEADER}");
503         } else {
504                 $ctx->{PUBLIC_PROTO_HEADER} = $ctx->{PRIVATE_PROTO_HEADER};
505         }       
506
507         $self->output("$dir/$ctx->{PUBLIC_PROTO_HEADER}: $ctx->{MK_FILE} \$($ctx->{TYPE}_$ctx->{NAME}_OBJ_LIST:.o=.c)\n");
508         $self->output("\t\@echo \"$comment\"\n");
509
510         $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");
511 }
512
513 sub write($$)
514 {
515         my ($self,$file) = @_;
516
517         $self->output("MANPAGES = ".array2oneperline($self->{manpages})."\n");
518         $self->output("BIN_PROGS = " . array2oneperline($self->{bin_progs}) . "\n");
519         $self->output("SBIN_PROGS = " . array2oneperline($self->{sbin_progs}) . "\n");
520         $self->output("BINARIES = " . array2oneperline($self->{binaries}) . "\n");
521         $self->output("STATIC_LIBS = " . array2oneperline($self->{static_libs}) . "\n");
522         $self->output("SHARED_LIBS = " . array2oneperline($self->{shared_libs}) . "\n");
523         $self->output("INSTALLABLE_SHARED_LIBS = " . array2oneperline($self->{installable_shared_libs}) . "\n");
524         $self->output("PUBLIC_HEADERS = " . array2oneperline($self->{headers}) . "\n");
525         $self->output("PC_FILES = " . array2oneperline($self->{pc_files}) . "\n");
526         $self->output("ALL_OBJS = " . array2oneperline($self->{all_objs}) . "\n");
527         $self->output("PROTO_HEADERS = " . array2oneperline($self->{proto_headers}) .  "\n");
528         $self->output("SHARED_MODULES = " . array2oneperline($self->{shared_modules}) . "\n");
529         $self->output("PLUGINS = " . array2oneperline($self->{plugins}) . "\n");
530
531         $self->output("\ninstallplugins: \$(PLUGINS)\n".$self->{install_plugins}."\n");
532         $self->output("\nuninstallplugins:\n".$self->{uninstall_plugins}."\n");
533
534         # nasty hack to allow running locally
535         if ($self->{duplicate_build}) {
536                 $self->output("bin/libdynconfig.\$(SHLIBEXT).0.0.1: dynconfig-devel.o\n");
537                 $self->output("bin/libdynconfig.\$(SHLIBEXT).0.0.1: LIBRARY_DYNCONFIG_OBJ_LIST=dynconfig-devel.o\n");
538         }
539
540         $self->_prepare_mk_files();
541
542         $self->output($self->{mkfile});
543
544         if ($self->{automatic_deps}) {
545                 $self->output("
546 ifneq (\$(MAKECMDGOALS),clean)
547 ifneq (\$(MAKECMDGOALS),distclean)
548 ifneq (\$(MAKECMDGOALS),realdistclean)
549 -include \$(DEP_FILES)
550 endif
551 endif
552 endif
553 ");
554         } else {
555                 $self->output("include \$(srcdir)/static_deps.mk\n");
556         }
557
558         open(MAKEFILE,">$file") || die ("Can't open $file\n");
559         print MAKEFILE $self->{output};
560         close(MAKEFILE);
561
562         print __FILE__.": creating $file\n";
563 }
564
565 1;