2 DEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.o) -MT $@ \
3 $(CFLAGS) $(CPPFLAGS) $< -o $@
4 # Dependencies for host objects
5 HDEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.ho) -MT $@ \
6 $(HOSTCC_FLAGS) $(CPPFLAGS) $< -o $@
7 # Dependencies for precompiled headers
8 PCHDEPENDS = $(CC) -M -MG -MT include/includes.h.gch -MT $@ \
9 $(CFLAGS) $(CPPFLAGS) $< -o $@
11 # Run a static analysis checker
12 CHECK = $(CC_CHECKER) $(CFLAGS) $(PICFLAG) $(CPPLAGS) -c $< -o $@
14 # Run the configured compiler
15 COMPILE = $(CC) $(CFLAGS) $(PICFLAG) \
19 # Run the compiler for the build host
20 HCOMPILE = $(HOSTCC) $(HOSTCC_FLAGS) $(CPPFLAGS) -c $< -o $@
23 PCHCOMPILE = @$(CC) -Ilib/replace \
24 $(CFLAGS) $(PICFLAG) $(CPPFLAGS) -c $< -o $@
27 PARTLINK = @$(PROG_LD) -r
30 @echo "include/config.h not present"
31 @echo "You need to rerun ./autogen.sh and ./configure"
34 $(srcdir)/version.h: $(srcdir)/VERSION
35 @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
38 @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
41 @echo "Removing precompiled headers"
42 @-rm -f include/includes.h.gch
44 pch:: clean_pch include/includes.h.gch
47 @echo Removing objects
48 @-find . -name '*.o' -exec rm -f '{}' \;
49 @echo Removing hostcc objects
50 @-find . -name '*.ho' -exec rm -f '{}' \;
51 @echo Removing binaries
52 @-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES) $(TORTURE_PROGS)
53 @echo Removing libraries
54 @-rm -f $(STATIC_LIBRARIES) $(SHARED_LIBRARIES)
55 @-rm -f bin/static/*.a bin/shared/*.$(SHLIBEXT) bin/mergedobj/*.o
56 @echo Removing modules
57 @-rm -f bin/modules/*/*.$(SHLIBEXT)
58 @-rm -f bin/*_init_module.c
59 @echo Removing dummy targets
61 @echo Removing generated files
62 @-rm -f bin/*_init_module.c
64 @echo Removing proto headers
65 @-rm -f $(PROTO_HEADERS)
68 -rm -f include/config.h include/config_tmp.h include/build.h
71 -rm -f config.log config.cache
72 -rm -f config.pm config.mk
76 -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
78 realdistclean:: distclean removebackup
79 -rm -f include/config_tmp.h.in
87 $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort
89 ###############################################################################
91 ###############################################################################
94 # Arguments: target object file, source object files
95 define partial_link_template
97 @echo Partially linking $$@
99 $$(PARTLINK) -o $$@ $$^
103 # Arguments: target file, depends, flags
104 define binary_link_template
107 @$$(BNLD) $$(BNLD_FLAGS) $$(INTERN_LDFLAGS) -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
110 # Link a host-machine binary
111 # Arguments: target file, depends, flags
112 define host_binary_link_template
115 @$$(HOSTLD) $$(HOSTLD_FLAGS) -L$${builddir}/bin/static -o $$@ $$(INSTALL_LINK_FLAGS) $(3)
118 # Create a prototype header
119 # Arguments: header file, c files
120 define proto_header_template
123 @$$(PERL) $$(srcdir)/script/mkproto.pl --srcdir=$$(srcdir) --builddir=$$(builddir) --all=$$@ $$^
126 ###############################################################################
128 ###############################################################################
130 .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
133 @echo "Generating dependencies for $<"
137 @echo "Generating host-compiler dependencies for $<"
140 include/includes.d: include/includes.h
141 @echo "Generating dependencies for $<"
145 @if test -n "$(CC_CHECKER)"; then \
146 echo "Checking $< with '$(CC_CHECKER)'"; \
150 @-mkdir -p `dirname $@`
151 @$(COMPILE) && exit 0 ; \
152 echo "The following command failed:" 1>&2;\
153 $(COMPILE) >/dev/null 2>&1
156 # echo "$(COMPILE)" 1>&2;\
159 @echo "Compiling $< with host compiler"
160 @-mkdir -p `dirname $@`
161 @$(HCOMPILE) && exit 0;\
162 echo "The following command failed:" 1>&2;\
163 echo "$(HCOMPILE)" 1>&2;\
164 $(HCOMPILE) >/dev/null 2>&1
167 @echo "Precompiling $<"
171 @echo "Building $< with $(YACC)"
172 @-$(srcdir)/script/yacc_compile.sh "$(YACC)" "$<" "$@"
175 @echo "Building $< with $(LEX)"
176 @-$(srcdir)/script/lex_compile.sh "$(LEX)" "$<" "$@"
182 @$(STLD) $(STLD_FLAGS) $@ $^
185 DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
188 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
191 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
194 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
197 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
200 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
202 dist:: idl_full manpages configure distclean
208 @echo 'Samba will be compiled with flags:'
209 @echo ' CPP = $(CPP)'
210 @echo ' CPPFLAGS = $(CPPFLAGS)'
212 @echo ' CFLAGS = $(CFLAGS)'
213 @echo ' PICFLAG = $(PICFLAG)'
214 @echo ' BNLD = $(BNLD)'
215 @echo ' BNLD_FLAGS = $(BNLD_FLAGS)'
216 @echo ' STLD = $(STLD)'
217 @echo ' STLD_FLAGS = $(STLD_FLAGS)'
218 @echo ' SHLD = $(SHLD)'
219 @echo ' SHLD_FLAGS = $(SHLD_FLAGS)'
220 @echo ' MDLD = $(MDLD)'
221 @echo ' MDLD_FLAGS = $(MDLD_FLAGS)'
222 @echo ' SHLIBEXT = $(SHLIBEXT)'
225 etags `find $(srcdir) -name "*.[ch]"`
228 ctags `find $(srcdir) -name "*.[ch]"`