r6177: Use here documents instead of print() statements to generate the
[Samba/gebeck_regimport.git] / source4 / build / smb_build / makefile.pm
blob171294478c94cffbb1f8750a8f4b8fc7ad3facd6
1 ###########################################################
2 ### SMB Build System ###
3 ### - create output for Makefile ###
4 ### ###
5 ### Copyright (C) Stefan (metze) Metzmacher 2004 ###
6 ### Released under the GNU GPL ###
7 ###########################################################
9 package makefile;
10 use strict;
12 sub _prepare_command_interpreters($)
14 my $ctx = shift;
15 my $output;
17 $output = << '__EOD__';
18 SHELL=/bin/sh
19 PERL=@PERL@
21 __EOD__
23 return $output;
26 sub _prepare_path_vars($)
28 my $ctx = shift;
29 my $output;
31 $output = << '__EOD__';
32 prefix=@prefix@
33 exec_prefix=@exec_prefix@
34 VPATH=@srcdir@
35 srcdir=@srcdir@
36 builddir=@builddir@
38 BASEDIR= @prefix@
39 BINDIR = @bindir@
40 SBINDIR = @sbindir@
41 LIBDIR = @libdir@
42 CONFIGDIR = @configdir@
43 VARDIR = @localstatedir@
45 # The permissions to give the executables
46 INSTALLPERMS = 0755
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
61 LOCKDIR = @lockdir@
63 # the directory where pid files go
64 PIDDIR = @piddir@
66 PASSWD_FLAGS = -DSMB_PASSWD_FILE=\"$(SMB_PASSWD_FILE)\" -DPRIVATE_DIR=\"$(PRIVATEDIR)\"
67 PATH_FLAGS1 = -DCONFIGFILE=\"$(CONFIGFILE)\" -DSBINDIR=\"$(SBINDIR)\"
68 PATH_FLAGS2 = $(PATH_FLAGS1) -DBINDIR=\"$(BINDIR)\"
69 PATH_FLAGS3 = $(PATH_FLAGS2) -DLMHOSTSFILE=\"$(LMHOSTSFILE)\"
70 PATH_FLAGS4 = $(PATH_FLAGS3) -DLOCKDIR=\"$(LOCKDIR)\" -DPIDDIR=\"$(PIDDIR)\"
71 PATH_FLAGS5 = $(PATH_FLAGS4) -DLIBDIR=\"$(LIBDIR)\" \
72 -DLOGFILEBASE=\"$(LOGFILEBASE)\" -DSHLIBEXT=\"@SHLIBEXT@\"
73 PATH_FLAGS6 = $(PATH_FLAGS5) -DCONFIGDIR=\"$(CONFIGDIR)\" -DNCALRPCDIR=\"$(NCALRPCDIR)\"
74 PATH_FLAGS = $(PATH_FLAGS6) $(PASSWD_FLAGS)
76 __EOD__
78 return $output;
81 sub _prepare_compiler_linker($)
83 my $ctx = shift;
84 my $output;
86 $output = << '__EOD__';
87 CC=@CC@
88 CC_FLAGS=-Iinclude -I. -I$(srcdir)/include -I$(srcdir) -D_SAMBA_BUILD_ -Ilib @CFLAGS@ @CPPFLAGS@
90 LD=@CC@
91 LD_FLAGS=@LDFLAGS@ @CFLAGS@
93 STLD=ar
94 STLD_FLAGS=-rc
96 SHLD=@CC@
97 SHLD_FLAGS=@LDSHFLAGS@ @LDFLAGS@
99 __EOD__
101 return $output;
104 sub _prepare_default_rule($)
106 my $ctx = shift;
107 my $output;
109 $output = << '__EOD__';
110 default: all
112 __EOD__
114 return $output;
117 sub _prepare_SUFFIXES($)
119 my $ctx = shift;
120 my $output;
122 $output = << '__EOD__';
123 .SUFFIXES:
124 .SUFFIXES: .c .o .h .h.gch .a .so
126 __EOD__
128 return $output;
131 sub _prepare_IDL($)
133 my $ctx = shift;
134 my $output;
136 $output = << '__EOD__';
137 idl_full: build/pidl/idl.pm
138 CPP="@CPP@" PERL="$(PERL)" script/build_idl.sh FULL
140 idl: build/pidl/idl.pm
141 @CPP="@CPP@" PERL="$(PERL)" script/build_idl.sh PARTIAL
143 build/pidl/idl.pm: build/pidl/idl.yp
144 -yapp -s build/pidl/idl.yp
146 pch: proto include/includes.h.gch
148 pch_clean:
149 -rm -f include/includes.h.gch
151 basics: idl proto_exists
153 __EOD__
155 return $output;
158 sub _prepare_dummy_MAKEDIR()
160 my $ctx = shift;
161 my $output;
163 $output = << '__EOD__';
164 bin/.dummy:
165 @: >> $@ || : > $@
167 dynconfig.o: dynconfig.c Makefile
168 @echo Compiling $*.c
169 @$(CC) $(CC_FLAGS) @PICFLAG@ $(PATH_FLAGS) -c $< -o $@
170 @BROKEN_CC@ -mv `echo $@ | sed 's%^.*/%%g'` $@
172 __EOD__
174 return $output;
177 ###########################################################
178 # This function creates a standard make rule which is using $(CC)
180 # $output = _prepare_std_CC_rule($srcext,$destext,$flags,$message,$comment)
182 # $srcext - sourcefile extension
184 # $destext - destinationfile extension
186 # $flags - additional compiler flags
188 # $message - logmessage which is echoed while running this rule
190 # $comment - just a comment what this rule should do
192 # $output - the resulting output buffer
193 sub _prepare_std_CC_rule($$$$$)
195 my $src = shift;
196 my $dst = shift;
197 my $flags = shift;
198 my $message = shift;
199 my $comment = shift;
200 my $flagsstr = "";
201 my $output;
203 $output = << "__EOD__";
204 ###################################
205 # Start $comment
206 .$src.$dst:
207 \@echo $message \$\*.$src
208 \@\$(CC) \$(CC_FLAGS) $flags -c \$< -o \$\@
209 \@BROKEN_CC\@ -mv `echo \$\@ | sed 's%^.*/%%g'` \$\@
210 #End $comment
211 ###################################
213 __EOD__
215 return $output;
218 sub array2oneperline($)
220 my $array = shift;
221 my $i;
222 my $output = "";
224 foreach my $str (@{$array}) {
225 if (!defined($str)) {
226 next;
229 $output .= " \\\n\t\t";
230 $output .= $str;
233 return $output;
236 sub array2oneline($)
238 my $array = shift;
239 my $i;
240 my $output = "";
242 foreach my $str (@{$array}) {
243 if (!defined($str)) {
244 next;
247 $output .= $str;
248 $output .= " ";
251 return $output;
254 ###########################################################
255 # This function creates a object file list
257 # $output = _prepare_var_obj_list($var, $var_ctx)
259 # $var_ctx - the subsystem context
261 # $var_ctx->{NAME} - the <var> name
262 # $var_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this <var>
264 # $output - the resulting output buffer
265 sub _prepare_obj_list($$)
267 my $var = shift;
268 my $ctx = shift;
269 my $tmpobjlist;
270 my $output;
272 $tmpobjlist = array2oneperline($ctx->{OBJ_LIST});
274 $output = << "__EOD__";
275 ###################################
276 # Start $var $ctx->{NAME} OBJ LIST
277 $var\_$ctx->{NAME}_OBJS =$tmpobjlist
278 # End $var $ctx->{NAME} OBJ LIST
279 ###################################
281 __EOD__
283 return $output;
286 ###########################################################
287 # This function creates a object file list for a subsystem
289 # $output = _prepare_subsystem_obj_list($subsystem_ctx)
291 # $subsystem_ctx - the subsystem context
293 # $subsystem_ctx->{NAME} - the subsystem name
294 # $subsystem_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this subsystem
296 # $output - the resulting output buffer
297 sub _prepare_subsystem_obj_list($)
299 my $ctx = shift;
301 return _prepare_var_obj_list("SUBSYSTEM",$ctx);
304 ###########################################################
305 # This function creates a object file list for a module
307 # $output = _prepare_module_obj_and_lib_list($module_ctx)
309 # $module_ctx - the module context
311 # $module_ctx->{NAME} - the module binary name
312 # $module_ctx->{OBJ_LIST} - the list of objectfiles which sould be linked to this module
314 # $output - the resulting output buffer
315 sub _prepare_module_obj_list($)
317 my $ctx = shift;
319 return _prepare_var_obj_list("MODULE",$ctx);
323 ###########################################################
324 # This function creates a make rule for linking a library
326 # $output = _prepare_shared_library_rule($library_ctx)
328 # $library_ctx - the library context
330 # $library_ctx->{NAME} - the library name
332 # $library_ctx->{DEPEND_LIST} - the list of rules on which this library depends
334 # $library_ctx->{LIBRARY_NAME} - the shared library name
335 # $library_ctx->{LIBRARY_REALNAME} - the shared library real name
336 # $library_ctx->{LIBRARY_SONAME} - the shared library soname
337 # $library_ctx->{LINK_LIST} - the list of objectfiles and external libraries
338 # which sould be linked to this shared library
339 # $library_ctx->{LINK_FLAGS} - linker flags used by this shared library
341 # $output - the resulting output buffer
342 sub _prepare_shared_library_rule($)
344 my $ctx = shift;
345 my $tmpdepend;
346 my $tmpstlink;
347 my $tmpstflag;
348 my $tmpshlink;
349 my $tmpshflag;
350 my $tmprules;
351 my $output;
352 my $outname = $ctx->{OUTPUT};
354 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
356 $tmpshlink = array2oneperline($ctx->{LINK_LIST});
357 $tmpshflag = array2oneperline($ctx->{LINK_FLAGS});
359 $output = << "__EOD__";
360 ###################################
361 # Start Library $ctx->{NAME}
363 LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
365 LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST =$tmpshlink
366 LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS =$tmpshflag
369 # Shared $ctx->{LIBRARY_NAME}
370 $ctx->{OUTPUT}: \$(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy
371 \@echo Linking \$\@
372 \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
373 \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS) \\
374 \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST)
376 __EOD__
378 if (defined($ctx->{LIBRARY_SONAME})) {
379 $output .= << "__EOD__";
380 # Symlink $ctx->{LIBRARY_SONAME}
381 bin/$ctx->{LIBRARY_SONAME}: bin/$ctx->{LIBRARY_REALNAME} bin/.dummy
382 \@echo Symlink \$\@
383 \@ln -sf $ctx->{LIBRARY_REALNAME} \$\@
384 # Symlink $ctx->{LIBRARY_NAME}
385 bin/$ctx->{LIBRARY_NAME}: bin/$ctx->{LIBRARY_SONAME} bin/.dummy
386 \@echo Symlink \$\@
387 \@ln -sf $ctx->{LIBRARY_SONAME} \$\@
389 __EOD__
390 $outname = $ctx->{LIBRARY_NAME};
393 $output .= << "__EOD__";
394 library_$ctx->{NAME}: basics bin/$outname
395 # End Library $ctx->{NAME}
396 ###################################
398 __EOD__
400 return $output;
403 ###########################################################
404 # This function creates a make rule for linking a library
406 # $output = _prepare_static_library_rule($library_ctx)
408 # $library_ctx - the library context
410 # $library_ctx->{NAME} - the library name
412 # $library_ctx->{DEPEND_LIST} - the list of rules on which this library depends
414 # $library_ctx->{LIBRARY_NAME} - the static library name
415 # $library_ctx->{LINK_LIST} - the list of objectfiles which sould be linked
416 # to this static library
417 # $library_ctx->{LINK_FLAGS} - linker flags used by this static library
419 # $output - the resulting output buffer
420 sub _prepare_static_library_rule($)
422 my $ctx = shift;
423 my $tmpdepend;
424 my $tmpstlink;
425 my $tmpstflag;
426 my $tmpshlink;
427 my $tmpshflag;
428 my $tmprules;
429 my $output;
431 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
433 $tmpstlink = array2oneperline($ctx->{LINK_LIST});
434 $tmpstflag = array2oneperline($ctx->{LINK_FLAGS});
436 $tmprules = "bin/$ctx->{LIBRARY_NAME}";
438 $output = << '__EOD__';
439 ###################################
440 # Start Library $ctx->{NAME}
442 LIBRARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
444 LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST =$tmpstlink
446 # Static $ctx->{LIBRARY_NAME}
447 $ctx->{OUTPUT}: $(LIBRARY_$ctx->{NAME}_DEPEND_LIST) bin/.dummy
448 @echo Linking $@
449 @$(STLD) $(STLD_FLAGS) $@ \\
450 $(LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST)
452 library_$ctx->{NAME}: basics $tmprules
453 # End Library $ctx->{NAME}
454 ###################################
456 __EOD__
458 return $output;
463 ###########################################################
464 # This function creates a make rule for linking a binary
466 # $output = _prepare_binary_rule($binary_ctx)
468 # $binary_ctx - the binary context
470 # $binary_ctx->{NAME} - the binary name
471 # $binary_ctx->{BINARY} - the binary binary name
473 # $binary_ctx->{DEPEND_LIST} - the list of rules on which this binary depends
474 # $binary_ctx->{LINK_LIST} - the list of objectfiles and external libraries
475 # which sould be linked to this binary
476 # $binary_ctx->{LINK_FLAGS} - linker flags used by this binary
478 # $output - the resulting output buffer
479 sub _prepare_binary_rule($)
481 my $ctx = shift;
482 my $tmpdepend;
483 my $tmplink;
484 my $tmpflag;
485 my $output;
487 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
488 $tmplink = array2oneperline($ctx->{LINK_LIST});
489 $tmpflag = array2oneperline($ctx->{LINK_FLAGS});
491 $output = << "__EOD__";
492 ###################################
493 # Start Binary $ctx->{BINARY}
495 BINARY_$ctx->{NAME}_DEPEND_LIST =$tmpdepend
496 BINARY_$ctx->{NAME}_LINK_LIST =$tmplink
497 BINARY_$ctx->{NAME}_LINK_FLAGS =$tmpflag
499 bin/$ctx->{BINARY}: bin/.dummy \$(BINARY_$ctx->{NAME}_DEPEND_LIST)
500 \@echo Linking \$\@
501 \@\$(LD) \$(LD_FLAGS) -o \$\@ \\
502 \$\(BINARY_$ctx->{NAME}_LINK_FLAGS) \\
503 \$\(BINARY_$ctx->{NAME}_LINK_LIST) \\
504 \$\(BINARY_$ctx->{NAME}_LINK_FLAGS)
505 binary_$ctx->{BINARY}: basics bin/$ctx->{BINARY}
506 # End Binary $ctx->{BINARY}
507 ###################################
509 __EOD__
511 return $output;
514 sub _prepare_proto_rules()
516 my $output = "";
518 $output .= << '__EOD__';
519 # Making this target will just make sure that the prototype files
520 # exist, not necessarily that they are up to date. Since they're
521 # removed by 'make clean' this will always be run when you do anything
522 # afterwards.
523 proto_exists: include/proto.h include/build_env.h
525 delheaders: pch_clean
526 -rm -f $(builddir)/include/proto.h $(builddir)/include/build_env.h:
528 include/proto.h:
529 @cd $(srcdir) && $(SHELL) script/mkproto.sh "$(PERL)" \
530 -h _PROTO_H_ $(builddir)/include/proto.h \
531 $(PROTO_PROTO_OBJS)
533 include/build_env.h:
534 @echo Building include/build_env.h
535 @cd $(srcdir) && $(SHELL) script/build_env.sh $(srcdir) $(builddir) $(CC) > $(builddir)/include/build_env.h
537 # 'make headers' or 'make proto' calls a subshell because we need to
538 # make sure these commands are executed in sequence even for a
539 # parallel make.
540 headers: delheaders proto_exists
542 proto: idl headers
544 proto_test:
545 @[ -f $(builddir)/include/proto.h ] || $(MAKE) proto
547 clean: delheaders
548 -rm -f *.o */*.o */*/*.o */*/*/*.o bin/*
549 -rm -rf librpc/gen_*
551 distclean: clean
552 -rm -f bin/.dummy
553 -rm -f include/config.h
554 -rm -f Makefile*
555 -rm -f config.status
556 -rm -f config.smb_build.*
557 -rm -f config.log config.cache
559 removebackup:
560 -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
562 realdistclean: distclean removebackup
563 -rm -f include/config.h.in
564 -rm -f lib/version.h
565 -rm -f configure
566 __EOD__
568 return $output;
571 sub _prepare_make_target($)
573 my $ctx = shift;
574 my $tmpdepend;
575 my $output;
577 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
579 $output = << "__EOD__";
580 ###################################
581 # Start Target $ctx->{TARGET}
582 $ctx->{TARGET}: basics $tmpdepend
583 # End Target $ctx->{TARGET}
584 ###################################
586 __EOD__
588 return $output;
591 sub _prepare_obj_lists($)
593 my $CTX = shift;
594 my $output = "";
596 foreach my $key (values %{$CTX}) {
597 next if not defined($key->{OBJ_LIST});
598 $output .= _prepare_obj_list($key->{TYPE}, $key);
601 return $output;
604 sub _prepare_install_rules($)
606 my $CTX = shift;
607 my $output = "";
609 $output .= << '__EOD__';
611 showlayout:
612 @echo "Samba will be installed into:"
613 @echo " basedir: $(BASEDIR)"
614 @echo " bindir: $(BINDIR)"
615 @echo " sbindir: $(SBINDIR)"
616 @echo " libdir: $(LIBDIR)"
617 @echo " vardir: $(VARDIR)"
618 @echo " privatedir: $(PRIVATEDIR)"
619 @echo " piddir: $(PIDDIR)"
620 @echo " lockdir: $(LOCKDIR)"
622 showflags:
623 @echo "Samba will be compiled with flags:"
624 @echo " CC_FLAGS = $(CC_FLAGS)"
625 @echo " LD_FLAGS = $(LD_FLAGS)"
626 @echo " STLD_FLAGS = $(STLD_FLAGS)"
627 @echo " SHLD_FLAGS = $(SHLD_FLAGS)"
629 SBIN_PROGS = bin/smbd
631 BIN_PROGS = bin/smbclient \
632 bin/net \
633 bin/nmblookup \
634 bin/ntlm_auth
636 TORTURE_PROGS = bin/smbtorture \
637 bin/gentest \
638 bin/locktest \
639 bin/masktest \
640 bin/ndrdump
642 LDB_PROGS = bin/ldbadd \
643 bin/ldbdel \
644 bin/ldbmodify \
645 bin/ldbedit \
646 bin/ldbsearch
648 REG_PROGS = bin/regpatch \
649 bin/regshell \
650 bin/regtree \
651 bin/regpatch \
652 bin/regdiff
654 install: showlayout installbin installtorture installldb installreg installdat
656 # DESTDIR is used here to prevent packagers wasting their time
657 # duplicating the Makefile. Remove it and you will have the privelege
658 # of package each samba release for muliple versions of multiple
659 # distributions and operating systems, or at least supplying patches
660 # to all the packaging files required for this, prior to committing
661 # the removal of DESTDIR. Do not remove it even though you think it
662 # is not used
664 installdirs:
665 @$(SHELL) $(srcdir)/script/installdirs.sh $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(PRIVATEDIR) $(DESTDIR)$(PIDDIR) $(DESTDIR)$(LOCKDIR)
667 installbin: all installdirs
668 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(SBIN_PROGS)
669 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(BIN_PROGS)
671 installtorture: all installdirs
672 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(TORTURE_PROGS)
674 installldb: all installdirs
675 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(LDB_PROGS)
677 installreg: all installdirs
678 @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(REG_PROGS)
680 installdat: installdirs
681 @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir)
683 uninstall: uninstallbin uninstalltorture uninstallldb uninstallreg
685 uninstallbin:
686 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
688 uninstalltorture:
689 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(TORTURE_PROGS)
691 uninstallldb:
692 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(LDB_PROGS)
694 uninstallreg:
695 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(REG_PROGS)
697 # Swig extensions
699 swig: scripting/swig/_tdb.so scripting/swig/_dcerpc.so
701 scripting/swig/tdb_wrap.c: scripting/swig/tdb.i
702 swig -python scripting/swig/tdb.i
704 scripting/swig/_tdb.so: scripting/swig/tdb_wrap.o $(LIBRARY_swig_tdb_DEPEND_LIST)
705 $(SHLD) $(SHLD_FLAGS) -o scripting/swig/_tdb.so scripting/swig/tdb_wrap.o \
706 $(LIBRARY_swig_tdb_SHARED_LINK_LIST) $(LIBRARY_swig_tdb_SHARED_LINK_FLAGS)
708 SWIG_INCLUDES = librpc/gen_ndr/samr.i librpc/gen_ndr/lsa.i librpc/gen_ndr/spoolss.i
710 scripting/swig/dcerpc_wrap.c: scripting/swig/dcerpc.i scripting/swig/samba.i scripting/swig/status_codes.i $(SWIG_INCLUDES)
711 swig -python scripting/swig/dcerpc.i
713 scripting/swig/_dcerpc.so: scripting/swig/dcerpc_wrap.o $(LIBRARY_swig_dcerpc_DEPEND_LIST)
714 $(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)
716 swig_clean:
717 -rm -f scripting/swig/_tdb.so scripting/swig/tdb.pyc \
718 scripting/swig/tdb.py scripting/swig/tdb_wrap.c \
719 scripting/swig/tdb_wrap.o
721 everything: all
723 etags:
724 etags `find $(srcdir) -name "*.[ch]"`
726 ctags:
727 ctags `find $(srcdir) -name "*.[ch]"`
729 __EOD__
731 return $output;
734 sub _prepare_rule_lists($)
736 my $depend = shift;
737 my $output = "";
739 foreach my $key (values %{$depend}) {
740 next if not defined $key->{OUTPUT_TYPE};
741 ($output .= _prepare_static_library_rule($key)) if $key->{OUTPUT_TYPE} eq "STATIC_LIBRARY";
742 ($output .= _prepare_shared_library_rule($key)) if $key->{OUTPUT_TYPE} eq "SHARED_LIBRARY";
743 ($output .= _prepare_binary_rule($key)) if $key->{OUTPUT_TYPE} eq "BINARY";
746 my $idl_ctx;
747 $output .= _prepare_IDL($idl_ctx);
749 $output .= _prepare_proto_rules();
751 $output .= _prepare_install_rules($depend);
753 return $output;
756 ###########################################################
757 # This function prepares the output for Makefile
759 # $output = _prepare_makefile_in($SMB_BUILD_CTX)
761 # $SMB_BUILD_CTX - the global SMB_BUILD context
763 # $output - the resulting output buffer
764 sub _prepare_makefile_in($)
766 my $CTX = shift;
767 my $output;
769 $output = "########################################\n";
770 $output .= "# Autogenerated by config.smb_build.pl #\n";
771 $output .= "########################################\n";
772 $output .= "\n";
774 my $cmd_ctx;
775 $output .= _prepare_command_interpreters($cmd_ctx);
777 my $path_ctx;
778 $output .= _prepare_path_vars($path_ctx);
780 my $compiler_ctx;
781 $output .= _prepare_compiler_linker($compiler_ctx);
783 my $rules_ctx;
784 $output .= _prepare_default_rule($rules_ctx);
786 my $suffix_ctx;
787 $output .= _prepare_SUFFIXES($suffix_ctx);
789 $output .= _prepare_dummy_MAKEDIR();
791 $output .= _prepare_std_CC_rule("c","o",'@PICFLAG@',"Compiling","Rule for std objectfiles");
792 $output .= _prepare_std_CC_rule("h","h.gch",'@PICFLAG@',"Precompiling","Rule for precompiled headerfiles");
794 $output .= _prepare_obj_lists($CTX);
796 $output .= _prepare_rule_lists($CTX);
798 my @all = ();
800 foreach my $part (values %{$CTX}) {
801 push (@all, $part->{OUTPUT}) if defined ($part->{OUTPUT_TYPE}) and $part->{OUTPUT_TYPE} eq "BINARY";
804 $output .= _prepare_make_target({ TARGET => "all", DEPEND_LIST => \@all });
806 return $output;
809 ###########################################################
810 # This function creates Makefile.in from the SMB_BUILD
811 # context
813 # create_makefile_in($SMB_BUILD_CTX)
815 # $SMB_BUILD_CTX - the global SMB_BUILD context
817 # $output - the resulting output buffer
818 sub create_makefile_in($)
820 my $CTX = shift;
822 open(MAKEFILE_IN,"> Makefile.in") || die ("Can't open Makefile.in\n");
823 print MAKEFILE_IN _prepare_makefile_in($CTX);
824 close(MAKEFILE_IN);
826 print "config.smb_build.pl: creating Makefile.in\n";
827 return;