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