2 DEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.o) -MT $@ \
3 $(CFLAGS) `$(PERL) $(srcdir)/script/cflags.pl $@` \
4 $(CPPFLAGS) $(FIRST_PREREQ) -o $@
5 # Dependencies for host objects
6 HDEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.ho) -MT $@ \
7 $(HOSTCC_FLAGS) `$(PERL) $(srcdir)/script/cflags.pl $@` \
8 $(CPPFLAGS) $(FIRST_PREREQ) -o $@
9 # Dependencies for precompiled headers
10 PCHDEPENDS = $(CC) -M -MG -MT include/includes.h.gch -MT $@ \
11 $(CFLAGS) $(CPPFLAGS) $(FIRST_PREREQ) -o $@
13 # $< is broken in older BSD versions:
14 # when $@ is foo/bar.o, $< could be torture/foo/bar.c
15 # if it also exists. So better use $* which is foo/bar
16 # and append .c manually to get foo/bar.c
18 # If we have GNU Make, it is safe to use $<, which also lets
19 # building with $srcdir != $builddir work.
21 # Run a static analysis checker
22 CHECK = $(CC_CHECKER) $(CFLAGS) `$(PERL) $(srcdir)/script/cflags.pl $@` \
23 $(PICFLAG) $(CPPLAGS) -c $(FIRST_PREREQ) -o $@
25 # Run the configured compiler
26 COMPILE = $(CC) $(CFLAGS) $(PICFLAG) \
27 `$(PERL) $(srcdir)/script/cflags.pl $@` \
29 -c $(FIRST_PREREQ) -o $@
31 # Run the compiler for the build host
32 HCOMPILE = $(HOSTCC) $(HOSTCC_FLAGS) `$(PERL) $(srcdir)/script/cflags.pl $@` \
33 $(CPPFLAGS) -c $(FIRST_PREREQ) -o $@
36 PCHCOMPILE = @$(CC) -Ilib/replace \
37 $(CFLAGS) `$(PERL) $(srcdir)/script/cflags.pl $@` \
38 $(PICFLAG) $(CPPFLAGS) -c $(FIRST_PREREQ) -o $@
41 PARTLINK = @$(PROG_LD) -r
44 @echo "include/config.h not present"
45 @echo "You need to rerun ./autogen.sh and ./configure"
48 $(srcdir)/version.h: $(srcdir)/VERSION
49 @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
52 @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
55 @echo "Removing precompiled headers"
56 @-rm -f include/includes.h.gch
58 pch:: clean_pch include/includes.h.gch
61 @echo Removing objects
62 @-find . -name '*.o' -exec rm -f '{}' \;
63 @echo Removing hostcc objects
64 @-find . -name '*.ho' -exec rm -f '{}' \;
65 @echo Removing binaries
66 @-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES) $(TORTURE_PROGS)
67 @echo Removing libraries
68 @-rm -f $(STATIC_LIBRARIES) $(SHARED_LIBRARIES)
69 @-rm -f bin/static/*.a bin/shared/*.$(SHLIBEXT) bin/mergedobj/*.o
70 @echo Removing modules
71 @-rm -f bin/modules/*/*.$(SHLIBEXT)
72 @-rm -f bin/*_init_module.c
73 @echo Removing dummy targets
75 @echo Removing generated files
76 @-rm -f bin/*_init_module.c
78 @echo Removing proto headers
79 @-rm -f $(PROTO_HEADERS)
82 -rm -f include/config.h include/config_tmp.h include/build.h
85 -rm -f config.log config.cache
86 -rm -f config.pm config.mk
90 -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
92 realdistclean:: distclean removebackup
93 -rm -f include/config_tmp.h.in
101 $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort
103 ###############################################################################
105 ###############################################################################
107 .SUFFIXES: .x .c .et .y .l .d .o .h .h.gch .a .$(SHLIBEXT) .1 .1.xml .3 .3.xml .5 .5.xml .7 .7.xml .8 .8.xml .ho .idl .hd
110 @echo "Generating dependencies for $<"
114 @echo "Generating host-compiler dependencies for $<"
117 include/includes.d: include/includes.h
118 @echo "Generating dependencies for $<"
122 @if test -n "$(CC_CHECKER)"; then \
123 echo "Checking $< with '$(CC_CHECKER)'"; \
127 @-mkdir -p `dirname $@`
128 @$(COMPILE) && exit 0 ; \
129 echo "The following command failed:" 1>&2;\
130 echo "$(COMPILE)" 1>&2;\
131 $(COMPILE) >/dev/null 2>&1
134 @echo "Compiling $< with host compiler"
135 @-mkdir -p `dirname $@`
136 @$(HCOMPILE) && exit 0;\
137 echo "The following command failed:" 1>&2;\
138 echo "$(HCOMPILE)" 1>&2;\
139 $(HCOMPILE) >/dev/null 2>&1
142 @echo "Precompiling $<"
146 @echo "Building $< with $(YACC)"
147 @-$(srcdir)/script/yacc_compile.sh "$(YACC)" "$<" "$@"
150 @echo "Building $< with $(LEX)"
151 @-$(srcdir)/script/lex_compile.sh "$(LEX)" "$<" "$@"
153 DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
156 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
159 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
162 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
165 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
168 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
170 DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \
173 dist:: idl_full manpages configure distclean
179 @echo 'Samba will be compiled with flags:'
180 @echo ' CPP = $(CPP)'
181 @echo ' CPPFLAGS = $(CPPFLAGS)'
183 @echo ' CFLAGS = $(CFLAGS)'
184 @echo ' PICFLAG = $(PICFLAG)'
185 @echo ' BNLD = $(BNLD)'
186 @echo ' BNLD_FLAGS = $(BNLD_FLAGS)'
187 @echo ' STLD = $(STLD)'
188 @echo ' STLD_FLAGS = $(STLD_FLAGS)'
189 @echo ' SHLD = $(SHLD)'
190 @echo ' SHLD_FLAGS = $(SHLD_FLAGS)'
191 @echo ' MDLD = $(MDLD)'
192 @echo ' MDLD_FLAGS = $(MDLD_FLAGS)'
193 @echo ' SHLIBEXT = $(SHLIBEXT)'
196 etags `find $(srcdir) -name "*.[ch]"`
199 ctags `find $(srcdir) -name "*.[ch]"`