r8841: disable dependencies for now. To try dependencies, uncomment the 3rd-to-last...
[Samba/ekacnet.git] / source / build / smb_build / makefile.pm
blob530a040565e45fc5b03369b4f107507001d2ad9d
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 config qw(%config);
11 use strict;
13 sub _prepare_command_interpreters($)
15 my $ctx = shift;
17 return << '__EOD__';
18 SHELL=/bin/sh
19 PERL=@PERL@
21 __EOD__
24 sub _prepare_path_vars($)
26 my $ctx = shift;
27 my $output;
29 $output = << '__EOD__';
30 prefix=@prefix@
31 exec_prefix=@exec_prefix@
32 VPATH=@srcdir@
33 srcdir=@srcdir@
34 builddir=@builddir@
36 BASEDIR= @prefix@
37 BINDIR = @bindir@
38 SBINDIR = @sbindir@
39 LIBDIR = @libdir@
40 CONFIGDIR = @configdir@
41 localstatedir = @localstatedir@
42 SWATDIR = @swatdir@
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 MANDIR = @mandir@
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)\"
75 __EOD__
77 return $output;
80 sub _prepare_compiler_linker($)
82 my $ctx = shift;
84 return << '__EOD__';
85 CC=@CC@
86 CFLAGS=-Iinclude -I. -I$(srcdir)/include -I$(srcdir) -D_SAMBA_BUILD_ -DHAVE_CONFIG_H -Ilib @CFLAGS@ @CPPFLAGS@
88 LD=@CC@
89 LD_FLAGS=@LDFLAGS@ @CFLAGS@ -Lbin
91 STLD=ar
92 STLD_FLAGS=-rc
94 SHLD=@CC@
95 SHLD_FLAGS=@LDSHFLAGS@ @LDFLAGS@ -Lbin
97 XSLTPROC=@XSLTPROC@
99 __EOD__
102 sub _prepare_default_rule($)
104 my $ctx = shift;
105 my $output;
107 $output = << '__EOD__';
108 default: all
110 __EOD__
112 return $output;
115 sub _prepare_SUFFIXES($)
117 my $ctx = shift;
118 my $output;
120 $output = << '__EOD__';
121 .SUFFIXES:
122 .SUFFIXES: .c .d .o .h .h.gch .a .so .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml
124 __EOD__
126 return $output;
129 sub _prepare_IDL($)
131 my $ctx = shift;
133 return << '__EOD__';
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
145 pch_clean:
146 -rm -f include/includes.h.gch
148 basics: idl proto_exists HEIMDAL_EXTERNAL
150 test: @DEFAULT_TEST_TARGET@
152 test-swrap: all
153 ./script/tests/selftest.sh @selftest_prefix@/st all SOCKET_WRAPPER
155 test-noswrap: all
156 ./script/tests/selftest.sh @selftest_prefix@/st all
158 quicktest: all
159 ./script/tests/selftest.sh @selftest_prefix@/st quick SOCKET_WRAPPER
161 valgrindtest: all
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
165 __EOD__
168 sub _prepare_man_rule($)
170 my $suffix = shift;
172 return << "__EOD__";
173 .$suffix.xml.$suffix:
174 \$(XSLTPROC) -o \$@ http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \$<
176 __EOD__
179 sub _prepare_manpages($)
181 my $ctx = shift;
183 my @mp_list = ();
185 foreach (values %$ctx) {
186 if (defined($_->{MANPAGE}) and $_->{MANPAGE} ne "") {
187 push (@mp_list, $_->{MANPAGE});
191 my $mp = join(' ', @mp_list);
192 return << "__EOD__";
193 MANPAGES = $mp
195 manpages: \$(MANPAGES)
197 __EOD__
200 sub _prepare_dummy_MAKEDIR()
202 my $ctx = shift;
204 return << '__EOD__';
205 bin/.dummy:
206 @: >> $@ || : > $@
208 dynconfig.o: dynconfig.c Makefile
209 @echo Compiling $*.c
210 @$(CC) $(CFLAGS) @PICFLAG@ $(PATH_FLAGS) -c $< -o $@
211 @BROKEN_CC@ -mv `echo $@ | sed 's%^.*/%%g'` $@
213 __EOD__
216 sub _prepare_depend_CC_rule()
218 return << '__EOD__';
220 .c.d:
221 @echo "Generating dependencies for $<"
222 @$(CC) -MM -MG -MT $(<:.c=.o) -MF $@ $(CFLAGS) $<
224 __EOD__
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($$$$$)
245 my $src = shift;
246 my $dst = shift;
247 my $flags = shift;
248 my $message = shift;
249 my $comment = shift;
250 my $flagsstr = "";
251 my $output;
253 $output = << "__EOD__";
254 # $comment
255 .$src.$dst:
256 \@echo $message \$\*.$src
257 \@\$(CC) `script/cflags.sh \$\@` \$(CFLAGS) $flags -c \$< -o \$\@
258 \@BROKEN_CC\@ -mv `echo \$\@ | sed 's%^.*/%%g'` \$\@
260 __EOD__
262 return $output;
265 sub array2oneperline($)
267 my $array = shift;
268 my $output = "";
270 foreach (@$array) {
271 next unless defined($_);
273 $output .= " \\\n\t\t$_";
276 return $output;
279 sub array2oneline($)
281 my $array = shift;
282 my $i;
283 my $output = "";
285 foreach (@{$array}) {
286 next unless defined($_);
288 $output .= "$_ ";
291 return $output;
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($$)
307 my ($var,$ctx) = @_;
309 my $tmplist = array2oneperline($ctx->{OBJ_LIST});
311 return << "__EOD__";
312 # $var $ctx->{NAME} OBJ LIST
313 $var\_$ctx->{NAME}_OBJS =$tmplist
315 __EOD__
318 sub _prepare_cflags($$)
320 my ($var,$ctx) = @_;
322 my $tmplist = array2oneperline($ctx->{CFLAGS});
324 return << "__EOD__";
325 $var\_$ctx->{NAME}_CFLAGS =$tmplist
327 __EOD__
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($)
351 my $ctx = shift;
352 my $tmpdepend;
353 my $tmpstlink;
354 my $tmpstflag;
355 my $tmpshlink;
356 my $tmpshflag;
357 my $tmprules;
358 my $output;
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
372 \@echo Linking \$\@
373 \@\$(SHLD) \$(SHLD_FLAGS) -o \$\@ \\
374 \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_FLAGS) \\
375 \$(LIBRARY_$ctx->{NAME}_SHARED_LINK_LIST)
377 __EOD__
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
383 \@echo Symlink \$\@
384 \@ln -sf $ctx->{LIBRARY_REALNAME} \$\@
385 # Symlink $ctx->{LIBRARY_NAME}
386 bin/$ctx->{LIBRARY_NAME}: bin/$ctx->{LIBRARY_SONAME} bin/.dummy
387 \@echo Symlink \$\@
388 \@ln -sf $ctx->{LIBRARY_SONAME} \$\@
390 __EOD__
393 $output .= << "__EOD__";
394 library_$ctx->{NAME}: basics bin/lib$ctx->{LIBRARY_NAME}
396 __EOD__
398 return $output;
401 sub _prepare_objlist_rule($)
403 my $ctx = shift;
404 my $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
405 my $output;
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";
414 return $output;
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($)
436 my $ctx = shift;
437 my $tmpdepend;
438 my $tmpstlink;
439 my $tmpstflag;
440 my $tmpshlink;
441 my $tmpshflag;
442 my $tmprules;
443 my $output;
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
455 \@echo Linking \$@
456 \@\$(STLD) \$(STLD_FLAGS) \$@ \\
457 \$(LIBRARY_$ctx->{NAME}_STATIC_LINK_LIST)
459 library_$ctx->{NAME}: basics $ctx->{TARGET}
461 __EOD__
463 return $output;
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($)
484 my $ctx = shift;
485 my $tmpdepend;
486 my $tmplink;
487 my $tmpflag;
488 my $output;
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)
501 \@echo Linking \$\@
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}
508 __EOD__
510 return $output;
513 sub _prepare_custom_rule($)
515 my $ctx = shift;
516 return "
517 $ctx->{NAME}: bin/.TARGET_$ctx->{NAME}
519 bin/.TARGET_$ctx->{NAME}:
520 $ctx->{CMD}
521 touch bin/.TARGET_$ctx->{NAME}
525 sub _prepare_proto_rules()
527 my $output = "";
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
533 # afterwards.
534 proto_exists: include/proto.h
536 delheaders: pch_clean
537 -rm -f $(builddir)/include/proto.h
539 include/proto.h:
540 @cd $(srcdir) && $(SHELL) script/mkproto.sh "$(PERL)" \
541 -h _PROTO_H_ $(builddir)/include/proto.h \
542 $(PROTO_PROTO_OBJS)
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
546 # parallel make.
547 headers: delheaders proto_exists
549 proto: idl headers
551 proto_test:
552 @[ -f $(builddir)/include/proto.h ] || $(MAKE) proto
554 clean: delheaders
555 @echo Removing objects
556 @-find . -name '*.o' -exec rm -f '{}' \;
557 @echo Removing binaries
558 @-rm -f bin/*
559 @echo Removing dummy targets
560 @-rm -f bin/.*_*
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 '{}' \;
568 distclean: clean
569 -rm -f bin/.dummy
570 -rm -f include/config.h include/smb_build.h
571 -rm -f Makefile*
572 -rm -f config.status
573 -rm -f config.log config.cache
574 -rm -f samba4-deps.dot
575 -rm -f lib/registry/winregistry.pc
576 __EOD__
578 if ($config{developer} eq "yes") {
579 $output .= "\t@-rm -f \$(_ALL_OBJS_OBJS:.o=.d)\n";
582 $output .= << '__EOD__';
584 removebackup:
585 -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
587 realdistclean: distclean removebackup
588 -rm -f include/config.h.in
589 -rm -f include/version.h
590 -rm -f configure
591 -rm -f $(MANPAGES)
592 __EOD__
594 return $output;
597 sub _prepare_make_target($)
599 my $ctx = shift;
600 my $tmpdepend;
601 my $output;
603 $tmpdepend = array2oneperline($ctx->{DEPEND_LIST});
605 return << "__EOD__";
606 $ctx->{TARGET}: basics $tmpdepend
608 __EOD__
611 sub _prepare_target_settings($)
613 my $CTX = shift;
614 my $output = "";
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);
626 return $output;
629 sub _prepare_install_rules($)
631 my $CTX = shift;
632 my $output = "";
634 $output .= << '__EOD__';
636 showlayout:
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)"
649 showflags:
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 \
659 bin/net \
660 bin/nmblookup \
661 bin/smbscript \
662 bin/ntlm_auth
664 TORTURE_PROGS = bin/smbtorture \
665 bin/gentest \
666 bin/locktest \
667 bin/masktest \
668 bin/ndrdump
670 LDB_PROGS = bin/ldbadd \
671 bin/ldbdel \
672 bin/ldbmodify \
673 bin/ldbedit \
674 bin/ldbsearch
676 REG_PROGS = bin/regpatch \
677 bin/regshell \
678 bin/regtree \
679 bin/regdiff
681 GTK_PROGS = bin/gregedit \
682 bin/gwsam \
683 bin/gepdump
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
693 # is not used.
695 installdirs:
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
728 uninstallbin:
729 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
731 uninstalltorture:
732 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(TORTURE_PROGS)
734 uninstallldb:
735 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(LDB_PROGS)
737 uninstallreg:
738 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(REG_PROGS)
740 uninstallgtk:
741 @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(GTK_PROGS)
743 uninstallman:
744 @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(MANPAGES)
746 # Swig extensions
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)
765 swig_clean:
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
770 everything: all
772 etags:
773 etags `find $(srcdir) -name "*.[ch]"`
775 ctags:
776 ctags `find $(srcdir) -name "*.[ch]"`
778 __EOD__
780 return $output;
783 sub _prepare_rule_lists($)
785 my $depend = shift;
786 my $output = "";
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";
798 my $idl_ctx;
799 $output .= _prepare_IDL($idl_ctx);
800 $output .= _prepare_proto_rules();
801 $output .= _prepare_install_rules($depend);
803 return $output;
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($)
816 my ($CTX) = @_;
817 my $output;
819 $output = "########################################\n";
820 $output .= "# Autogenerated by config.smb_build.pl #\n";
821 $output .= "########################################\n";
822 $output .= "\n";
824 my $cmd_ctx;
825 $output .= _prepare_command_interpreters($cmd_ctx);
827 my $path_ctx;
828 $output .= _prepare_path_vars($path_ctx);
830 my $compiler_ctx;
831 $output .= _prepare_compiler_linker($compiler_ctx);
833 my $rules_ctx;
834 $output .= _prepare_default_rule($rules_ctx);
836 my $suffix_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);
853 my @all = ();
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") {
862 $output .= <<__EOD__
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
868 __EOD__
871 return $output;
874 ###########################################################
875 # This function creates Makefile.in from the OUTPUT
876 # context
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);
889 close(MAKEFILE_IN);
891 print "config.smb_build.pl: creating $file\n";
892 return;