1 ###########################################################
2 ### SMB Build System ###
3 ### - create output for Makefile ###
5 ### Copyright (C) Stefan (metze) Metzmacher 2004 ###
6 ### Released under the GNU GPL ###
7 ###########################################################
12 sub _prepare_command_interpreters($)
23 sub _prepare_path_vars($)
28 $output = << '__EOD__';
30 exec_prefix=@exec_prefix@
39 CONFIGDIR = @configdir@
40 VARDIR = @localstatedir@
43 # The permissions to give the executables
46 # set these to where to find various files
47 # These can be overridden by command line switches (see smbd(8))
48 # or in smb.conf (see smb.conf(5))
49 LOGFILEBASE = @logfilebase@
50 CONFIGFILE = $(CONFIGDIR)/smb.conf
51 LMHOSTSFILE = $(CONFIGDIR)/lmhosts
52 NCALRPCDIR = @localstatedir@/ncalrpc
54 # This is where smbpasswd et al go
55 PRIVATEDIR = @privatedir@
56 SMB_PASSWD_FILE = $(PRIVATEDIR)/smbpasswd
58 # the directory where lock files go
61 # the directory where pid files go
66 PATH_FLAGS = -DCONFIGFILE=\"$(CONFIGFILE)\" -DSBINDIR=\"$(SBINDIR)\" \
67 -DBINDIR=\"$(BINDIR)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" \
68 -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" -DLIBDIR=\"$(LIBDIR)\" \
69 -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\" \
70 -DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
71 -DSWATDIR=\"$(SWATDIR)\" -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \
72 -DPRIVATE_DIR=\"$(PRIVATEDIR)\"
78 sub _prepare_compiler_linker($)
84 CFLAGS=-Iinclude -I. -I$(srcdir)/include -I$(srcdir) -D_SAMBA_BUILD_ -DHAVE_CONFIG_H -Ilib @CFLAGS@ @CPPFLAGS@
87 LD_FLAGS=@LDFLAGS@ @CFLAGS@ -Lbin
93 SHLD_FLAGS=@LDSHFLAGS@ @LDFLAGS@ -Lbin
100 sub _prepare_default_rule($)
105 $output = << '__EOD__';
113 sub _prepare_SUFFIXES($)
118 $output = << '__EOD__';
120 .SUFFIXES: .c .o .h .h.gch .a .so .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml
132 idl_full: build/pidl/Parse/Pidl/IDL.pm
133 CPP="@CPP@" PERL="$(PERL)" script/build_idl.sh FULL @PIDL_ARGS@
135 idl: build/pidl/Parse/Pidl/IDL.pm
136 @CPP="@CPP@" PERL="$(PERL)" script/build_idl.sh PARTIAL @PIDL_ARGS@
138 build/pidl/Parse/Pidl/IDL.pm: build/pidl/idl.yp
139 -yapp -s -m 'Parse::Pidl::IDL' -o build/pidl/Parse/Pidl/IDL.pm build/pidl/idl.yp
141 pch: proto include/includes.h.gch
144 -rm -f include/includes.h.gch
146 basics: idl proto_exists HEIMDAL_EXTERNAL
148 test: @DEFAULT_TEST_TARGET@
151 ./script/tests/selftest.sh @selftest_prefix@/st all SOCKET_WRAPPER
154 ./script/tests/selftest.sh @selftest_prefix@/st all
157 ./script/tests/selftest.sh @selftest_prefix@/st quick SOCKET_WRAPPER
160 SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
161 ./script/tests/selftest.sh @selftest_prefix@/st quick SOCKET_WRAPPER
166 sub _prepare_man_rule($)
171 .$suffix.xml.$suffix:
172 \$(XSLTPROC) -o \$@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \$<
177 sub _prepare_manpages($)
183 foreach (values %$ctx) {
184 if (defined($_->{MANPAGE}) and $_->{MANPAGE} ne "") {
185 push (@mp_list, $_->{MANPAGE});
189 my $mp = join(' ', @mp_list);
193 manpages: \$(MANPAGES)
198 sub _prepare_dummy_MAKEDIR()
206 dynconfig.o: dynconfig.c Makefile
208 @$(CC) $(CFLAGS) @PICFLAG@ $(PATH_FLAGS) -c $< -o $@
209 @BROKEN_CC@ -mv `echo $@ | sed 's%^.*/%%g'` $@
214 ###########################################################
215 # This function creates a standard make rule which is using $(CC)
217 # $output = _prepare_std_CC_rule($srcext,$destext,$flags,$message,$comment)
219 # $srcext - sourcefile extension
221 # $destext - destinationfile extension
223 # $flags - additional compiler flags
225 # $message - logmessage which is echoed while running this rule
227 # $comment - just a comment what this rule should do
229 # $output - the resulting output buffer
230 sub _prepare_std_CC_rule($$$$$)
240 $output = << "__EOD__";
243 \@echo $message \$\*.$src
244 \@\$(CC) `script/cflags.sh \$\@` \$(CFLAGS) $flags -c \$< -o \$\@
245 \@BROKEN_CC\@ -mv `echo \$\@ | sed 's%^.*/%%g'` \$\@
252 sub array2oneperline($)
258 next unless defined($_);
260 $output .= " \\\n\t\t$_";
272 foreach (@{$array}) {
273 next unless defined($_);
281 ###########################################################
282 # This function creates a object file list
284 # $output = _prepare_var_obj_list($var, $var_ctx)
286 # $var_ctx - the subsystem context
288 # $var_ctx->{NAME} - the <var> name
289 # $var_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this <var>
291 # $output - the resulting output buffer
292 sub _prepare_obj_list($$)
296 my $tmplist = array2oneperline($ctx->{OBJ_LIST});
299 # $var $ctx->{NAME} OBJ LIST
300 $var\_$ctx->{NAME}_OBJS =$tmplist
305 sub _prepare_cflags($$)
309 my $tmplist = array2oneperline($ctx->{CFLAGS});
312 $var\_$ctx->{NAME}_CFLAGS =$tmplist
317 ###########################################################
318 # This function creates a make rule for linking a library
320 # $output = _prepare_shared_library_rule($library_ctx)
322 # $library_ctx - the library context
324 # $library_ctx->{NAME} - the library name
326 # $library_ctx->{DEPEND_LIST} - the list of rules on which this library depends
328 # $library_ctx->{LIBRARY_NAME} - the shared library name
329 # $library_ctx->{LIBRARY_REALNAME} - the shared library real name
330 # $library_ctx->{LIBRARY_SONAME} - the shared library soname
331 # $library_ctx->{LINK_LIST} - the list of objectfiles and external libraries
332 # which sould be linked to this shared library
333 # $library_ctx->{LINK_FLAGS} - linker flags used by this shared library
335 # $output - the resulting output buffer
336 sub _prepare_shared_library_rule($)
347 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
348 $tmpshlink = array2oneperline($ctx->{LINK_LIST});
349 $tmpshflag = array2oneperline($ctx->{LINK_FLAGS});
351 $output = << "__EOD__";
352 LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
354 LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST =$tmpshlink
355 LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS =$tmpshflag
358 $ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) \$(LIBRARY_$ctx->{NAME}_OBJS) bin/.dummy
360 \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
361 \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS) \\
362 \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST)
366 if (defined($ctx->{LIBRARY_SONAME})) {
367 $output .= << "__EOD__";
368 # Symlink $ctx->{LIBRARY_SONAME}
369 bin/$ctx->{LIBRARY_SONAME}: bin/$ctx->{LIBRARY_REALNAME} bin/.dummy
371 \@ln -sf $ctx->{LIBRARY_REALNAME} \$\@
372 # Symlink $ctx->{LIBRARY_NAME}
373 bin/$ctx->{LIBRARY_NAME}: bin/$ctx->{LIBRARY_SONAME} bin/.dummy
375 \@ln -sf $ctx->{LIBRARY_SONAME} \$\@
380 $output .= << "__EOD__";
381 library_$ctx->{NAME}: basics bin/lib$ctx->{LIBRARY_NAME}
388 sub _prepare_objlist_rule($)
391 my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
394 return "" unless $ctx->{TARGET};
396 $output = "$ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST = $tmpdepend\n";
397 $output .= "$ctx->{TARGET}: ";
398 $output .= "\$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJS)\n";
399 $output .= "\t\@touch $ctx->{TARGET}\n";
404 ###########################################################
405 # This function creates a make rule for linking a library
407 # $output = _prepare_static_library_rule($library_ctx)
409 # $library_ctx - the library context
411 # $library_ctx->{NAME} - the library name
413 # $library_ctx->{DEPEND_LIST} - the list of rules on which this library depends
415 # $library_ctx->{LIBRARY_NAME} - the static library name
416 # $library_ctx->{LINK_LIST} - the list of objectfiles which sould be linked
417 # to this static library
418 # $library_ctx->{LINK_FLAGS} - linker flags used by this static library
420 # $output - the resulting output buffer
421 sub _prepare_static_library_rule($)
432 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
433 $tmpstlink = array2oneperline($ctx->{LINK_LIST});
434 $tmpstflag = array2oneperline($ctx->{LINK_FLAGS});
436 $output = << "__EOD__";
437 LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
439 LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST =$tmpstlink
441 $ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) \$(LIBRARY_$ctx->{NAME}_OBJS) bin/.dummy
443 \@\$(STLD) \$(STLD_FLAGS) \$@ \\
444 \$(LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST)
446 library_$ctx->{NAME}: basics $ctx->{TARGET}
453 ###########################################################
454 # This function creates a make rule for linking a binary
456 # $output = _prepare_binary_rule($binary_ctx)
458 # $binary_ctx - the binary context
460 # $binary_ctx->{NAME} - the binary name
461 # $binary_ctx->{BINARY} - the binary binary name
463 # $binary_ctx->{DEPEND_LIST} - the list of rules on which this binary depends
464 # $binary_ctx->{LINK_LIST} - the list of objectfiles and external libraries
465 # which sould be linked to this binary
466 # $binary_ctx->{LINK_FLAGS} - linker flags used by this binary
468 # $output - the resulting output buffer
469 sub _prepare_binary_rule($)
477 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
478 $tmplink = array2oneperline($ctx->{LINK_LIST});
479 $tmpflag = array2oneperline($ctx->{LINK_FLAGS});
481 $output = << "__EOD__";
483 BINARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
484 BINARY_$ctx->{NAME}_LINK_LIST =$tmplink
485 BINARY_$ctx->{NAME}_LINK_FLAGS =$tmpflag
487 bin/$ctx->{BINARY}: bin/.dummy \$(BINARY_$ctx->{NAME}_DEPEND_LIST) \$(BINARY_$ctx->{NAME}_OBJS)
489 \@\$(LD) \$(LD_FLAGS) -o \$\@ \\
490 \$\(BINARY_$ctx->{NAME}_LINK_FLAGS) \\
491 \$\(BINARY_$ctx->{NAME}_LINK_LIST) \\
492 \$\(BINARY_$ctx->{NAME}_LINK_FLAGS)
493 binary_$ctx->{BINARY}: basics bin/$ctx->{BINARY}
500 sub _prepare_custom_rule($)
504 $ctx->{NAME}: bin/.TARGET_$ctx->{NAME}
506 bin/.TARGET_$ctx->{NAME}:
508 touch bin/.TARGET_$ctx->{NAME}
512 sub _prepare_proto_rules()
516 $output .= << '__EOD__';
517 # Making this target will just make sure that the prototype files
518 # exist, not necessarily that they are up to date. Since they're
519 # removed by 'make clean' this will always be run when you do anything
521 proto_exists: include/proto.h
523 delheaders: pch_clean
524 -rm -f $(builddir)/include/proto.h
527 @cd $(srcdir) && $(SHELL) script/mkproto.sh "$(PERL)" \
528 -h _PROTO_H_ $(builddir)/include/proto.h \
531 # 'make headers' or 'make proto' calls a subshell because we need to
532 # make sure these commands are executed in sequence even for a
534 headers: delheaders proto_exists
539 @[ -f $(builddir)/include/proto.h ] || $(MAKE) proto
542 @echo Removing objects
543 @-find . -name '*.o' -exec rm -f '{}' \;
544 @echo Removing binaries
546 @echo Removing dummy targets
548 @echo Removing generated files
549 @-rm -rf librpc/gen_*
550 @echo Removing generated ASN1 files
551 @-find heimdal/lib/asn1 -name 'asn1_*.[xc]' -exec rm -f '{}' \;
552 @-find heimdal/lib/gssapi -name 'asn1_*.[xc]' -exec rm -f '{}' \;
553 @-find heimdal/lib/hdb -name 'asn1_*.[xc]' -exec rm -f '{}' \;
557 -rm -f include/config.h include/smb_build.h
560 -rm -f config.log config.cache
561 -rm -f samba4-deps.dot
562 -rm -f lib/registry/winregistry.pc
565 -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
567 realdistclean: distclean removebackup
568 -rm -f include/config.h.in
569 -rm -f include/version.h
577 sub _prepare_make_target($)
583 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
586 $ctx->{TARGET}: basics $tmpdepend
591 sub _prepare_target_settings($)
596 foreach my $key (values %$CTX) {
597 if (defined($key->{OBJ_LIST})) {
598 $output .= _prepare_obj_list($key->{TYPE}, $key);
601 if (defined($key->{OBJ_LIST})) {
602 $output .= _prepare_cflags($key->{TYPE}, $key);
609 sub _prepare_install_rules($)
614 $output .= << '__EOD__';
617 @echo "Samba will be installed into:"
618 @echo " basedir: $(BASEDIR)"
619 @echo " bindir: $(BINDIR)"
620 @echo " sbindir: $(SBINDIR)"
621 @echo " libdir: $(LIBDIR)"
622 @echo " vardir: $(VARDIR)"
623 @echo " privatedir: $(PRIVATEDIR)"
624 @echo " piddir: $(PIDDIR)"
625 @echo " lockdir: $(LOCKDIR)"
626 @echo " swatdir: $(SWATDIR)"
627 @echo " mandir: $(MANDIR)"
630 @echo "Samba will be compiled with flags:"
631 @echo " CFLAGS = $(CFLAGS)"
632 @echo " LD_FLAGS = $(LD_FLAGS)"
633 @echo " STLD_FLAGS = $(STLD_FLAGS)"
634 @echo " SHLD_FLAGS = $(SHLD_FLAGS)"
636 SBIN_PROGS = bin/smbd
638 BIN_PROGS = bin/smbclient \
644 TORTURE_PROGS = bin/smbtorture \
650 LDB_PROGS = bin/ldbadd \
656 REG_PROGS = bin/regpatch \
661 GTK_PROGS = bin/gregedit \
665 install: showlayout installbin installtorture installldb installreg installdat installswat installmisc installgtk
667 # DESTDIR is used here to prevent packagers wasting their time
668 # duplicating the Makefile. Remove it and you will have the privilege
669 # of package each samba release for multiple versions of multiple
670 # distributions and operating systems, or at least supplying patches
671 # to all the packaging files required for this, prior to committing
672 # the removal of DESTDIR. Do not remove it even though you think it
676 @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(PRIVATEDIR) $(DESTDIR)$(PIDDIR) $(DESTDIR)$(LOCKDIR) $(DESTDIR)$(PRIVATEDIR)/tls
678 installbin: all installdirs
679 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
680 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(BIN_PROGS)
682 installtorture: all installdirs
683 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(TORTURE_PROGS)
685 installldb: all installdirs
686 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(LDB_PROGS)
688 installreg: all installdirs
689 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(REG_PROGS)
691 installgtk: all installdirs
692 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(GTK_PROGS)
694 installdat: installdirs
695 @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir)
697 installswat: installdirs
698 @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir) $(DESTDIR)$(LIBDIR)
700 installmisc: installdirs
701 @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(BINDIR)
703 installman: installdirs
704 @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
706 uninstall: uninstallbin uninstalltorture uninstallldb uninstallreg uninstallgtk
709 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
712 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(TORTURE_PROGS)
715 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(LDB_PROGS)
718 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(REG_PROGS)
721 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(GTK_PROGS)
724 @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
728 swig: scripting/swig/_tdb.so scripting/swig/_dcerpc.so
730 scripting/swig/tdb_wrap.c: scripting/swig/tdb.i
731 swig -python scripting/swig/tdb.i
733 scripting/swig/_tdb.so: scripting/swig/tdb_wrap.o $(LIBRARY_swig_tdb_DEPEND_LIST)
734 $(SHLD) $(SHLD_FLAGS) -o scripting/swig/_tdb.so scripting/swig/tdb_wrap.o \
735 $(LIBRARY_swig_tdb_SHARED_LINK_LIST) $(LIBRARY_swig_tdb_SHARED_LINK_FLAGS)
737 SWIG_INCLUDES = librpc/gen_ndr/samr.i librpc/gen_ndr/lsa.i librpc/gen_ndr/spoolss.i
739 scripting/swig/dcerpc_wrap.c: scripting/swig/dcerpc.i scripting/swig/samba.i scripting/swig/status_codes.i $(SWIG_INCLUDES)
740 swig -python scripting/swig/dcerpc.i
742 scripting/swig/_dcerpc.so: scripting/swig/dcerpc_wrap.o $(LIBRARY_swig_dcerpc_DEPEND_LIST)
743 $(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)
746 -rm -f scripting/swig/_tdb.so scripting/swig/tdb.pyc \
747 scripting/swig/tdb.py scripting/swig/tdb_wrap.c \
748 scripting/swig/tdb_wrap.o
753 etags `find $(srcdir) -name "*.[ch]"`
756 ctags `find $(srcdir) -name "*.[ch]"`
763 sub _prepare_rule_lists($)
768 foreach my $key (values %{$depend}) {
769 next unless defined $key->{OUTPUT_TYPE};
771 ($output .= _prepare_objlist_rule($key)) if $key->{OUTPUT_TYPE} eq "OBJLIST";
772 ($output .= _prepare_static_library_rule($key)) if $key->{OUTPUT_TYPE} eq "STATIC_LIBRARY";
773 ($output .= _prepare_shared_library_rule($key)) if $key->{OUTPUT_TYPE} eq "SHARED_LIBRARY";
774 ($output .= _prepare_binary_rule($key)) if $key->{OUTPUT_TYPE} eq "BINARY";
775 ($output .= _prepare_custom_rule($key) ) if $key->{TYPE} eq "TARGET";
779 $output .= _prepare_IDL($idl_ctx);
780 $output .= _prepare_proto_rules();
781 $output .= _prepare_install_rules($depend);
786 ###########################################################
787 # This function prepares the output for Makefile
789 # $output = _prepare_makefile_in($OUTPUT)
791 # $OUTPUT - the global OUTPUT context
793 # $output - the resulting output buffer
794 sub _prepare_makefile_in($)
799 $output = "########################################\n";
800 $output .= "# Autogenerated by config.smb_build.pl #\n";
801 $output .= "########################################\n";
805 $output .= _prepare_command_interpreters($cmd_ctx);
808 $output .= _prepare_path_vars($path_ctx);
811 $output .= _prepare_compiler_linker($compiler_ctx);
814 $output .= _prepare_default_rule($rules_ctx);
817 $output .= _prepare_SUFFIXES($suffix_ctx);
819 $output .= _prepare_dummy_MAKEDIR();
820 $output .= _prepare_std_CC_rule("c","o",'@PICFLAG@',"Compiling","Rule for std objectfiles");
821 $output .= _prepare_std_CC_rule("h","h.gch",'@PICFLAG@',"Precompiling","Rule for precompiled headerfiles");
823 $output .= _prepare_man_rule("1");
824 $output .= _prepare_man_rule("3");
825 $output .= _prepare_man_rule("5");
826 $output .= _prepare_man_rule("7");
827 $output .= _prepare_manpages($CTX);
828 $output .= _prepare_target_settings($CTX);
829 $output .= _prepare_rule_lists($CTX);
833 foreach my $part (values %{$CTX}) {
834 push (@all, $part->{TARGET}) if defined ($part->{OUTPUT_TYPE}) and $part->{OUTPUT_TYPE} eq "BINARY";
837 $output .= _prepare_make_target({ TARGET => "all", DEPEND_LIST => \@all });
842 ###########################################################
843 # This function creates Makefile.in from the OUTPUT
846 # create_makefile_in($OUTPUT)
848 # $OUTPUT - the global OUTPUT context
850 # $output - the resulting output buffer
851 sub create_makefile_in($$)
853 my ($CTX, $file) = @_;
855 open(MAKEFILE_IN,">$file") || die ("Can't open $file\n");
856 print MAKEFILE_IN _prepare_makefile_in($CTX);
859 print "config.smb_build.pl: creating $file\n";