1 ###########################################################
2 ### SMB Build System ###
3 ### - create output for Makefile ###
5 ### Copyright (C) Stefan (metze) Metzmacher 2004 ###
6 ### Released under the GNU GPL ###
7 ###########################################################
10 use config
qw(%config);
13 sub _prepare_command_interpreters($)
24 sub _prepare_path_vars($)
29 $output = << '__EOD__';
31 exec_prefix=@exec_prefix@
40 CONFIGDIR = @configdir@
41 localstatedir = @localstatedir@
43 VARDIR = @localstatedir@
45 # The permissions to give the executables
48 # set these to where to find various files
49 # These can be overridden by command line switches (see smbd(8))
50 # or in smb.conf (see smb.conf(5))
51 LOGFILEBASE = @logfilebase@
52 CONFIGFILE = $(CONFIGDIR)/smb.conf
53 LMHOSTSFILE = $(CONFIGDIR)/lmhosts
54 NCALRPCDIR = @localstatedir@/ncalrpc
56 # This is where smbpasswd et al go
57 PRIVATEDIR = @privatedir@
58 SMB_PASSWD_FILE = $(PRIVATEDIR)/smbpasswd
60 # the directory where lock files go
63 # the directory where pid files go
68 PATH_FLAGS = -DCONFIGFILE=\"$(CONFIGFILE)\" -DSBINDIR=\"$(SBINDIR)\" \
69 -DBINDIR=\"$(BINDIR)\" -DLMHOSTSFILE=\"$(LMHOSTSFILE)\" \
70 -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\" -DLIBDIR=\"$(LIBDIR)\" \
71 -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\" \
72 -DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\" \
73 -DSWATDIR=\"$(SWATDIR)\" -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" \
74 -DPRIVATE_DIR=\"$(PRIVATEDIR)\"
80 sub _prepare_compiler_linker($)
86 CFLAGS=-Iinclude -I. -I$(srcdir)/include -I$(srcdir) -D_SAMBA_BUILD_ -DHAVE_CONFIG_H -Ilib @CFLAGS@ @CPPFLAGS@
89 LD_FLAGS=@LDFLAGS@ @CFLAGS@ -Lbin
95 SHLD_FLAGS=@LDSHFLAGS@ @LDFLAGS@ -Lbin
102 sub _prepare_default_rule($)
107 $output = << '__EOD__';
115 sub _prepare_SUFFIXES($)
120 $output = << '__EOD__';
122 .SUFFIXES: .c .d .o .h .h.gch .a .so .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml
134 idl_full: build/pidl/Parse/Pidl/IDL.pm
135 CPP="@CPP@" PERL="$(PERL)" script/build_idl.sh FULL @PIDL_ARGS@
137 idl: build/pidl/Parse/Pidl/IDL.pm
138 @CPP="@CPP@" PERL="$(PERL)" script/build_idl.sh PARTIAL @PIDL_ARGS@
140 build/pidl/Parse/Pidl/IDL.pm: build/pidl/idl.yp
141 -yapp -s -m 'Parse::Pidl::IDL' -o build/pidl/Parse/Pidl/IDL.pm build/pidl/idl.yp
143 pch: proto include/includes.h.gch
146 -rm -f include/includes.h.gch
148 basics: idl proto_exists HEIMDAL_EXTERNAL
150 test: @DEFAULT_TEST_TARGET@
153 ./script/tests/selftest.sh @selftest_prefix@/st all SOCKET_WRAPPER
156 ./script/tests/selftest.sh @selftest_prefix@/st all
159 ./script/tests/selftest.sh @selftest_prefix@/st quick SOCKET_WRAPPER
162 SMBD_VALGRIND="xterm -n smbd -e valgrind -q --db-attach=yes --num-callers=30" \
163 ./script/tests/selftest.sh @selftest_prefix@/st quick SOCKET_WRAPPER
168 sub _prepare_man_rule($)
173 .$suffix.xml.$suffix:
174 \$(XSLTPROC) -o \$@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \$<
179 sub _prepare_manpages($)
185 foreach (values %$ctx) {
186 if (defined($_->{MANPAGE}) and $_->{MANPAGE} ne "") {
187 push (@mp_list, $_->{MANPAGE});
191 my $mp = join(' ', @mp_list);
195 manpages: \$(MANPAGES)
200 sub _prepare_dummy_MAKEDIR()
208 dynconfig.o: dynconfig.c Makefile
210 @$(CC) $(CFLAGS) @PICFLAG@ $(PATH_FLAGS) -c $< -o $@
211 @BROKEN_CC@ -mv `echo $@ | sed 's%^.*/%%g'` $@
216 sub _prepare_depend_CC_rule()
221 @echo "Generating dependencies for $<"
222 @$(CC) -MM -MG -MT $(<:.c=.o) -MF $@ $(CFLAGS) $<
227 ###########################################################
228 # This function creates a standard make rule which is using $(CC)
230 # $output = _prepare_std_CC_rule($srcext,$destext,$flags,$message,$comment)
232 # $srcext - sourcefile extension
234 # $destext - destinationfile extension
236 # $flags - additional compiler flags
238 # $message - logmessage which is echoed while running this rule
240 # $comment - just a comment what this rule should do
242 # $output - the resulting output buffer
243 sub _prepare_std_CC_rule($$$$$)
253 $output = << "__EOD__";
256 \@echo $message \$\*.$src
257 \@\$(CC) `script/cflags.sh \$\@` \$(CFLAGS) $flags -c \$< -o \$\@
258 \@BROKEN_CC\@ -mv `echo \$\@ | sed 's%^.*/%%g'` \$\@
265 sub array2oneperline($)
271 next unless defined($_);
273 $output .= " \\\n\t\t$_";
285 foreach (@{$array}) {
286 next unless defined($_);
294 ###########################################################
295 # This function creates a object file list
297 # $output = _prepare_var_obj_list($var, $var_ctx)
299 # $var_ctx - the subsystem context
301 # $var_ctx->{NAME} - the <var> name
302 # $var_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this <var>
304 # $output - the resulting output buffer
305 sub _prepare_obj_list($$)
309 my $tmplist = array2oneperline($ctx->{OBJ_LIST});
312 # $var $ctx->{NAME} OBJ LIST
313 $var\_$ctx->{NAME}_OBJS =$tmplist
318 sub _prepare_cflags($$)
322 my $tmplist = array2oneperline($ctx->{CFLAGS});
325 $var\_$ctx->{NAME}_CFLAGS =$tmplist
330 ###########################################################
331 # This function creates a make rule for linking a library
333 # $output = _prepare_shared_library_rule($library_ctx)
335 # $library_ctx - the library context
337 # $library_ctx->{NAME} - the library name
339 # $library_ctx->{DEPEND_LIST} - the list of rules on which this library depends
341 # $library_ctx->{LIBRARY_NAME} - the shared library name
342 # $library_ctx->{LIBRARY_REALNAME} - the shared library real name
343 # $library_ctx->{LIBRARY_SONAME} - the shared library soname
344 # $library_ctx->{LINK_LIST} - the list of objectfiles and external libraries
345 # which sould be linked to this shared library
346 # $library_ctx->{LINK_FLAGS} - linker flags used by this shared library
348 # $output - the resulting output buffer
349 sub _prepare_shared_library_rule($)
360 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
361 $tmpshlink = array2oneperline($ctx->{LINK_LIST});
362 $tmpshflag = array2oneperline($ctx->{LINK_FLAGS});
364 $output = << "__EOD__";
365 LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
367 LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST =$tmpshlink
368 LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS =$tmpshflag
371 $ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) \$(LIBRARY_$ctx->{NAME}_OBJS) bin/.dummy
373 \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
374 \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS) \\
375 \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST)
379 if (defined($ctx->{LIBRARY_SONAME})) {
380 $output .= << "__EOD__";
381 # Symlink $ctx->{LIBRARY_SONAME}
382 bin/$ctx->{LIBRARY_SONAME}: bin/$ctx->{LIBRARY_REALNAME} bin/.dummy
384 \@ln -sf $ctx->{LIBRARY_REALNAME} \$\@
385 # Symlink $ctx->{LIBRARY_NAME}
386 bin/$ctx->{LIBRARY_NAME}: bin/$ctx->{LIBRARY_SONAME} bin/.dummy
388 \@ln -sf $ctx->{LIBRARY_SONAME} \$\@
393 $output .= << "__EOD__";
394 library_$ctx->{NAME}: basics bin/lib$ctx->{LIBRARY_NAME}
401 sub _prepare_objlist_rule($)
404 my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
407 return "" unless $ctx->{TARGET};
409 $output = "$ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST = $tmpdepend\n";
410 $output .= "$ctx->{TARGET}: ";
411 $output .= "\$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJS)\n";
412 $output .= "\t\@touch $ctx->{TARGET}\n";
417 ###########################################################
418 # This function creates a make rule for linking a library
420 # $output = _prepare_static_library_rule($library_ctx)
422 # $library_ctx - the library context
424 # $library_ctx->{NAME} - the library name
426 # $library_ctx->{DEPEND_LIST} - the list of rules on which this library depends
428 # $library_ctx->{LIBRARY_NAME} - the static library name
429 # $library_ctx->{LINK_LIST} - the list of objectfiles which sould be linked
430 # to this static library
431 # $library_ctx->{LINK_FLAGS} - linker flags used by this static library
433 # $output - the resulting output buffer
434 sub _prepare_static_library_rule($)
445 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
446 $tmpstlink = array2oneperline($ctx->{LINK_LIST});
447 $tmpstflag = array2oneperline($ctx->{LINK_FLAGS});
449 $output = << "__EOD__";
450 LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
452 LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST =$tmpstlink
454 $ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) \$(LIBRARY_$ctx->{NAME}_OBJS) bin/.dummy
456 \@\$(STLD) \$(STLD_FLAGS) \$@ \\
457 \$(LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST)
459 library_$ctx->{NAME}: basics $ctx->{TARGET}
466 ###########################################################
467 # This function creates a make rule for linking a binary
469 # $output = _prepare_binary_rule($binary_ctx)
471 # $binary_ctx - the binary context
473 # $binary_ctx->{NAME} - the binary name
474 # $binary_ctx->{BINARY} - the binary binary name
476 # $binary_ctx->{DEPEND_LIST} - the list of rules on which this binary depends
477 # $binary_ctx->{LINK_LIST} - the list of objectfiles and external libraries
478 # which sould be linked to this binary
479 # $binary_ctx->{LINK_FLAGS} - linker flags used by this binary
481 # $output - the resulting output buffer
482 sub _prepare_binary_rule($)
490 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
491 $tmplink = array2oneperline($ctx->{LINK_LIST});
492 $tmpflag = array2oneperline($ctx->{LINK_FLAGS});
494 $output = << "__EOD__";
496 BINARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
497 BINARY_$ctx->{NAME}_LINK_LIST =$tmplink
498 BINARY_$ctx->{NAME}_LINK_FLAGS =$tmpflag
500 bin/$ctx->{BINARY}: bin/.dummy \$(BINARY_$ctx->{NAME}_DEPEND_LIST) \$(BINARY_$ctx->{NAME}_OBJS)
502 \@\$(LD) \$(LD_FLAGS) -o \$\@ \\
503 \$\(BINARY_$ctx->{NAME}_LINK_FLAGS) \\
504 \$\(BINARY_$ctx->{NAME}_LINK_LIST) \\
505 \$\(BINARY_$ctx->{NAME}_LINK_FLAGS)
506 binary_$ctx->{BINARY}: basics bin/$ctx->{BINARY}
513 sub _prepare_custom_rule($)
517 $ctx->{NAME}: bin/.TARGET_$ctx->{NAME}
519 bin/.TARGET_$ctx->{NAME}:
521 touch bin/.TARGET_$ctx->{NAME}
525 sub _prepare_proto_rules()
529 $output .= << '__EOD__';
530 # Making this target will just make sure that the prototype files
531 # exist, not necessarily that they are up to date. Since they're
532 # removed by 'make clean' this will always be run when you do anything
534 proto_exists: include/proto.h
536 delheaders: pch_clean
537 -rm -f $(builddir)/include/proto.h
540 @cd $(srcdir) && $(SHELL) script/mkproto.sh "$(PERL)" \
541 -h _PROTO_H_ $(builddir)/include/proto.h \
544 # 'make headers' or 'make proto' calls a subshell because we need to
545 # make sure these commands are executed in sequence even for a
547 headers: delheaders proto_exists
552 @[ -f $(builddir)/include/proto.h ] || $(MAKE) proto
555 @echo Removing objects
556 @-find . -name '*.o' -exec rm -f '{}' \;
557 @echo Removing binaries
559 @echo Removing dummy targets
561 @echo Removing generated files
562 @-rm -rf librpc/gen_*
563 @echo Removing generated ASN1 files
564 @-find heimdal/lib/asn1 -name 'asn1_*.[xc]' -exec rm -f '{}' \;
565 @-find heimdal/lib/gssapi -name 'asn1_*.[xc]' -exec rm -f '{}' \;
566 @-find heimdal/lib/hdb -name 'asn1_*.[xc]' -exec rm -f '{}' \;
570 -rm -f include/config.h include/smb_build.h
573 -rm -f config.log config.cache
574 -rm -f samba4-deps.dot
575 -rm -f lib/registry/winregistry.pc
578 if ($config{developer} eq "yes") {
579 $output .= "\t@-rm -f \$(_ALL_OBJS_OBJS:.o=.d)\n";
582 $output .= << '__EOD__';
585 -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
587 realdistclean: distclean removebackup
588 -rm -f include/config.h.in
589 -rm -f include/version.h
597 sub _prepare_make_target($)
603 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
606 $ctx->{TARGET}: basics $tmpdepend
611 sub _prepare_target_settings($)
616 foreach my $key (values %$CTX) {
617 if (defined($key->{OBJ_LIST})) {
618 $output .= _prepare_obj_list($key->{TYPE}, $key);
621 if (defined($key->{OBJ_LIST})) {
622 $output .= _prepare_cflags($key->{TYPE}, $key);
629 sub _prepare_install_rules($)
634 $output .= << '__EOD__';
637 @echo "Samba will be installed into:"
638 @echo " basedir: $(BASEDIR)"
639 @echo " bindir: $(BINDIR)"
640 @echo " sbindir: $(SBINDIR)"
641 @echo " libdir: $(LIBDIR)"
642 @echo " vardir: $(VARDIR)"
643 @echo " privatedir: $(PRIVATEDIR)"
644 @echo " piddir: $(PIDDIR)"
645 @echo " lockdir: $(LOCKDIR)"
646 @echo " swatdir: $(SWATDIR)"
647 @echo " mandir: $(MANDIR)"
650 @echo "Samba will be compiled with flags:"
651 @echo " CFLAGS = $(CFLAGS)"
652 @echo " LD_FLAGS = $(LD_FLAGS)"
653 @echo " STLD_FLAGS = $(STLD_FLAGS)"
654 @echo " SHLD_FLAGS = $(SHLD_FLAGS)"
656 SBIN_PROGS = bin/smbd
658 BIN_PROGS = bin/smbclient \
664 TORTURE_PROGS = bin/smbtorture \
670 LDB_PROGS = bin/ldbadd \
676 REG_PROGS = bin/regpatch \
681 GTK_PROGS = bin/gregedit \
685 install: showlayout installbin installtorture installldb installreg installdat installswat installmisc installgtk
687 # DESTDIR is used here to prevent packagers wasting their time
688 # duplicating the Makefile. Remove it and you will have the privilege
689 # of package each samba release for multiple versions of multiple
690 # distributions and operating systems, or at least supplying patches
691 # to all the packaging files required for this, prior to committing
692 # the removal of DESTDIR. Do not remove it even though you think it
696 @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(PRIVATEDIR) $(DESTDIR)$(PIDDIR) $(DESTDIR)$(LOCKDIR) $(DESTDIR)$(PRIVATEDIR)/tls
698 installbin: all installdirs
699 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
700 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(BIN_PROGS)
702 installtorture: all installdirs
703 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(TORTURE_PROGS)
705 installldb: all installdirs
706 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(LDB_PROGS)
708 installreg: all installdirs
709 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(REG_PROGS)
711 installgtk: all installdirs
712 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(GTK_PROGS)
714 installdat: installdirs
715 @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir)
717 installswat: installdirs
718 @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir) $(DESTDIR)$(LIBDIR)
720 installmisc: installdirs
721 @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(BINDIR)
723 installman: installdirs
724 @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
726 uninstall: uninstallbin uninstalltorture uninstallldb uninstallreg uninstallgtk
729 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
732 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(TORTURE_PROGS)
735 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(LDB_PROGS)
738 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(REG_PROGS)
741 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(GTK_PROGS)
744 @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
748 swig: scripting/swig/_tdb.so scripting/swig/_dcerpc.so
750 scripting/swig/tdb_wrap.c: scripting/swig/tdb.i
751 swig -python scripting/swig/tdb.i
753 scripting/swig/_tdb.so: scripting/swig/tdb_wrap.o $(LIBRARY_swig_tdb_DEPEND_LIST)
754 $(SHLD) $(SHLD_FLAGS) -o scripting/swig/_tdb.so scripting/swig/tdb_wrap.o \
755 $(LIBRARY_swig_tdb_SHARED_LINK_LIST) $(LIBRARY_swig_tdb_SHARED_LINK_FLAGS)
757 SWIG_INCLUDES = librpc/gen_ndr/samr.i librpc/gen_ndr/lsa.i librpc/gen_ndr/spoolss.i
759 scripting/swig/dcerpc_wrap.c: scripting/swig/dcerpc.i scripting/swig/samba.i scripting/swig/status_codes.i $(SWIG_INCLUDES)
760 swig -python scripting/swig/dcerpc.i
762 scripting/swig/_dcerpc.so: scripting/swig/dcerpc_wrap.o $(LIBRARY_swig_dcerpc_DEPEND_LIST)
763 $(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)
766 -rm -f scripting/swig/_tdb.so scripting/swig/tdb.pyc \
767 scripting/swig/tdb.py scripting/swig/tdb_wrap.c \
768 scripting/swig/tdb_wrap.o
773 etags `find $(srcdir) -name "*.[ch]"`
776 ctags `find $(srcdir) -name "*.[ch]"`
783 sub _prepare_rule_lists($)
788 foreach my $key (values %{$depend}) {
789 next unless defined $key->{OUTPUT_TYPE};
791 ($output .= _prepare_objlist_rule($key)) if $key->{OUTPUT_TYPE} eq "OBJLIST";
792 ($output .= _prepare_static_library_rule($key)) if $key->{OUTPUT_TYPE} eq "STATIC_LIBRARY";
793 ($output .= _prepare_shared_library_rule($key)) if $key->{OUTPUT_TYPE} eq "SHARED_LIBRARY";
794 ($output .= _prepare_binary_rule($key)) if $key->{OUTPUT_TYPE} eq "BINARY";
795 ($output .= _prepare_custom_rule($key) ) if $key->{TYPE} eq "TARGET";
799 $output .= _prepare_IDL($idl_ctx);
800 $output .= _prepare_proto_rules();
801 $output .= _prepare_install_rules($depend);
806 ###########################################################
807 # This function prepares the output for Makefile
809 # $output = _prepare_makefile_in($OUTPUT)
811 # $OUTPUT - the global OUTPUT context
813 # $output - the resulting output buffer
814 sub _prepare_makefile_in($)
819 $output = "########################################\n";
820 $output .= "# Autogenerated by config.smb_build.pl #\n";
821 $output .= "########################################\n";
825 $output .= _prepare_command_interpreters($cmd_ctx);
828 $output .= _prepare_path_vars($path_ctx);
831 $output .= _prepare_compiler_linker($compiler_ctx);
834 $output .= _prepare_default_rule($rules_ctx);
837 $output .= _prepare_SUFFIXES($suffix_ctx);
839 $output .= _prepare_dummy_MAKEDIR();
840 $output .= _prepare_std_CC_rule("c","o",'@PICFLAG@',"Compiling","Rule for std objectfiles");
841 $output .= _prepare_std_CC_rule("h","h.gch",'@PICFLAG@',"Precompiling","Rule for precompiled headerfiles");
843 $output .= _prepare_depend_CC_rule();
845 $output .= _prepare_man_rule("1");
846 $output .= _prepare_man_rule("3");
847 $output .= _prepare_man_rule("5");
848 $output .= _prepare_man_rule("7");
849 $output .= _prepare_manpages($CTX);
850 $output .= _prepare_target_settings($CTX);
851 $output .= _prepare_rule_lists($CTX);
855 foreach my $part (values %{$CTX}) {
856 push (@all, $part->{TARGET}) if defined ($part->{OUTPUT_TYPE}) and $part->{OUTPUT_TYPE} eq "BINARY";
859 $output .= _prepare_make_target({ TARGET => "all", DEPEND_LIST => \@all });
861 if ($config{developer} eq "yes") {
863 #-include \$(_ALL_OBJS_OBJS:.o=.d)
864 IDL_FILES = \$(wildcard librpc/idl/*.idl)
865 \$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%.c,\$(IDL_FILES)) \\
866 \$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_\%_c.c,\$(IDL_FILES)) \\
867 \$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%.h,\$(IDL_FILES)): idl
874 ###########################################################
875 # This function creates Makefile.in from the OUTPUT
878 # create_makefile_in($OUTPUT)
880 # $OUTPUT - the global OUTPUT context
882 # $output - the resulting output buffer
883 sub create_makefile_in($$)
885 my ($CTX, $file) = @_;
887 open(MAKEFILE_IN,">$file") || die ("Can't open $file\n");
888 print MAKEFILE_IN _prepare_makefile_in($CTX);
891 print "config.smb_build.pl: creating $file\n";