Fix a couple (well, little more than that..) of typos.
[ira/wip.git] / source4 / build / make / rules.mk
1 # Rules file for Samba 4
2 # This relies on GNU make.
3 #
4 # Dependencies command
5 DEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.o) -MT $@ \
6     $(CFLAGS) $(CPPFLAGS) $< -o $@
7 # Dependencies for host objects
8 HDEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.ho) -MT $@ \
9     $(HOSTCC_FLAGS) $(CPPFLAGS) $< -o $@
10 # Dependencies for precompiled headers
11 PCHDEPENDS = $(CC) -M -MG -MT include/includes.h.gch -MT $@ \
12     $(CFLAGS) $(CPPFLAGS) $< -o $@
13
14 # Run a static analysis checker
15 CHECK = $(CC_CHECKER) $(CFLAGS) $(PICFLAG) $(CPPLAGS) -c $< -o $@
16
17 # Run the configured compiler
18 COMPILE = $(CC) $(CFLAGS) $(PICFLAG) \
19                   $(CPPFLAGS) \
20                   -c $< -o $@
21
22 # Run the compiler for the build host
23 HCOMPILE = $(HOSTCC) $(HOSTCC_FLAGS) $(CPPFLAGS) -c $< -o $@
24
25 # Precompile headers
26 PCHCOMPILE = @$(CC) -Ilib/replace \
27     $(CFLAGS) $(PICFLAG) $(CPPFLAGS) -c $< -o $@
28
29 # Partial linking
30 PARTLINK = @$(PROG_LD) -r
31
32 make_utility_dir = $(srcdir)/build/make/
33
34 include/config.h:
35         @echo "include/config.h not present"
36         @echo "You need to rerun ./autogen.sh and ./configure"
37         @/bin/false
38
39 pch::
40
41 clean:: clean_pch
42         @echo Removing objects
43         @-find . -name '*.o' -exec rm -f '{}' \;
44         @echo Removing hostcc objects
45         @-find . -name '*.ho' -exec rm -f '{}' \;
46         @echo Removing binaries
47         @-rm -f $(BIN_PROGS) $(SBIN_PROGS) $(BINARIES) $(TORTURE_PROGS)
48         @echo Removing libraries
49         @-rm -f $(STATIC_LIBS) $(SHARED_LIBS)
50         @-rm -f bin/static/*.a bin/shared/*.$(SHLIBEXT) bin/mergedobj/*.o
51         @echo Removing modules
52         @-rm -f bin/modules/*/*.$(SHLIBEXT)
53         @-rm -f bin/*_init_module.c
54         @echo Removing dummy targets
55         @-rm -f bin/.*_*
56         @echo Removing generated files
57         @-rm -f bin/*_init_module.c
58         @-rm -rf librpc/gen_* 
59
60 distclean:: clean
61         -rm -f include/config.h include/config_tmp.h include/build.h
62         -rm -f data.mk
63         -rm -f config.status
64         -rm -f config.log config.cache
65         -rm -f config.pm config.mk
66         -rm -f $(PC_FILES)
67
68 removebackup::
69         -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
70
71 realdistclean:: distclean removebackup
72         -rm -f include/config_tmp.h.in
73         -rm -f version.h
74         -rm -f configure
75         -rm -f $(MANPAGES)
76
77 check:: test
78
79 unused_macros:
80         $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort
81
82 # Create a static library
83 %.a:
84         @echo Linking $@
85         @rm -f $@
86         @mkdir -p $(@D)
87         @$(STLD) $(STLD_FLAGS) $@ $^
88
89 include build/make/templates.mk
90
91 ###############################################################################
92 # File types
93 ###############################################################################
94
95 .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
96
97 .c.d:
98         @echo "Generating dependencies for $<"
99         @$(DEPENDS)
100
101 .c.hd:
102         @echo "Generating host-compiler dependencies for $<"
103         @$(HDEPENDS)
104
105 include/includes.d: include/includes.h
106         @echo "Generating dependencies for $<"
107         @$(PCHDEPENDS)
108
109 .c.o:
110         @if test -n "$(CC_CHECKER)"; then \
111                 echo "Checking  $< with '$(CC_CHECKER)'"; \
112                 $(CHECK) ; \
113         fi
114         @echo "Compiling $<"
115         @-mkdir -p `dirname $@`
116         @$(COMPILE) && exit 0 ; \
117                 echo "The following command failed:" 1>&2;\
118                 echo "$(subst ",\",$(COMPILE))" 1>&2 && exit 1
119
120
121 .c.ho:
122         @echo "Compiling $< with host compiler"
123         @-mkdir -p `dirname $@`
124         @$(HCOMPILE) && exit 0;\
125                 echo "The following command failed:" 1>&2;\
126                 echo "$(subst ",\",$(HCOMPILE))" 1>&2;\
127                 $(HCOMPILE) >/dev/null 2>&1
128
129 .h.h.gch:
130         @echo "Precompiling $<"
131         @$(PCHCOMPILE)
132
133 .y.c:
134         @echo "Building $< with $(YACC)"
135         @-$(make_utility_dir)/yacc_compile.sh "$(YACC)" "$<" "$@"
136
137 .l.c:
138         @echo "Building $< with $(LEX)"
139         @-$(make_utility_dir)/lex_compile.sh "$(LEX)" "$<" "$@"
140
141 %.a:
142         @echo Linking $@
143         @rm -f $@
144         @mkdir -p $(@D)
145         @$(STLD) $(STLD_FLAGS) $@ $^
146
147
148 DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
149
150 .1.xml.1:
151         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
152
153 .3.xml.3:
154         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
155
156 .5.xml.5:
157         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
158
159 .7.xml.7:
160         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
161
162 .8.xml.8:
163         $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
164
165 dist:: idl_full manpages configure distclean 
166
167 configure: 
168         ./autogen.sh
169
170 showflags::
171         @echo 'Samba will be compiled with flags:'
172         @echo '  CPP        = $(CPP)'
173         @echo '  CPPFLAGS   = $(CPPFLAGS)'
174         @echo '  CC         = $(CC)'
175         @echo '  CFLAGS     = $(CFLAGS)'
176         @echo '  PICFLAG    = $(PICFLAG)'
177         @echo '  BNLD       = $(BNLD)'
178         @echo '  BNLD_FLAGS = $(BNLD_FLAGS)'
179         @echo '  STLD       = $(STLD)'
180         @echo '  STLD_FLAGS = $(STLD_FLAGS)'
181         @echo '  SHLD       = $(SHLD)'
182         @echo '  SHLD_FLAGS = $(SHLD_FLAGS)'
183         @echo '  MDLD       = $(MDLD)'
184         @echo '  MDLD_FLAGS = $(MDLD_FLAGS)'
185         @echo '  SHLIBEXT   = $(SHLIBEXT)'
186
187 etags:
188         etags `find $(srcdir) -name "*.[ch]"`
189
190 ctags:
191         ctags `find $(srcdir) -name "*.[ch]"`