r8985: Automatically generate make dependency rules for
[ira/wip.git] / source4 / build / smb_build / makefile.pm
1 ###########################################################
2 ### SMB Build System                                    ###
3 ### - create output for Makefile                        ###
4 ###                                                     ###
5 ###  Copyright (C) Stefan (metze) Metzmacher 2004       ###
6 ###  Copyright (C) Jelmer Vernooij 2005                 ###
7 ###  Released under the GNU GPL                         ###
8 ###########################################################
9
10 package makefile;
11 use config qw(%config);
12 use strict;
13
14 sub _prepare_path_vars()
15 {
16         my $output;
17
18         $output = << '__EOD__';
19 prefix = @prefix@
20 exec_prefix = @exec_prefix@
21 selftest_prefix = @selftest_prefix@
22 VPATH = @srcdir@
23 srcdir = @srcdir@
24 builddir = @builddir@
25
26 BASEDIR = @prefix@
27 BINDIR = @bindir@
28 SBINDIR = @sbindir@
29 LIBDIR = @libdir@
30 CONFIGDIR = @configdir@
31 localstatedir = @localstatedir@
32 SWATDIR = @swatdir@
33 VARDIR = @localstatedir@
34
35 # The permissions to give the executables
36 INSTALLPERMS = 0755
37
38 # set these to where to find various files
39 # These can be overridden by command line switches (see smbd(8))
40 # or in smb.conf (see smb.conf(5))
41 LOGFILEBASE = @logfilebase@
42 CONFIGFILE = $(CONFIGDIR)/smb.conf
43 LMHOSTSFILE = $(CONFIGDIR)/lmhosts
44 NCALRPCDIR = @localstatedir@/ncalrpc
45
46 # This is where smbpasswd et al go
47 PRIVATEDIR = @privatedir@
48 SMB_PASSWD_FILE = $(PRIVATEDIR)/smbpasswd
49
50 # the directory where lock files go
51 LOCKDIR = @lockdir@
52
53 # the directory where pid files go
54 PIDDIR = @piddir@
55
56 MANDIR = @mandir@
57
58 PATH_FLAGS = -DCONFIGFILE=\"$(CONFIGFILE)\"  -DSBINDIR=\"$(SBINDIR)\" \
59          -DBINDIR=\"$(BINDIR)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" \
60          -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" -DLIBDIR=\"$(LIBDIR)\" \
61          -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\" \
62          -DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
63          -DSWATDIR=\"$(SWATDIR)\" -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \
64          -DPRIVATE_DIR=\"$(PRIVATEDIR)\"
65 __EOD__
66
67         return $output;
68 }
69
70 sub _prepare_compiler_linker()
71 {
72         return << "__EOD__";
73 SHELL=$config{SHELL}
74 PERL=$config{PERL}
75 CC=$config{CC}
76 CFLAGS=-I\$(srcdir)/include -I\$(srcdir) -D_SAMBA_BUILD_ -DHAVE_CONFIG_H -I\$(srcdir)/lib $config{CFLAGS} $config{CPPFLAGS}
77
78 LD=$config{LD}
79 LD_FLAGS=$config{LDFLAGS} -Lbin
80
81 STLD=$config{AR}
82 STLD_FLAGS=-rc
83
84 SHLD=$config{CC}
85 SHLD_FLAGS=$config{LDSHFLAGS} -Lbin
86
87 XSLTPROC=$config{XSLTPROC}
88
89 LEX=$config{LEX}
90 YACC=$config{YACC}
91
92 DEFAULT_TEST_TARGET=$config{DEFAULT_TEST_TARGET}
93
94 __EOD__
95 }
96
97 sub _prepare_default_rule()
98 {
99         return << '__EOD__';
100 default: all
101
102 __EOD__
103 }
104
105 sub _prepare_SUFFIXES()
106 {
107         return << '__EOD__';
108 .SUFFIXES: .x .c .et .y .l .d .o .h .h.gch .a .so .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml
109
110 __EOD__
111 }
112
113 sub _prepare_man_rule($)
114 {
115         my $suffix = shift;
116
117         return << "__EOD__";
118 .$suffix.xml.$suffix:
119         \$(XSLTPROC) -o \$@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \$<
120
121 __EOD__
122 }
123
124 sub _prepare_binaries($)
125 {
126         my $ctx = shift;
127
128         my @bbn_list = ();
129         my @sbn_list = ();
130
131         foreach (values %$ctx) {
132                 next unless defined $_->{OUTPUT_TYPE};
133                 next unless ($_->{OUTPUT_TYPE} eq "BINARY");
134
135                 push(@sbn_list, $_->{OUTPUT}) if ($_->{INSTALLDIR} eq "SBINDIR");
136                 push(@bbn_list, $_->{OUTPUT}) if ($_->{INSTALLDIR} eq "BINDIR");
137         }
138
139         my $bbn = array2oneperline(\@bbn_list);
140         my $sbn = array2oneperline(\@sbn_list);
141         return << "__EOD__";
142 BIN_PROGS = $bbn
143 SBIN_PROGS = $sbn
144 __EOD__
145 }
146
147 sub _prepare_manpages($)
148 {
149         my $ctx = shift;
150
151         my @mp_list = ();
152
153         foreach (values %$ctx) {
154                 push (@mp_list, $_->{MANPAGE}) if (defined($_->{MANPAGE}) and $_->{MANPAGE} ne "");
155         }
156         
157         my $mp = array2oneperline(\@mp_list);
158         return << "__EOD__";
159 MANPAGES = $mp
160
161 __EOD__
162 }
163
164 sub _prepare_dummy_MAKEDIR()
165 {
166         my $ctx = shift;
167
168         return  << '__EOD__';
169 bin/.dummy:
170         @: >> $@ || : > $@
171
172 dynconfig.o: dynconfig.c Makefile
173         @echo Compiling $*.c
174         @$(CC) $(CFLAGS) @PICFLAG@ $(PATH_FLAGS) -c $< -o $@
175 @BROKEN_CC@     -mv `echo $@ | sed 's%^.*/%%g'` $@
176
177 __EOD__
178 }
179
180 sub _prepare_depend_CC_rule()
181 {
182         return << '__EOD__';
183
184 .c.d:
185         @echo "Generating dependencies for $<"
186         @$(CC) -MM -MG -MT $(<:.c=.o) -MF $@ $(CFLAGS) $<
187
188 __EOD__
189 }
190
191 ###########################################################
192 # This function creates a standard make rule which is using $(CC)
193 #
194 # $output = _prepare_std_CC_rule($srcext,$destext,$flags,$message,$comment)
195 #
196 # $srcext -     sourcefile extension
197 #
198 # $destext -    destinationfile extension
199 #
200 # $flags -      additional compiler flags
201 #
202 # $message -    logmessage which is echoed while running this rule
203 #
204 # $comment -    just a comment what this rule should do
205 #
206 # $output -             the resulting output buffer
207 sub _prepare_std_CC_rule($$$$$)
208 {
209         my ($src,$dst,$flags,$message,$comment) = @_;
210
211         return << "__EOD__";
212 # $comment
213 .$src.$dst:
214         \@echo $message \$\*.$src
215         \@\$(CC) `script/cflags.sh \$\@` \$(CFLAGS) $flags -c \$< -o \$\@
216 \@BROKEN_CC\@   -mv `echo \$\@ | sed 's%^.*/%%g'` \$\@
217
218 __EOD__
219 }
220
221 sub array2oneperline($)
222 {
223         my $array = shift;
224         my $output = "";
225
226         foreach (@$array) {
227                 next unless defined($_);
228
229                 $output .= " \\\n\t\t$_";
230         }
231
232         return $output;
233 }
234
235 ###########################################################
236 # This function creates a object file list
237 #
238 # $output = _prepare_var_obj_list($var, $var_ctx)
239 #
240 # $var_ctx -            the subsystem context
241 #
242 # $var_ctx->{NAME}      -       the <var> name
243 # $var_ctx->{OBJ_LIST}  -       the list of objectfiles which sould be linked to this <var>
244 #
245 # $output -             the resulting output buffer
246 sub _prepare_obj_list($$)
247 {
248         my ($var,$ctx) = @_;
249
250         my $tmplist = array2oneperline($ctx->{OBJ_LIST});
251
252         return << "__EOD__";
253 # $var $ctx->{NAME} OBJ LIST
254 $var\_$ctx->{NAME}_OBJS =$tmplist
255
256 __EOD__
257 }
258
259 sub _prepare_cflags($$)
260 {
261         my ($var,$ctx) = @_;
262
263         my $tmplist = array2oneperline($ctx->{CFLAGS});
264
265         return << "__EOD__";
266 $var\_$ctx->{NAME}_CFLAGS =$tmplist
267
268 __EOD__
269 }
270
271 ###########################################################
272 # This function creates a make rule for linking a library
273 #
274 # $output = _prepare_shared_library_rule($library_ctx)
275 #
276 # $library_ctx -                the library context
277 #
278 # $library_ctx->{NAME} -                the library name
279 #
280 # $library_ctx->{DEPEND_LIST} -         the list of rules on which this library depends
281 #
282 # $library_ctx->{LIBRARY_NAME} -        the shared library name
283 # $library_ctx->{LIBRARY_REALNAME} -    the shared library real name
284 # $library_ctx->{LIBRARY_SONAME} - the shared library soname
285 # $library_ctx->{LINK_LIST} -   the list of objectfiles and external libraries
286 #                                       which sould be linked to this shared library
287 # $library_ctx->{LINK_FLAGS} -  linker flags used by this shared library
288 #
289 # $output -             the resulting output buffer
290 sub _prepare_shared_library_rule($)
291 {
292         my $ctx = shift;
293         my $output;
294
295         my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
296         my $tmpshlink = array2oneperline($ctx->{LINK_LIST});
297         my $tmpshflag = array2oneperline($ctx->{LINK_FLAGS});
298
299         $output = << "__EOD__";
300 LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
301 #
302 LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST =$tmpshlink
303 LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS =$tmpshflag
304 #
305
306 $ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) \$(LIBRARY_$ctx->{NAME}_OBJS) bin/.dummy
307         \@echo Linking \$\@
308         \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
309                 \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS) \\
310                 \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST)
311
312 __EOD__
313
314         if (defined($ctx->{LIBRARY_SONAME})) {
315             $output .= << "__EOD__";
316 # Symlink $ctx->{LIBRARY_SONAME}
317 bin/$ctx->{LIBRARY_SONAME}: bin/$ctx->{LIBRARY_REALNAME} bin/.dummy
318         \@echo Symlink \$\@
319         \@ln -sf $ctx->{LIBRARY_REALNAME} \$\@
320 # Symlink $ctx->{LIBRARY_NAME}
321 bin/$ctx->{LIBRARY_NAME}: bin/$ctx->{LIBRARY_SONAME} bin/.dummy
322         \@echo Symlink \$\@
323         \@ln -sf $ctx->{LIBRARY_SONAME} \$\@
324
325 __EOD__
326         }
327
328 $output .= << "__EOD__";
329 library_$ctx->{NAME}: basics bin/lib$ctx->{LIBRARY_NAME}
330
331 __EOD__
332
333         return $output;
334 }
335
336 sub _prepare_mergedobj_rule($)
337 {
338         my $ctx = shift;
339
340         return "" unless $ctx->{TARGET};
341
342         my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
343
344         my $output = "$ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST = $tmpdepend\n";
345
346         $output .= "$ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJS)\n";
347
348         $output .= "\t\@echo \"Pre-Linking $ctx->{TYPE} $ctx->{NAME}\"\n";
349         $output .= "\t@\$(LD) -r \$($ctx->{TYPE}_$ctx->{NAME}_OBJS) -o $ctx->{TARGET}\n";
350         $output .= "\n";
351
352         return $output;
353 }
354
355 sub _prepare_objlist_rule($)
356 {
357         my $ctx = shift;
358         my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
359
360         return "" unless $ctx->{TARGET};
361
362         my $output = "$ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST = $tmpdepend\n";
363         $output .= "$ctx->{TARGET}: ";
364         $output .= "\$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJS)\n";
365         $output .= "\t\@touch $ctx->{TARGET}\n";
366
367         return $output;
368 }
369
370 ###########################################################
371 # This function creates a make rule for linking a library
372 #
373 # $output = _prepare_static_library_rule($library_ctx)
374 #
375 # $library_ctx -                the library context
376 #
377 # $library_ctx->{NAME} -                the library name
378 #
379 # $library_ctx->{DEPEND_LIST} -         the list of rules on which this library depends
380 #
381 # $library_ctx->{LIBRARY_NAME} -        the static library name
382 # $library_ctx->{LINK_LIST} -   the list of objectfiles which sould be linked
383 #                                       to this static library
384 # $library_ctx->{LINK_FLAGS} -  linker flags used by this static library
385 #
386 # $output -             the resulting output buffer
387 sub _prepare_static_library_rule($)
388 {
389         my $ctx = shift;
390         my $output;
391
392         my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
393         my $tmpstlink = array2oneperline($ctx->{LINK_LIST});
394         my $tmpstflag = array2oneperline($ctx->{LINK_FLAGS});
395
396         $output = << "__EOD__";
397 LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
398 #
399 LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST =$tmpstlink
400 #
401 $ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) \$(LIBRARY_$ctx->{NAME}_OBJS) bin/.dummy
402         \@echo Linking \$@
403         \@\$(STLD) \$(STLD_FLAGS) \$@ \\
404                 \$(LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST)
405
406 library_$ctx->{NAME}: basics $ctx->{TARGET}
407
408 __EOD__
409
410         return $output;
411 }
412
413 ###########################################################
414 # This function creates a make rule for linking a binary
415 #
416 # $output = _prepare_binary_rule($binary_ctx)
417 #
418 # $binary_ctx -         the binary context
419 #
420 # $binary_ctx->{NAME} -         the binary name
421 # $binary_ctx->{BINARY} -       the binary binary name
422 #
423 # $binary_ctx->{DEPEND_LIST} -  the list of rules on which this binary depends
424 # $binary_ctx->{LINK_LIST} -    the list of objectfiles and external libraries
425 #                               which sould be linked to this binary
426 # $binary_ctx->{LINK_FLAGS} -   linker flags used by this binary
427 #
428 # $output -             the resulting output buffer
429 sub _prepare_binary_rule($)
430 {
431         my $ctx = shift;
432
433         my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
434         my $tmplink = array2oneperline($ctx->{LINK_LIST});
435         my $tmpflag = array2oneperline($ctx->{LINK_FLAGS});
436
437         my $output = << "__EOD__";
438 #
439 BINARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
440 BINARY_$ctx->{NAME}_LINK_LIST =$tmplink
441 BINARY_$ctx->{NAME}_LINK_FLAGS =$tmpflag
442 #
443 bin/$ctx->{BINARY}: bin/.dummy \$(BINARY_$ctx->{NAME}_DEPEND_LIST) \$(BINARY_$ctx->{NAME}_OBJS)
444         \@echo Linking \$\@
445         \@\$(CC) \$(LD_FLAGS) -o \$\@ \\
446                 \$\(BINARY_$ctx->{NAME}_LINK_FLAGS) \\
447                 \$\(BINARY_$ctx->{NAME}_LINK_LIST) \\
448                 \$\(BINARY_$ctx->{NAME}_LINK_FLAGS)
449 binary_$ctx->{BINARY}: basics bin/$ctx->{BINARY}
450
451 __EOD__
452
453         return $output;
454 }
455
456 sub _prepare_custom_rule($)
457 {
458         my $ctx = shift;
459         return "
460 $ctx->{NAME}: bin/.TARGET_$ctx->{NAME}
461
462 bin/.TARGET_$ctx->{NAME}:
463         $ctx->{CMD}
464         touch bin/.TARGET_$ctx->{NAME}
465 ";
466 }
467
468 sub _prepare_proto_rules()
469 {
470         my $output = << '__EOD__';
471 # Making this target will just make sure that the prototype files
472 # exist, not necessarily that they are up to date.  Since they're
473 # removed by 'make clean' this will always be run when you do anything
474 # afterwards.
475 proto_exists: include/proto.h
476
477 delheaders: pch_clean
478         -rm -f $(builddir)/include/proto.h
479
480 include/proto.h:
481         @cd $(srcdir) && $(SHELL) script/mkproto.sh "$(PERL)" \
482           -h _PROTO_H_ $(builddir)/include/proto.h \
483           $(PROTO_PROTO_OBJS)
484
485 # 'make headers' or 'make proto' calls a subshell because we need to
486 # make sure these commands are executed in sequence even for a
487 # parallel make.
488 headers: delheaders proto_exists
489
490 proto: idl headers
491
492 proto_test:
493         @[ -f $(builddir)/include/proto.h ] || $(MAKE) proto
494
495 clean: delheaders
496         @echo Removing objects
497         @-find . -name '*.o' -exec rm -f '{}' \;
498         @echo Removing binaries
499         @-rm -f bin/*
500         @echo Removing dummy targets
501         @-rm -f bin/.*_*
502         @echo Removing generated files
503         @-rm -rf librpc/gen_*
504         @echo Removing generated ASN1 files
505         @-find heimdal/lib/asn1 -name 'asn1_*.[xc]' -exec rm -f '{}' \;
506         @-find heimdal/lib/gssapi -name 'asn1_*.[xc]' -exec rm -f '{}' \;
507         @-find heimdal/lib/hdb -name 'asn1_*.[xc]' -exec rm -f '{}' \;
508
509
510 distclean: clean
511         -rm -f bin/.dummy
512         -rm -f include/config.h include/smb_build.h
513         -rm -f Makefile*
514         -rm -f config.status
515         -rm -f config.log config.cache
516         -rm -f samba4-deps.dot
517         -rm -f config.pm config.mk
518         -rm -f lib/registry/winregistry.pc
519 __EOD__
520
521         if ($config{developer} eq "yes") {
522                 $output .= "\t@-rm -f \$(_ALL_OBJS_OBJS:.o=.d)\n";
523         }
524
525         $output .= << '__EOD__';
526
527 removebackup:
528         -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
529
530 realdistclean: distclean removebackup
531         -rm -f include/config.h.in
532         -rm -f include/version.h
533         -rm -f configure
534         -rm -f $(MANPAGES)
535 __EOD__
536
537         return $output;
538 }
539
540 sub _prepare_make_target($)
541 {
542         my $ctx = shift;
543         my $tmpdepend;
544
545         $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
546
547         return << "__EOD__";
548 $ctx->{TARGET}: basics $tmpdepend
549
550 __EOD__
551 }
552
553 sub _prepare_target_settings($)
554 {
555         my $CTX = shift;
556         my $output = "";
557
558         foreach my $key (values %$CTX) {
559                 if (defined($key->{OBJ_LIST})) {
560                         $output .= _prepare_obj_list($key->{TYPE}, $key);
561                         $output .= _prepare_cflags($key->{TYPE}, $key);
562                 }
563         }
564
565         return $output;
566 }
567
568 sub _prepare_rule_lists($)
569 {
570         my $depend = shift;
571         my $output = "";
572
573         foreach my $key (values %{$depend}) {
574                 next unless defined $key->{OUTPUT_TYPE};
575
576                 ($output .= _prepare_mergedobj_rule($key)) if $key->{OUTPUT_TYPE} eq "MERGEDOBJ";
577                 ($output .= _prepare_objlist_rule($key)) if $key->{OUTPUT_TYPE} eq "OBJLIST";
578                 ($output .= _prepare_static_library_rule($key)) if $key->{OUTPUT_TYPE} eq "STATIC_LIBRARY";
579                 ($output .= _prepare_shared_library_rule($key)) if $key->{OUTPUT_TYPE} eq "SHARED_LIBRARY";
580                 ($output .= _prepare_binary_rule($key)) if $key->{OUTPUT_TYPE} eq "BINARY";
581                 ($output .= _prepare_custom_rule($key) ) if $key->{TYPE} eq "TARGET";
582         }
583
584         $output .= _prepare_proto_rules();
585
586         return $output;
587 }
588
589 ###########################################################
590 # This function prepares the output for Makefile
591 #
592 # $output = _prepare_makefile_in($OUTPUT)
593 #
594 # $OUTPUT -     the global OUTPUT context
595 #
596 # $output -             the resulting output buffer
597 sub _prepare_makefile_in($)
598 {
599         my ($CTX) = @_;
600         my $output;
601
602         $output  = "########################################\n";
603         $output .= "# Autogenerated by config.smb_build.pl #\n";
604         $output .= "########################################\n";
605         $output .= "\n";
606
607         $output .= _prepare_path_vars();
608         $output .= _prepare_compiler_linker();
609         $output .= _prepare_default_rule();
610         $output .= _prepare_SUFFIXES();
611         $output .= _prepare_dummy_MAKEDIR();
612         $output .= _prepare_std_CC_rule("c","o",$config{PICFLAG},"Compiling","Rule for std objectfiles");
613         $output .= _prepare_std_CC_rule("h","h.gch",$config{PICFLAG},"Precompiling","Rule for precompiled headerfiles");
614
615         $output .= _prepare_depend_CC_rule();
616         
617         $output .= _prepare_man_rule("1");
618         $output .= _prepare_man_rule("3");
619         $output .= _prepare_man_rule("5");
620         $output .= _prepare_man_rule("7");
621         $output .= _prepare_manpages($CTX);
622         $output .= _prepare_binaries($CTX);
623         $output .= _prepare_target_settings($CTX);
624         $output .= _prepare_rule_lists($CTX);
625
626         if ($config{developer} eq "yes") {
627                 $output .= <<__EOD__
628 #-include \$(_ALL_OBJS_OBJS:.o=.d)
629 IDL_FILES = \$(wildcard librpc/idl/*.idl)
630 \$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%.c,\$(IDL_FILES)) \\
631 \$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_\%_c.c,\$(IDL_FILES)) \\
632 \$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%.h,\$(IDL_FILES)): idl
633 __EOD__
634         }
635
636         return $output;
637 }
638
639 ###########################################################
640 # This function creates Makefile.in from the OUTPUT 
641 # context
642 #
643 # create_makefile_in($OUTPUT)
644 #
645 # $OUTPUT       -       the global OUTPUT context
646 #
647 # $output -             the resulting output buffer
648 sub create_makefile_in($$$)
649 {
650         my ($CTX, $mk, $file) = @_;
651
652         open(MAKEFILE_IN,">$file") || die ("Can't open $file\n");
653         print MAKEFILE_IN _prepare_makefile_in($CTX) . $mk;
654         close(MAKEFILE_IN);
655
656         print "config.smb_build.pl: creating $file\n";
657         return; 
658 }
659
660 1;