upload apache
[bottlenecks.git] / rubbos / app / apache2 / build / rules.mk
1 # Licensed to the Apache Software Foundation (ASF) under one or more
2 # contributor license agreements.  See the NOTICE file distributed with
3 # this work for additional information regarding copyright ownership.
4 # The ASF licenses this file to You under the Apache License, Version 2.0
5 # (the "License"); you may not use this file except in compliance with
6 # the License.  You may obtain a copy of the License at
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 #
17 # The build environment was originally provided by Sascha Schumann.
18
19 include  $(top_builddir)/build/config_vars.mk 
20
21 # Combine all of the flags together in the proper order so that
22 # the user-defined flags can always override the configure ones, if needed.
23 # Note that includes are listed after the flags because -I options have
24 # left-to-right precedence and CPPFLAGS may include user-defined overrides.
25 #
26 ALL_CFLAGS   = $(EXTRA_CFLAGS) $(NOTEST_CFLAGS) $(CFLAGS)
27 ALL_CPPFLAGS = $(DEFS) $(EXTRA_CPPFLAGS) $(NOTEST_CPPFLAGS) $(CPPFLAGS)
28 ALL_CXXFLAGS = $(EXTRA_CXXFLAGS) $(NOTEST_CXXFLAGS) $(CXXFLAGS)
29 ALL_LDFLAGS  = $(EXTRA_LDFLAGS) $(NOTEST_LDFLAGS) $(LDFLAGS)
30 ALL_LIBS     = $(EXTRA_LIBS) $(NOTEST_LIBS) $(LIBS)
31 ALL_INCLUDES = $(INCLUDES) $(EXTRA_INCLUDES)
32
33 # Compile commands
34
35 COMPILE      = $(CC)  $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(ALL_INCLUDES)
36 CXX_COMPILE  = $(CXX) $(ALL_CXXFLAGS) $(ALL_CPPFLAGS) $(ALL_INCLUDES)
37
38 SH_COMPILE     = $(LIBTOOL) --mode=compile $(COMPILE) -prefer-pic -c $< && touch $@
39 SH_CXX_COMPILE = $(LIBTOOL) --mode=compile $(CXX_COMPILE) -prefer-pic -c $< && touch $@
40
41 LT_COMPILE     = $(LIBTOOL) --mode=compile $(COMPILE) -prefer-non-pic -static -c $< && touch $@
42 LT_CXX_COMPILE = $(LIBTOOL) --mode=compile $(CXX_COMPILE) -prefer-non-pic -static -c $< && touch $@
43
44 # Link-related commands
45
46 LINK     = $(LIBTOOL) --mode=link $(COMPILE) $(LT_LDFLAGS) $(ALL_LDFLAGS) -o $@
47 SH_LINK  = $(SH_LIBTOOL) --mode=link $(COMPILE) $(LT_LDFLAGS) $(ALL_LDFLAGS) $(SH_LDFLAGS) $(CORE_IMPLIB) $(SH_LIBS) -o $@
48 MOD_LINK = $(LIBTOOL) --mode=link $(COMPILE) -module $(LT_LDFLAGS) $(ALL_LDFLAGS) -o $@
49
50 # Cross compile commands
51
52 # Helper programs
53
54 MKINSTALLDIRS = $(abs_srcdir)/build/mkdir.sh
55 INSTALL = $(LIBTOOL) --mode=install $(abs_srcdir)/build/install.sh -c
56 INSTALL_DATA = $(INSTALL) -m 644
57 INSTALL_PROGRAM = $(INSTALL) -m 755 $(INSTALL_PROG_FLAGS)
58
59 #
60 # Standard build rules
61 #
62 all: all-recursive
63 depend: depend-recursive
64 clean: clean-recursive
65 distclean: distclean-recursive
66 extraclean: extraclean-recursive
67 install: install-recursive
68 shared-build: shared-build-recursive
69
70 all-recursive install-recursive depend-recursive:
71         @otarget=`echo $@|sed s/-recursive//`; \
72         list=' $(BUILD_SUBDIRS) $(SUBDIRS)'; \
73         for i in $$list; do \
74             if test -d "$$i"; then \
75                 target="$$otarget"; \
76                 echo "Making $$target in $$i"; \
77                 if test "$$i" = "."; then \
78                         made_local=yes; \
79                         target="local-$$target"; \
80                 fi; \
81                 (cd $$i && $(MAKE) $$target) || exit 1; \
82             fi; \
83         done; \
84         if test "$$otarget" = "all" && test -z '$(TARGETS)'; then \
85             made_local=yes; \
86         fi; \
87         if test "$$made_local" != "yes"; then \
88             $(MAKE) "local-$$otarget" || exit 1; \
89         fi
90
91 clean-recursive distclean-recursive extraclean-recursive:
92         @otarget=`echo $@|sed s/-recursive//`; \
93         list='$(CLEAN_SUBDIRS) $(SUBDIRS)'; \
94         for i in $$list; do \
95             if test -d "$$i"; then \
96                 target="$$otarget"; \
97                 echo "Making $$target in $$i"; \
98                 if test "$$i" = "."; then \
99                         made_local=yes; \
100                         target="local-$$target"; \
101                 fi; \
102                 (cd $$i && $(MAKE) $$target); \
103             fi; \
104         done; \
105         if test "$$otarget" = "all" && test -z '$(TARGETS)'; then \
106             made_local=yes; \
107         fi; \
108         if test "$$made_local" != "yes"; then \
109             $(MAKE) "local-$$otarget"; \
110         fi
111
112 shared-build-recursive:
113         @if test `pwd` = "$(top_builddir)"; then \
114             $(PRE_SHARED_CMDS) ; \
115         fi; \
116         list='$(SUBDIRS)'; for i in $$list; do \
117             target="shared-build"; \
118             if test "$$i" = "."; then \
119                 made_local=yes; \
120                 target="local-shared-build"; \
121             fi; \
122             if test "$$i" != "srclib"; then \
123                 (cd $$i && $(MAKE) $$target) || exit 1; \
124             fi; \
125         done; \
126         if test -f 'modules.mk'; then \
127             if test -n '$(SHARED_TARGETS)'; then \
128                 echo "Building shared: $(SHARED_TARGETS)"; \
129                 if test "$$made_local" != "yes"; then \
130                         $(MAKE) "local-shared-build" || exit 1; \
131                 fi; \
132             fi; \
133         fi; \
134         if test `pwd` = "$(top_builddir)"; then \
135                 $(POST_SHARED_CMDS) ; \
136         fi
137
138 local-all: $(TARGETS)
139
140 local-shared-build: $(SHARED_TARGETS)
141
142 local-depend: x-local-depend
143         if test -n "`ls $(srcdir)/*.c 2> /dev/null`"; then \
144                 $(CC) -MM $(ALL_CPPFLAGS) $(ALL_INCLUDES) $(srcdir)/*.c | sed 's/\.o:/.lo:/' > $(builddir)/.deps || true;           \
145         fi
146
147 local-clean: x-local-clean
148         rm -f *.o *.lo *.slo *.obj *.a *.la $(CLEAN_TARGETS) $(TARGETS)
149         rm -rf .libs
150
151 local-distclean: local-clean x-local-distclean
152         rm -f .deps Makefile $(DISTCLEAN_TARGETS)
153
154 local-extraclean: local-distclean x-local-extraclean
155         @if test -n "$(EXTRACLEAN_TARGETS)"; then \
156             echo "rm -f $(EXTRACLEAN_TARGETS)"; \
157             rm -f $(EXTRACLEAN_TARGETS) ; \
158         fi
159
160 local-install: $(TARGETS) $(SHARED_TARGETS) $(INSTALL_TARGETS)
161         @if test -n '$(PROGRAMS)'; then \
162             test -d $(DESTDIR)$(sbindir) || $(MKINSTALLDIRS) $(DESTDIR)$(sbindir); \
163             list='$(PROGRAMS)'; for i in $$list; do \
164                 $(INSTALL_PROGRAM) $$i $(DESTDIR)$(sbindir); \
165             done; \
166         fi
167
168 # to be filled in by the actual Makefile if extra commands are needed
169 x-local-depend x-local-clean x-local-distclean x-local-extraclean:
170
171 #
172 # Implicit rules for creating outputs from input files
173 #
174 CXX_SUFFIX = cpp
175 SHLIB_SUFFIX = so
176
177 .SUFFIXES:
178 .SUFFIXES: .S .c .$(CXX_SUFFIX) .lo .o .s .y .l .slo .def .la
179
180 .c.o:
181         $(COMPILE) -c $<
182
183 .s.o:
184         $(COMPILE) -c $<
185
186 .c.lo:
187         $(LT_COMPILE)
188
189 .s.lo:
190         $(LT_COMPILE)
191
192 .c.slo:
193         $(SH_COMPILE)
194
195 .$(CXX_SUFFIX).lo:
196         $(LT_CXX_COMPILE)
197
198 .$(CXX_SUFFIX).slo:
199         $(SH_CXX_COMPILE)
200
201 .y.c:
202         $(YACC) $(YFLAGS) $< && mv y.tab.c $*.c
203         if test -f y.tab.h; then \
204         if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
205         else :; fi
206
207 .l.c:
208         $(LEX) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
209
210 # Makes an import library from a def file
211 .def.la:
212         $(LIBTOOL) --mode=compile $(MK_IMPLIB) -o $@ $<
213
214 #
215 # Dependencies
216 #
217 include  $(builddir)/.deps 
218
219 .PHONY: all all-recursive install-recursive local-all $(PHONY_TARGETS) \
220         shared-build shared-build-recursive local-shared-build \
221         depend depend-recursive local-depend x-local-depend \
222         clean clean-recursive local-clean x-local-clean \
223         distclean distclean-recursive local-distclean x-local-distclean \
224         extraclean extraclean-recursive local-extraclean x-local-extraclean \
225         install local-install $(INSTALL_TARGETS)
226