Fix PReg write support.
[Samba.git] / source4 / rules.mk
blob5f91f8132e98cab1d9b22f3d22e8b3f8125747d1
1 # Dependencies command
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) \
16 $(CPPFLAGS) \
17 -c $< -o $@
19 # Run the compiler for the build host
20 HCOMPILE = $(HOSTCC) $(HOSTCC_FLAGS) $(CPPFLAGS) -c $< -o $@
22 # Precompile headers
23 PCHCOMPILE = @$(CC) -Ilib/replace \
24 $(CFLAGS) $(PICFLAG) $(CPPFLAGS) -c $< -o $@
26 # Partial linking
27 PARTLINK = @$(PROG_LD) -r
29 include/config.h:
30 @echo "include/config.h not present"
31 @echo "You need to rerun ./autogen.sh and ./configure"
32 @/bin/false
34 $(srcdir)/version.h: $(srcdir)/VERSION
35 @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
37 regen_version::
38 @$(SHELL) script/mkversion.sh VERSION $(srcdir)/version.h $(srcdir)/
40 clean_pch::
41 @echo "Removing precompiled headers"
42 @-rm -f include/includes.h.gch
44 pch:: clean_pch include/includes.h.gch
46 clean:: clean_pch
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
60 @-rm -f bin/.*_*
61 @echo Removing generated files
62 @-rm -f bin/*_init_module.c
63 @-rm -rf librpc/gen_*
64 @echo Removing proto headers
65 @-rm -f $(PROTO_HEADERS)
67 distclean:: clean
68 -rm -f include/config.h include/config_tmp.h include/build.h
69 -rm -f data.mk
70 -rm -f config.status
71 -rm -f config.log config.cache
72 -rm -f config.pm config.mk
73 -rm -f $(PC_FILES)
75 removebackup::
76 -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
78 realdistclean:: distclean removebackup
79 -rm -f include/config_tmp.h.in
80 -rm -f version.h
81 -rm -f configure
82 -rm -f $(MANPAGES)
84 check:: test
86 unused_macros:
87 $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort
89 # Create a static library
90 %.a:
91 @echo Linking $@
92 @rm -f $@
93 @mkdir -p $(@D)
94 @$(STLD) $(STLD_FLAGS) $@ $^
96 ###############################################################################
97 # File types
98 ###############################################################################
100 .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
102 .c.d:
103 @echo "Generating dependencies for $<"
104 @$(DEPENDS)
106 .c.hd:
107 @echo "Generating host-compiler dependencies for $<"
108 @$(HDEPENDS)
110 include/includes.d: include/includes.h
111 @echo "Generating dependencies for $<"
112 @$(PCHDEPENDS)
114 .c.o:
115 @if test -n "$(CC_CHECKER)"; then \
116 echo "Checking $< with '$(CC_CHECKER)'"; \
117 $(CHECK) ; \
119 @echo "Compiling $<"
120 @-mkdir -p `dirname $@`
121 @$(COMPILE) && exit 0 ; \
122 echo "The following command failed:" 1>&2;\
123 $(COMPILE) >/dev/null 2>&1
126 # echo "$(COMPILE)" 1>&2;\
128 .c.ho:
129 @echo "Compiling $< with host compiler"
130 @-mkdir -p `dirname $@`
131 @$(HCOMPILE) && exit 0;\
132 echo "The following command failed:" 1>&2;\
133 echo "$(HCOMPILE)" 1>&2;\
134 $(HCOMPILE) >/dev/null 2>&1
136 .h.h.gch:
137 @echo "Precompiling $<"
138 @$(PCHCOMPILE)
140 .y.c:
141 @echo "Building $< with $(YACC)"
142 @-$(srcdir)/script/yacc_compile.sh "$(YACC)" "$<" "$@"
144 .l.c:
145 @echo "Building $< with $(LEX)"
146 @-$(srcdir)/script/lex_compile.sh "$(LEX)" "$<" "$@"
148 DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
150 .1.xml.1:
151 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
153 .3.xml.3:
154 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
156 .5.xml.5:
157 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
159 .7.xml.7:
160 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
162 .8.xml.8:
163 $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
165 dist:: idl_full manpages configure distclean
167 configure:
168 ./autogen.sh
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)'
187 etags:
188 etags `find $(srcdir) -name "*.[ch]"`
190 ctags:
191 ctags `find $(srcdir) -name "*.[ch]"`