1 ###########################################################
2 ### SMB Build System ###
3 ### - create output for Makefile ###
5 ### Copyright (C) Stefan (metze) Metzmacher 2004 ###
6 ### Copyright (C) Jelmer Vernooij 2005 ###
7 ### Released under the GNU GPL ###
8 ###########################################################
11 use config qw(%config);
14 sub _prepare_path_vars()
18 $output = << '__EOD__';
20 exec_prefix = @exec_prefix@
29 CONFIGDIR = @configdir@
30 localstatedir = @localstatedir@
32 VARDIR = @localstatedir@
34 # The permissions to give the executables
37 # set these to where to find various files
38 # These can be overridden by command line switches (see smbd(8))
39 # or in smb.conf (see smb.conf(5))
40 LOGFILEBASE = @logfilebase@
41 CONFIGFILE = $(CONFIGDIR)/smb.conf
42 LMHOSTSFILE = $(CONFIGDIR)/lmhosts
43 NCALRPCDIR = @localstatedir@/ncalrpc
45 # This is where smbpasswd et al go
46 PRIVATEDIR = @privatedir@
47 SMB_PASSWD_FILE = $(PRIVATEDIR)/smbpasswd
49 # the directory where lock files go
52 # the directory where pid files go
57 PATH_FLAGS = -DCONFIGFILE=\"$(CONFIGFILE)\" -DSBINDIR=\"$(SBINDIR)\" \
58 -DBINDIR=\"$(BINDIR)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" \
59 -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" -DLIBDIR=\"$(LIBDIR)\" \
60 -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\" \
61 -DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
62 -DSWATDIR=\"$(SWATDIR)\" -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \
63 -DPRIVATE_DIR=\"$(PRIVATEDIR)\"
69 sub _prepare_compiler_linker()
75 CFLAGS=-I\$(srcdir)/include -I\$(srcdir) -D_SAMBA_BUILD_ -DHAVE_CONFIG_H -I\$(srcdir)/lib $config{CFLAGS} $config{CPPFLAGS}
78 LD_FLAGS=$config{LDFLAGS} -Lbin
84 SHLD_FLAGS=$config{LDSHFLAGS} -Lbin
86 XSLTPROC=$config{XSLTPROC}
94 sub _prepare_default_rule()
102 sub _prepare_SUFFIXES()
106 .SUFFIXES: .c .et .y .l .d .o .h .h.gch .a .so .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml
114 idl_full: build/pidl/Parse/Pidl/IDL.pm
115 @CPP="$(CPP)" PERL="$(PERL)" script/build_idl.sh FULL @PIDL_ARGS@
117 idl: build/pidl/Parse/Pidl/IDL.pm
118 @CPP="$(CPP)" PERL="$(PERL)" script/build_idl.sh PARTIAL @PIDL_ARGS@
120 build/pidl/Parse/Pidl/IDL.pm: build/pidl/idl.yp
121 -yapp -s -m 'Parse::Pidl::IDL' -o build/pidl/Parse/Pidl/IDL.pm build/pidl/idl.yp
123 smb_interfaces: build/pidl/smb_interfaces.pm
124 $(PERL) -Ibuild/pidl script/build_smb_interfaces.pl \
125 include/smb_interfaces.h
127 build/pidl/smb_interfaces.pm: build/pidl/smb_interfaces.yp
128 -yapp -s -m 'smb_interfaces' -o build/pidl/smb_interfaces.pm build/pidl/smb_interfaces.yp
130 pch: proto include/includes.h.gch
133 -rm -f include/includes.h.gch
135 basics: idl proto_exists HEIMDAL_EXTERNAL
137 test: @DEFAULT_TEST_TARGET@
140 ./script/tests/selftest.sh @selftest_prefix@/st all SOCKET_WRAPPER
143 ./script/tests/selftest.sh @selftest_prefix@/st all
146 ./script/tests/selftest.sh @selftest_prefix@/st quick SOCKET_WRAPPER
149 SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
150 ./script/tests/selftest.sh @selftest_prefix@/st quick SOCKET_WRAPPER
155 sub _prepare_man_rule($)
160 .$suffix.xml.$suffix:
161 \$(XSLTPROC) -o \$@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \$<
166 sub _prepare_binaries($)
173 foreach (values %$ctx) {
174 next unless defined $_->{OUTPUT_TYPE};
175 next unless ($_->{OUTPUT_TYPE} eq "BINARY");
177 push (@sbn_list, $_->{OUTPUT}) if ($_->{INSTALLDIR} eq "SBINDIR");
178 push(@bbn_list, $_->{OUTPUT}) if ($_->{INSTALLDIR} eq "BINDIR");
181 my $bbn = array2oneperline(\@bbn_list);
182 my $sbn = array2oneperline(\@sbn_list);
187 binaries: \$(BIN_PROGS) \$(SBIN_PROGS)
192 sub _prepare_manpages($)
198 foreach (values %$ctx) {
199 push (@mp_list, $_->{MANPAGE}) if (defined($_->{MANPAGE}) and $_->{MANPAGE} ne "");
202 my $mp = array2oneperline(\@mp_list);
206 manpages: \$(MANPAGES)
211 sub _prepare_dummy_MAKEDIR()
219 dynconfig.o: dynconfig.c Makefile
221 @$(CC) $(CFLAGS) @PICFLAG@ $(PATH_FLAGS) -c $< -o $@
222 @BROKEN_CC@ -mv `echo $@ | sed 's%^.*/%%g'` $@
227 sub _prepare_et_rule()
232 $(MAKE) bin/compile_et
239 sub _prepare_yacc_rule()
248 sub _prepare_lex_rule()
257 sub _prepare_depend_CC_rule()
262 @echo "Generating dependencies for $<"
263 @$(CC) -MM -MG -MT $(<:.c=.o) -MF $@ $(CFLAGS) $<
268 ###########################################################
269 # This function creates a standard make rule which is using $(CC)
271 # $output = _prepare_std_CC_rule($srcext,$destext,$flags,$message,$comment)
273 # $srcext - sourcefile extension
275 # $destext - destinationfile extension
277 # $flags - additional compiler flags
279 # $message - logmessage which is echoed while running this rule
281 # $comment - just a comment what this rule should do
283 # $output - the resulting output buffer
284 sub _prepare_std_CC_rule($$$$$)
286 my ($src,$dst,$flags,$message,$comment) = @_;
291 \@echo $message \$\*.$src
292 \@\$(CC) `script/cflags.sh \$\@` \$(CFLAGS) $flags -c \$< -o \$\@
293 \@BROKEN_CC\@ -mv `echo \$\@ | sed 's%^.*/%%g'` \$\@
298 sub array2oneperline($)
304 next unless defined($_);
306 $output .= " \\\n\t\t$_";
312 ###########################################################
313 # This function creates a object file list
315 # $output = _prepare_var_obj_list($var, $var_ctx)
317 # $var_ctx - the subsystem context
319 # $var_ctx->{NAME} - the <var> name
320 # $var_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this <var>
322 # $output - the resulting output buffer
323 sub _prepare_obj_list($$)
327 my $tmplist = array2oneperline($ctx->{OBJ_LIST});
330 # $var $ctx->{NAME} OBJ LIST
331 $var\_$ctx->{NAME}_OBJS =$tmplist
336 sub _prepare_cflags($$)
340 my $tmplist = array2oneperline($ctx->{CFLAGS});
343 $var\_$ctx->{NAME}_CFLAGS =$tmplist
348 ###########################################################
349 # This function creates a make rule for linking a library
351 # $output = _prepare_shared_library_rule($library_ctx)
353 # $library_ctx - the library context
355 # $library_ctx->{NAME} - the library name
357 # $library_ctx->{DEPEND_LIST} - the list of rules on which this library depends
359 # $library_ctx->{LIBRARY_NAME} - the shared library name
360 # $library_ctx->{LIBRARY_REALNAME} - the shared library real name
361 # $library_ctx->{LIBRARY_SONAME} - the shared library soname
362 # $library_ctx->{LINK_LIST} - the list of objectfiles and external libraries
363 # which sould be linked to this shared library
364 # $library_ctx->{LINK_FLAGS} - linker flags used by this shared library
366 # $output - the resulting output buffer
367 sub _prepare_shared_library_rule($)
372 my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
373 my $tmpshlink = array2oneperline($ctx->{LINK_LIST});
374 my $tmpshflag = array2oneperline($ctx->{LINK_FLAGS});
376 $output = << "__EOD__";
377 LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
379 LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST =$tmpshlink
380 LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS =$tmpshflag
383 $ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) \$(LIBRARY_$ctx->{NAME}_OBJS) bin/.dummy
385 \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
386 \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS) \\
387 \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST)
391 if (defined($ctx->{LIBRARY_SONAME})) {
392 $output .= << "__EOD__";
393 # Symlink $ctx->{LIBRARY_SONAME}
394 bin/$ctx->{LIBRARY_SONAME}: bin/$ctx->{LIBRARY_REALNAME} bin/.dummy
396 \@ln -sf $ctx->{LIBRARY_REALNAME} \$\@
397 # Symlink $ctx->{LIBRARY_NAME}
398 bin/$ctx->{LIBRARY_NAME}: bin/$ctx->{LIBRARY_SONAME} bin/.dummy
400 \@ln -sf $ctx->{LIBRARY_SONAME} \$\@
405 $output .= << "__EOD__";
406 library_$ctx->{NAME}: basics bin/lib$ctx->{LIBRARY_NAME}
413 sub _prepare_mergedobj_rule($)
417 return "" unless $ctx->{TARGET};
421 my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
423 $output .= "$ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST = $tmpdepend\n";
425 $output .= "$ctx->{TARGET}: \$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJS)\n";
427 $output .= "\t\@echo \"Pre-Linking $ctx->{TYPE} $ctx->{NAME}\"\n";
428 $output .= "\t@\$(LD) -r \$($ctx->{TYPE}_$ctx->{NAME}_OBJS) -o $ctx->{TARGET}\n";
434 sub _prepare_objlist_rule($)
437 my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
439 return "" unless $ctx->{TARGET};
441 my $output = "$ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST = $tmpdepend\n";
442 $output .= "$ctx->{TARGET}: ";
443 $output .= "\$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJS)\n";
444 $output .= "\t\@touch $ctx->{TARGET}\n";
449 ###########################################################
450 # This function creates a make rule for linking a library
452 # $output = _prepare_static_library_rule($library_ctx)
454 # $library_ctx - the library context
456 # $library_ctx->{NAME} - the library name
458 # $library_ctx->{DEPEND_LIST} - the list of rules on which this library depends
460 # $library_ctx->{LIBRARY_NAME} - the static library name
461 # $library_ctx->{LINK_LIST} - the list of objectfiles which sould be linked
462 # to this static library
463 # $library_ctx->{LINK_FLAGS} - linker flags used by this static library
465 # $output - the resulting output buffer
466 sub _prepare_static_library_rule($)
471 my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
472 my $tmpstlink = array2oneperline($ctx->{LINK_LIST});
473 my $tmpstflag = array2oneperline($ctx->{LINK_FLAGS});
475 $output = << "__EOD__";
476 LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
478 LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST =$tmpstlink
480 $ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) \$(LIBRARY_$ctx->{NAME}_OBJS) bin/.dummy
482 \@\$(STLD) \$(STLD_FLAGS) \$@ \\
483 \$(LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST)
485 library_$ctx->{NAME}: basics $ctx->{TARGET}
492 ###########################################################
493 # This function creates a make rule for linking a binary
495 # $output = _prepare_binary_rule($binary_ctx)
497 # $binary_ctx - the binary context
499 # $binary_ctx->{NAME} - the binary name
500 # $binary_ctx->{BINARY} - the binary binary name
502 # $binary_ctx->{DEPEND_LIST} - the list of rules on which this binary depends
503 # $binary_ctx->{LINK_LIST} - the list of objectfiles and external libraries
504 # which sould be linked to this binary
505 # $binary_ctx->{LINK_FLAGS} - linker flags used by this binary
507 # $output - the resulting output buffer
508 sub _prepare_binary_rule($)
512 my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
513 my $tmplink = array2oneperline($ctx->{LINK_LIST});
514 my $tmpflag = array2oneperline($ctx->{LINK_FLAGS});
516 my $output = << "__EOD__";
518 BINARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
519 BINARY_$ctx->{NAME}_LINK_LIST =$tmplink
520 BINARY_$ctx->{NAME}_LINK_FLAGS =$tmpflag
522 bin/$ctx->{BINARY}: bin/.dummy \$(BINARY_$ctx->{NAME}_DEPEND_LIST) \$(BINARY_$ctx->{NAME}_OBJS)
524 \@\$(CC) \$(LD_FLAGS) -o \$\@ \\
525 \$\(BINARY_$ctx->{NAME}_LINK_FLAGS) \\
526 \$\(BINARY_$ctx->{NAME}_LINK_LIST) \\
527 \$\(BINARY_$ctx->{NAME}_LINK_FLAGS)
528 binary_$ctx->{BINARY}: basics bin/$ctx->{BINARY}
535 sub _prepare_custom_rule($)
539 $ctx->{NAME}: bin/.TARGET_$ctx->{NAME}
541 bin/.TARGET_$ctx->{NAME}:
543 touch bin/.TARGET_$ctx->{NAME}
547 sub _prepare_proto_rules()
549 my $output = << '__EOD__';
550 # Making this target will just make sure that the prototype files
551 # exist, not necessarily that they are up to date. Since they're
552 # removed by 'make clean' this will always be run when you do anything
554 proto_exists: include/proto.h
556 delheaders: pch_clean
557 -rm -f $(builddir)/include/proto.h
560 @cd $(srcdir) && $(SHELL) script/mkproto.sh "$(PERL)" \
561 -h _PROTO_H_ $(builddir)/include/proto.h \
564 # 'make headers' or 'make proto' calls a subshell because we need to
565 # make sure these commands are executed in sequence even for a
567 headers: delheaders proto_exists
572 @[ -f $(builddir)/include/proto.h ] || $(MAKE) proto
575 @echo Removing objects
576 @-find . -name '*.o' -exec rm -f '{}' \;
577 @echo Removing binaries
579 @echo Removing dummy targets
581 @echo Removing generated files
582 @-rm -rf librpc/gen_*
583 @echo Removing generated ASN1 files
584 @-find heimdal/lib/asn1 -name 'asn1_*.[xc]' -exec rm -f '{}' \;
585 @-find heimdal/lib/gssapi -name 'asn1_*.[xc]' -exec rm -f '{}' \;
586 @-find heimdal/lib/hdb -name 'asn1_*.[xc]' -exec rm -f '{}' \;
590 -rm -f include/config.h include/smb_build.h
593 -rm -f config.log config.cache
594 -rm -f samba4-deps.dot
595 -rm -f config.pm config.mk
596 -rm -f lib/registry/winregistry.pc
599 if ($config{developer} eq "yes") {
600 $output .= "\t@-rm -f \$(_ALL_OBJS_OBJS:.o=.d)\n";
603 $output .= << '__EOD__';
606 -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
608 realdistclean: distclean removebackup
609 -rm -f include/config.h.in
610 -rm -f include/version.h
618 sub _prepare_make_target($)
623 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
626 $ctx->{TARGET}: basics $tmpdepend
631 sub _prepare_target_settings($)
636 foreach my $key (values %$CTX) {
637 if (defined($key->{OBJ_LIST})) {
638 $output .= _prepare_obj_list($key->{TYPE}, $key);
639 $output .= _prepare_cflags($key->{TYPE}, $key);
646 sub _prepare_install_rules()
651 @echo "Samba will be installed into:"
652 @echo " basedir: $(BASEDIR)"
653 @echo " bindir: $(BINDIR)"
654 @echo " sbindir: $(SBINDIR)"
655 @echo " libdir: $(LIBDIR)"
656 @echo " vardir: $(VARDIR)"
657 @echo " privatedir: $(PRIVATEDIR)"
658 @echo " piddir: $(PIDDIR)"
659 @echo " lockdir: $(LOCKDIR)"
660 @echo " swatdir: $(SWATDIR)"
661 @echo " mandir: $(MANDIR)"
664 @echo "Samba will be compiled with flags:"
665 @echo " CFLAGS = $(CFLAGS)"
666 @echo " LD_FLAGS = $(LD_FLAGS)"
667 @echo " STLD_FLAGS = $(STLD_FLAGS)"
668 @echo " SHLD_FLAGS = $(SHLD_FLAGS)"
670 install: showlayout installbin installdat installswat
672 # DESTDIR is used here to prevent packagers wasting their time
673 # duplicating the Makefile. Remove it and you will have the privilege
674 # of packaging each samba release for multiple versions of multiple
675 # distributions and operating systems, or at least supplying patches
676 # to all the packaging files required for this, prior to committing
677 # the removal of DESTDIR. Do not remove it even though you think it
681 @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(PRIVATEDIR) $(DESTDIR)$(PIDDIR) $(DESTDIR)$(LOCKDIR) $(DESTDIR)$(PRIVATEDIR)/tls
683 installbin: all installdirs
684 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
685 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(BIN_PROGS)
687 installdat: installdirs
688 @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir)
690 installswat: installdirs
691 @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir) $(DESTDIR)$(LIBDIR)
693 installman: installdirs
694 @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
696 uninstall: uninstallbin uninstallman
699 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
700 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
703 @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
706 swig: scripting/swig/_tdb.so scripting/swig/_dcerpc.so
708 scripting/swig/tdb_wrap.c: scripting/swig/tdb.i
709 swig -python scripting/swig/tdb.i
711 scripting/swig/_tdb.so: scripting/swig/tdb_wrap.o $(LIBRARY_swig_tdb_DEPEND_LIST)
712 $(SHLD) $(SHLD_FLAGS) -o scripting/swig/_tdb.so scripting/swig/tdb_wrap.o \
713 $(LIBRARY_swig_tdb_SHARED_LINK_LIST) $(LIBRARY_swig_tdb_SHARED_LINK_FLAGS)
715 SWIG_INCLUDES = librpc/gen_ndr/samr.i librpc/gen_ndr/lsa.i librpc/gen_ndr/spoolss.i
717 scripting/swig/dcerpc_wrap.c: scripting/swig/dcerpc.i scripting/swig/samba.i scripting/swig/status_codes.i $(SWIG_INCLUDES)
718 swig -python scripting/swig/dcerpc.i
720 scripting/swig/_dcerpc.so: scripting/swig/dcerpc_wrap.o $(LIBRARY_swig_dcerpc_DEPEND_LIST)
721 $(SHLD) $(SHLD_FLAGS) -o scripting/swig/_dcerpc.so scripting/swig/dcerpc_wrap.o $(LIBRARY_swig_dcerpc_SHARED_LINK_LIST) $(LIBRARY_swig_dcerpc_SHARED_LINK_FLAGS)
724 -rm -f scripting/swig/_tdb.so scripting/swig/tdb.pyc \
725 scripting/swig/tdb.py scripting/swig/tdb_wrap.c \
726 scripting/swig/tdb_wrap.o
731 etags `find $(srcdir) -name "*.[ch]"`
734 ctags `find $(srcdir) -name "*.[ch]"`
739 sub _prepare_rule_lists($)
744 foreach my $key (values %{$depend}) {
745 next unless defined $key->{OUTPUT_TYPE};
747 ($output .= _prepare_mergedobj_rule($key)) if $key->{OUTPUT_TYPE} eq "MERGEDOBJ";
748 ($output .= _prepare_objlist_rule($key)) if $key->{OUTPUT_TYPE} eq "OBJLIST";
749 ($output .= _prepare_static_library_rule($key)) if $key->{OUTPUT_TYPE} eq "STATIC_LIBRARY";
750 ($output .= _prepare_shared_library_rule($key)) if $key->{OUTPUT_TYPE} eq "SHARED_LIBRARY";
751 ($output .= _prepare_binary_rule($key)) if $key->{OUTPUT_TYPE} eq "BINARY";
752 ($output .= _prepare_custom_rule($key) ) if $key->{TYPE} eq "TARGET";
755 $output .= _prepare_IDL();
756 $output .= _prepare_proto_rules();
757 $output .= _prepare_install_rules();
762 ###########################################################
763 # This function prepares the output for Makefile
765 # $output = _prepare_makefile_in($OUTPUT)
767 # $OUTPUT - the global OUTPUT context
769 # $output - the resulting output buffer
770 sub _prepare_makefile_in($)
775 $output = "########################################\n";
776 $output .= "# Autogenerated by config.smb_build.pl #\n";
777 $output .= "########################################\n";
780 $output .= _prepare_path_vars();
781 $output .= _prepare_compiler_linker();
782 $output .= _prepare_default_rule();
783 $output .= _prepare_SUFFIXES();
784 $output .= _prepare_dummy_MAKEDIR();
785 $output .= _prepare_std_CC_rule("c","o",$config{PICFLAG},"Compiling","Rule for std objectfiles");
786 $output .= _prepare_std_CC_rule("h","h.gch",$config{PICFLAG},"Precompiling","Rule for precompiled headerfiles");
787 $output .= _prepare_lex_rule();
788 $output .= _prepare_yacc_rule();
789 $output .= _prepare_et_rule();
791 $output .= _prepare_depend_CC_rule();
793 $output .= _prepare_man_rule("1");
794 $output .= _prepare_man_rule("3");
795 $output .= _prepare_man_rule("5");
796 $output .= _prepare_man_rule("7");
797 $output .= _prepare_manpages($CTX);
798 $output .= _prepare_binaries($CTX);
799 $output .= _prepare_target_settings($CTX);
800 $output .= _prepare_rule_lists($CTX);
804 foreach my $part (values %{$CTX}) {
805 push (@all, $part->{TARGET}) if defined ($part->{OUTPUT_TYPE}) and $part->{OUTPUT_TYPE} eq "BINARY";
808 $output .= _prepare_make_target({ TARGET => "all", DEPEND_LIST => \@all });
810 if ($config{developer} eq "yes") {
812 #-include \$(_ALL_OBJS_OBJS:.o=.d)
813 IDL_FILES = \$(wildcard librpc/idl/*.idl)
814 \$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%.c,\$(IDL_FILES)) \\
815 \$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_\%_c.c,\$(IDL_FILES)) \\
816 \$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%.h,\$(IDL_FILES)): idl
823 ###########################################################
824 # This function creates Makefile.in from the OUTPUT
827 # create_makefile_in($OUTPUT)
829 # $OUTPUT - the global OUTPUT context
831 # $output - the resulting output buffer
832 sub create_makefile_in($$$)
834 my ($CTX, $mk, $file) = @_;
836 open(MAKEFILE_IN,">$file") || die ("Can't open $file\n");
837 print MAKEFILE_IN _prepare_makefile_in($CTX) . $mk;
840 print "config.smb_build.pl: creating $file\n";