~zulcss/samba/server-dailies-3.4

« back to all changes in this revision

Viewing changes to source4/build/make/rules.mk

  • Committer: Chuck Short
  • Date: 2010-09-28 20:38:39 UTC
  • Revision ID: zulcss@ubuntu.com-20100928203839-pgjulytsi9ue63x1
Initial version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 $@ -MT : \
 
6
    $(CFLAGS) $(CPPFLAGS) $< -o $@
 
7
# Dependencies for host objects
 
8
HDEPENDS = $(CC) -M -MG -MP -MT $(<:.c=.ho) -MT $@ -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 libraries
 
47
        @-rm -f $(STATIC_LIBS) $(SHARED_LIBS)
 
48
        @-rm -f bin/static/*.a $(shliboutputdir)/*.$(SHLIBEXT) bin/mergedobj/*.o
 
49
        @echo Removing modules
 
50
        @-rm -f bin/modules/*/*.$(SHLIBEXT)
 
51
        @-rm -f bin/*_init_module.c
 
52
        @echo Removing dummy targets
 
53
        @-rm -f bin/.*_*
 
54
        @echo Removing generated files
 
55
        @-rm -f bin/*_init_module.c
 
56
        @-rm -rf librpc/gen_* 
 
57
 
 
58
distclean:: clean
 
59
        -rm -f include/config.h include/config_tmp.h include/build.h
 
60
        -rm -f data.mk
 
61
        -rm -f config.status
 
62
        -rm -f config.log config.cache
 
63
        -rm -f config.pm config.mk
 
64
        -rm -f $(PC_FILES)
 
65
 
 
66
removebackup::
 
67
        -rm -f *.bak *~ */*.bak */*~ */*/*.bak */*/*~ */*/*/*.bak */*/*/*~
 
68
 
 
69
realdistclean:: distclean removebackup
 
70
        -rm -f include/config_tmp.h.in
 
71
        -rm -f version.h
 
72
        -rm -f configure
 
73
        -rm -f $(MANPAGES)
 
74
 
 
75
check:: test
 
76
 
 
77
unused_macros:
 
78
        $(srcdir)/script/find_unused_macros.pl `find . -name "*.[ch]"` | sort
 
79
 
 
80
# Create a static library
 
81
%.a:
 
82
        @echo Linking $@
 
83
        @rm -f $@
 
84
        @mkdir -p $(@D)
 
85
        @$(STLD) $(STLD_FLAGS) $@ $^
 
86
 
 
87
include $(make_utility_dir)/templates.mk
 
88
 
 
89
###############################################################################
 
90
# File types
 
91
###############################################################################
 
92
 
 
93
.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
 
94
 
 
95
.c.d:
 
96
        @echo "Generating dependencies for $<"
 
97
        @$(DEPENDS)
 
98
 
 
99
.c.hd:
 
100
        @echo "Generating host-compiler dependencies for $<"
 
101
        @$(HDEPENDS)
 
102
 
 
103
include/includes.d: include/includes.h
 
104
        @echo "Generating dependencies for $<"
 
105
        @$(PCHDEPENDS)
 
106
 
 
107
.c.o:
 
108
        @if test -n "$(CC_CHECKER)"; then \
 
109
                echo "Checking  $< with '$(CC_CHECKER)'"; \
 
110
                $(CHECK) ; \
 
111
        fi
 
112
        @echo "Compiling $<"
 
113
        @-mkdir -p `dirname $@`
 
114
        @$(COMPILE) && exit 0 ; \
 
115
                echo "The following command failed:" 1>&2;\
 
116
                echo "$(subst ",\",$(COMPILE))" 1>&2 && exit 1
 
117
 
 
118
 
 
119
.c.ho:
 
120
        @echo "Compiling $< with host compiler"
 
121
        @-mkdir -p `dirname $@`
 
122
        @$(HCOMPILE) && exit 0;\
 
123
                echo "The following command failed:" 1>&2;\
 
124
                echo "$(subst ",\",$(HCOMPILE))" 1>&2;\
 
125
                $(HCOMPILE) >/dev/null 2>&1
 
126
 
 
127
.h.h.gch:
 
128
        @echo "Precompiling $<"
 
129
        @$(PCHCOMPILE)
 
130
 
 
131
.y.c:
 
132
        @echo "Building $< with $(YACC)"
 
133
        @-$(make_utility_dir)/yacc_compile.sh "$(YACC)" "$<" "$@"
 
134
 
 
135
.l.c:
 
136
        @echo "Building $< with $(LEX)"
 
137
        @-$(make_utility_dir)/lex_compile.sh "$(LEX)" "$<" "$@"
 
138
 
 
139
%.a:
 
140
        @echo Linking $@
 
141
        @rm -f $@
 
142
        @mkdir -p $(@D)
 
143
        @$(STLD) $(STLD_FLAGS) $@ $^
 
144
 
 
145
 
 
146
DOCBOOK_MANPAGE_URL = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl
 
147
 
 
148
.1.xml.1:
 
149
        $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
 
150
 
 
151
.3.xml.3:
 
152
        $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
 
153
 
 
154
.5.xml.5:
 
155
        $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
 
156
 
 
157
.7.xml.7:
 
158
        $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
 
159
 
 
160
.8.xml.8:
 
161
        $(XSLTPROC) -o $@ $(DOCBOOK_MANPAGE_URL) $<
 
162
 
 
163
dist:: idl_full manpages configure distclean 
 
164
 
 
165
configure: 
 
166
        ./autogen.sh
 
167
 
 
168
showflags::
 
169
        @echo 'Samba will be compiled with flags:'
 
170
        @echo '  CPP        = $(CPP)'
 
171
        @echo '  CPPFLAGS   = $(CPPFLAGS)'
 
172
        @echo '  CC         = $(CC)'
 
173
        @echo '  CFLAGS     = $(CFLAGS)'
 
174
        @echo '  PICFLAG    = $(PICFLAG)'
 
175
        @echo '  BNLD       = $(BNLD)'
 
176
        @echo '  BNLD_FLAGS = $(BNLD_FLAGS)'
 
177
        @echo '  STLD       = $(STLD)'
 
178
        @echo '  STLD_FLAGS = $(STLD_FLAGS)'
 
179
        @echo '  SHLD       = $(SHLD)'
 
180
        @echo '  SHLD_FLAGS = $(SHLD_FLAGS)'
 
181
        @echo '  MDLD       = $(MDLD)'
 
182
        @echo '  MDLD_FLAGS = $(MDLD_FLAGS)'
 
183
        @echo '  SHLIBEXT   = $(SHLIBEXT)'
 
184
 
 
185
base_srcdirs = $(srcdir) ../librpc/ ../lib/ ../libcli
 
186
 
 
187
etags:
 
188
        etags `find $(base_srcdirs) -name "*.[ch]"`
 
189
 
 
190
ctags:
 
191
        ctags `find $(base_srcdirs) -name "*.[ch]"`