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) $<
224 # Ugly fallback used for generating a dependency file when
225 # make doesn't know how to build the related C file
232 ###########################################################
233 # This function creates a standard make rule which is using $(CC)
235 # $output = _prepare_std_CC_rule($srcext,$destext,$flags,$message,$comment)
237 # $srcext - sourcefile extension
239 # $destext - destinationfile extension
241 # $flags - additional compiler flags
243 # $message - logmessage which is echoed while running this rule
245 # $comment - just a comment what this rule should do
247 # $output - the resulting output buffer
248 sub _prepare_std_CC_rule($$$$$)
258 $output = << "__EOD__";
261 \@echo $message \$\*.$src
262 \@\$(CC) `script/cflags.sh \$\@` \$(CFLAGS) $flags -c \$< -o \$\@
263 \@BROKEN_CC\@ -mv `echo \$\@ | sed 's%^.*/%%g'` \$\@
270 sub array2oneperline($)
276 next unless defined($_);
278 $output .= " \\\n\t\t$_";
290 foreach (@{$array}) {
291 next unless defined($_);
299 ###########################################################
300 # This function creates a object file list
302 # $output = _prepare_var_obj_list($var, $var_ctx)
304 # $var_ctx - the subsystem context
306 # $var_ctx->{NAME} - the <var> name
307 # $var_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this <var>
309 # $output - the resulting output buffer
310 sub _prepare_obj_list($$)
314 my $tmplist = array2oneperline($ctx->{OBJ_LIST});
317 # $var $ctx->{NAME} OBJ LIST
318 $var\_$ctx->{NAME}_OBJS =$tmplist
323 sub _prepare_cflags($$)
327 my $tmplist = array2oneperline($ctx->{CFLAGS});
330 $var\_$ctx->{NAME}_CFLAGS =$tmplist
335 ###########################################################
336 # This function creates a make rule for linking a library
338 # $output = _prepare_shared_library_rule($library_ctx)
340 # $library_ctx - the library context
342 # $library_ctx->{NAME} - the library name
344 # $library_ctx->{DEPEND_LIST} - the list of rules on which this library depends
346 # $library_ctx->{LIBRARY_NAME} - the shared library name
347 # $library_ctx->{LIBRARY_REALNAME} - the shared library real name
348 # $library_ctx->{LIBRARY_SONAME} - the shared library soname
349 # $library_ctx->{LINK_LIST} - the list of objectfiles and external libraries
350 # which sould be linked to this shared library
351 # $library_ctx->{LINK_FLAGS} - linker flags used by this shared library
353 # $output - the resulting output buffer
354 sub _prepare_shared_library_rule($)
365 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
366 $tmpshlink = array2oneperline($ctx->{LINK_LIST});
367 $tmpshflag = array2oneperline($ctx->{LINK_FLAGS});
369 $output = << "__EOD__";
370 LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
372 LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST =$tmpshlink
373 LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS =$tmpshflag
376 $ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) \$(LIBRARY_$ctx->{NAME}_OBJS) bin/.dummy
378 \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
379 \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS) \\
380 \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST)
384 if (defined($ctx->{LIBRARY_SONAME})) {
385 $output .= << "__EOD__";
386 # Symlink $ctx->{LIBRARY_SONAME}
387 bin/$ctx->{LIBRARY_SONAME}: bin/$ctx->{LIBRARY_REALNAME} bin/.dummy
389 \@ln -sf $ctx->{LIBRARY_REALNAME} \$\@
390 # Symlink $ctx->{LIBRARY_NAME}
391 bin/$ctx->{LIBRARY_NAME}: bin/$ctx->{LIBRARY_SONAME} bin/.dummy
393 \@ln -sf $ctx->{LIBRARY_SONAME} \$\@
398 $output .= << "__EOD__";
399 library_$ctx->{NAME}: basics bin/lib$ctx->{LIBRARY_NAME}
406 sub _prepare_objlist_rule($)
409 my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
412 return "" unless $ctx->{TARGET};
414 $output = "$ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST = $tmpdepend\n";
415 $output .= "$ctx->{TARGET}: ";
416 $output .= "\$($ctx->{TYPE}_$ctx->{NAME}_DEPEND_LIST) \$($ctx->{TYPE}_$ctx->{NAME}_OBJS)\n";
417 $output .= "\t\@touch $ctx->{TARGET}\n";
422 ###########################################################
423 # This function creates a make rule for linking a library
425 # $output = _prepare_static_library_rule($library_ctx)
427 # $library_ctx - the library context
429 # $library_ctx->{NAME} - the library name
431 # $library_ctx->{DEPEND_LIST} - the list of rules on which this library depends
433 # $library_ctx->{LIBRARY_NAME} - the static library name
434 # $library_ctx->{LINK_LIST} - the list of objectfiles which sould be linked
435 # to this static library
436 # $library_ctx->{LINK_FLAGS} - linker flags used by this static library
438 # $output - the resulting output buffer
439 sub _prepare_static_library_rule($)
450 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
451 $tmpstlink = array2oneperline($ctx->{LINK_LIST});
452 $tmpstflag = array2oneperline($ctx->{LINK_FLAGS});
454 $output = << "__EOD__";
455 LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
457 LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST =$tmpstlink
459 $ctx->{TARGET}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) \$(LIBRARY_$ctx->{NAME}_OBJS) bin/.dummy
461 \@\$(STLD) \$(STLD_FLAGS) \$@ \\
462 \$(LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST)
464 library_$ctx->{NAME}: basics $ctx->{TARGET}
471 ###########################################################
472 # This function creates a make rule for linking a binary
474 # $output = _prepare_binary_rule($binary_ctx)
476 # $binary_ctx - the binary context
478 # $binary_ctx->{NAME} - the binary name
479 # $binary_ctx->{BINARY} - the binary binary name
481 # $binary_ctx->{DEPEND_LIST} - the list of rules on which this binary depends
482 # $binary_ctx->{LINK_LIST} - the list of objectfiles and external libraries
483 # which sould be linked to this binary
484 # $binary_ctx->{LINK_FLAGS} - linker flags used by this binary
486 # $output - the resulting output buffer
487 sub _prepare_binary_rule($)
495 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
496 $tmplink = array2oneperline($ctx->{LINK_LIST});
497 $tmpflag = array2oneperline($ctx->{LINK_FLAGS});
499 $output = << "__EOD__";
501 BINARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
502 BINARY_$ctx->{NAME}_LINK_LIST =$tmplink
503 BINARY_$ctx->{NAME}_LINK_FLAGS =$tmpflag
505 bin/$ctx->{BINARY}: bin/.dummy \$(BINARY_$ctx->{NAME}_DEPEND_LIST) \$(BINARY_$ctx->{NAME}_OBJS)
507 \@\$(LD) \$(LD_FLAGS) -o \$\@ \\
508 \$\(BINARY_$ctx->{NAME}_LINK_FLAGS) \\
509 \$\(BINARY_$ctx->{NAME}_LINK_LIST) \\
510 \$\(BINARY_$ctx->{NAME}_LINK_FLAGS)
511 binary_$ctx->{BINARY}: basics bin/$ctx->{BINARY}
518 sub _prepare_custom_rule($)
522 $ctx->{NAME}: bin/.TARGET_$ctx->{NAME}
524 bin/.TARGET_$ctx->{NAME}:
526 touch bin/.TARGET_$ctx->{NAME}
530 sub _prepare_proto_rules()
534 $output .= << '__EOD__';
535 # Making this target will just make sure that the prototype files
536 # exist, not necessarily that they are up to date. Since they're
537 # removed by 'make clean' this will always be run when you do anything
539 proto_exists: include/proto.h
541 delheaders: pch_clean
542 -rm -f $(builddir)/include/proto.h
545 @cd $(srcdir) && $(SHELL) script/mkproto.sh "$(PERL)" \
546 -h _PROTO_H_ $(builddir)/include/proto.h \
549 # 'make headers' or 'make proto' calls a subshell because we need to
550 # make sure these commands are executed in sequence even for a
552 headers: delheaders proto_exists
557 @[ -f $(builddir)/include/proto.h ] || $(MAKE) proto
560 @echo Removing objects
561 @-find . -name '*.o' -exec rm -f '{}' \;
562 @echo Removing binaries
564 @echo Removing dummy targets
566 @echo Removing generated files
567 @-rm -rf librpc/gen_*
568 @echo Removing generated ASN1 files
569 @-find heimdal/lib/asn1 -name 'asn1_*.[xc]' -exec rm -f '{}' \;
570 @-find heimdal/lib/gssapi -name 'asn1_*.[xc]' -exec rm -f '{}' \;
571 @-find heimdal/lib/hdb -name 'asn1_*.[xc]' -exec rm -f '{}' \;
575 -rm -f include/config.h include/smb_build.h
578 -rm -f config.log config.cache
579 -rm -f samba4-deps.dot
580 -rm -f lib/registry/winregistry.pc
583 if ($config{developer} eq "yes") {
584 $output .= "\t@-rm -f \$(_ALL_OBJS_OBJS:.o=.d)\n";
587 $output .= << '__EOD__';
590 -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
592 realdistclean: distclean removebackup
593 -rm -f include/config.h.in
594 -rm -f include/version.h
602 sub _prepare_make_target($)
608 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
611 $ctx->{TARGET}: basics $tmpdepend
616 sub _prepare_target_settings($)
621 foreach my $key (values %$CTX) {
622 if (defined($key->{OBJ_LIST})) {
623 $output .= _prepare_obj_list($key->{TYPE}, $key);
626 if (defined($key->{OBJ_LIST})) {
627 $output .= _prepare_cflags($key->{TYPE}, $key);
634 sub _prepare_install_rules($)
639 $output .= << '__EOD__';
642 @echo "Samba will be installed into:"
643 @echo " basedir: $(BASEDIR)"
644 @echo " bindir: $(BINDIR)"
645 @echo " sbindir: $(SBINDIR)"
646 @echo " libdir: $(LIBDIR)"
647 @echo " vardir: $(VARDIR)"
648 @echo " privatedir: $(PRIVATEDIR)"
649 @echo " piddir: $(PIDDIR)"
650 @echo " lockdir: $(LOCKDIR)"
651 @echo " swatdir: $(SWATDIR)"
652 @echo " mandir: $(MANDIR)"
655 @echo "Samba will be compiled with flags:"
656 @echo " CFLAGS = $(CFLAGS)"
657 @echo " LD_FLAGS = $(LD_FLAGS)"
658 @echo " STLD_FLAGS = $(STLD_FLAGS)"
659 @echo " SHLD_FLAGS = $(SHLD_FLAGS)"
661 SBIN_PROGS = bin/smbd
663 BIN_PROGS = bin/smbclient \
669 TORTURE_PROGS = bin/smbtorture \
675 LDB_PROGS = bin/ldbadd \
681 REG_PROGS = bin/regpatch \
686 GTK_PROGS = bin/gregedit \
690 install: showlayout installbin installtorture installldb installreg installdat installswat installmisc installgtk
692 # DESTDIR is used here to prevent packagers wasting their time
693 # duplicating the Makefile. Remove it and you will have the privilege
694 # of package each samba release for multiple versions of multiple
695 # distributions and operating systems, or at least supplying patches
696 # to all the packaging files required for this, prior to committing
697 # the removal of DESTDIR. Do not remove it even though you think it
701 @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(PRIVATEDIR) $(DESTDIR)$(PIDDIR) $(DESTDIR)$(LOCKDIR) $(DESTDIR)$(PRIVATEDIR)/tls
703 installbin: all installdirs
704 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
705 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(BIN_PROGS)
707 installtorture: all installdirs
708 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(TORTURE_PROGS)
710 installldb: all installdirs
711 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(LDB_PROGS)
713 installreg: all installdirs
714 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(REG_PROGS)
716 installgtk: all installdirs
717 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(GTK_PROGS)
719 installdat: installdirs
720 @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir)
722 installswat: installdirs
723 @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir) $(DESTDIR)$(LIBDIR)
725 installmisc: installdirs
726 @$(SHELL) $(srcdir)/script/installmisc.sh $(srcdir) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(BINDIR)
728 installman: installdirs
729 @$(SHELL) $(srcdir)/script/installman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
731 uninstall: uninstallbin uninstalltorture uninstallldb uninstallreg uninstallgtk
734 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
737 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(TORTURE_PROGS)
740 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(LDB_PROGS)
743 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(REG_PROGS)
746 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(GTK_PROGS)
749 @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
753 swig: scripting/swig/_tdb.so scripting/swig/_dcerpc.so
755 scripting/swig/tdb_wrap.c: scripting/swig/tdb.i
756 swig -python scripting/swig/tdb.i
758 scripting/swig/_tdb.so: scripting/swig/tdb_wrap.o $(LIBRARY_swig_tdb_DEPEND_LIST)
759 $(SHLD) $(SHLD_FLAGS) -o scripting/swig/_tdb.so scripting/swig/tdb_wrap.o \
760 $(LIBRARY_swig_tdb_SHARED_LINK_LIST) $(LIBRARY_swig_tdb_SHARED_LINK_FLAGS)
762 SWIG_INCLUDES = librpc/gen_ndr/samr.i librpc/gen_ndr/lsa.i librpc/gen_ndr/spoolss.i
764 scripting/swig/dcerpc_wrap.c: scripting/swig/dcerpc.i scripting/swig/samba.i scripting/swig/status_codes.i $(SWIG_INCLUDES)
765 swig -python scripting/swig/dcerpc.i
767 scripting/swig/_dcerpc.so: scripting/swig/dcerpc_wrap.o $(LIBRARY_swig_dcerpc_DEPEND_LIST)
768 $(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)
771 -rm -f scripting/swig/_tdb.so scripting/swig/tdb.pyc \
772 scripting/swig/tdb.py scripting/swig/tdb_wrap.c \
773 scripting/swig/tdb_wrap.o
778 etags `find $(srcdir) -name "*.[ch]"`
781 ctags `find $(srcdir) -name "*.[ch]"`
788 sub _prepare_rule_lists($)
793 foreach my $key (values %{$depend}) {
794 next unless defined $key->{OUTPUT_TYPE};
796 ($output .= _prepare_objlist_rule($key)) if $key->{OUTPUT_TYPE} eq "OBJLIST";
797 ($output .= _prepare_static_library_rule($key)) if $key->{OUTPUT_TYPE} eq "STATIC_LIBRARY";
798 ($output .= _prepare_shared_library_rule($key)) if $key->{OUTPUT_TYPE} eq "SHARED_LIBRARY";
799 ($output .= _prepare_binary_rule($key)) if $key->{OUTPUT_TYPE} eq "BINARY";
800 ($output .= _prepare_custom_rule($key) ) if $key->{TYPE} eq "TARGET";
804 $output .= _prepare_IDL($idl_ctx);
805 $output .= _prepare_proto_rules();
806 $output .= _prepare_install_rules($depend);
811 ###########################################################
812 # This function prepares the output for Makefile
814 # $output = _prepare_makefile_in($OUTPUT)
816 # $OUTPUT - the global OUTPUT context
818 # $output - the resulting output buffer
819 sub _prepare_makefile_in($)
824 $output = "########################################\n";
825 $output .= "# Autogenerated by config.smb_build.pl #\n";
826 $output .= "########################################\n";
830 $output .= _prepare_command_interpreters($cmd_ctx);
833 $output .= _prepare_path_vars($path_ctx);
836 $output .= _prepare_compiler_linker($compiler_ctx);
839 $output .= _prepare_default_rule($rules_ctx);
842 $output .= _prepare_SUFFIXES($suffix_ctx);
844 $output .= _prepare_dummy_MAKEDIR();
845 $output .= _prepare_std_CC_rule("c","o",'@PICFLAG@',"Compiling","Rule for std objectfiles");
846 $output .= _prepare_std_CC_rule("h","h.gch",'@PICFLAG@',"Precompiling","Rule for precompiled headerfiles");
848 $output .= _prepare_depend_CC_rule();
850 $output .= _prepare_man_rule("1");
851 $output .= _prepare_man_rule("3");
852 $output .= _prepare_man_rule("5");
853 $output .= _prepare_man_rule("7");
854 $output .= _prepare_manpages($CTX);
855 $output .= _prepare_target_settings($CTX);
856 $output .= _prepare_rule_lists($CTX);
860 foreach my $part (values %{$CTX}) {
861 push (@all, $part->{TARGET}) if defined ($part->{OUTPUT_TYPE}) and $part->{OUTPUT_TYPE} eq "BINARY";
864 $output .= _prepare_make_target({ TARGET => "all", DEPEND_LIST => \@all });
866 if ($config{developer} eq "yes") {
868 -include \$(_ALL_OBJS_OBJS:.o=.d)
869 IDL_FILES = \$(wildcard librpc/idl/*.idl)
870 \$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%.c,\$(IDL_FILES)) \\
871 \$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_\%_c.c,\$(IDL_FILES)) \\
872 \$(patsubst librpc/idl/%.idl,librpc/gen_ndr/ndr_%.h,\$(IDL_FILES)): idl
879 ###########################################################
880 # This function creates Makefile.in from the OUTPUT
883 # create_makefile_in($OUTPUT)
885 # $OUTPUT - the global OUTPUT context
887 # $output - the resulting output buffer
888 sub create_makefile_in($$)
890 my ($CTX, $file) = @_;
892 open(MAKEFILE_IN,">$file") || die ("Can't open $file\n");
893 print MAKEFILE_IN _prepare_makefile_in($CTX);
896 print "config.smb_build.pl: creating $file\n";