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
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
17 # The build environment was originally provided by Sascha Schumann.
19 @ap_make_include@ @ap_make_delimiter@$(top_builddir)/build/config_vars.mk@ap_make_delimiter@
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 # The "MOD_" prefixed variable are provided to allow modules to insert their
26 # (per-subdirectory) settings through definitions in modules.mk, with highest
29 ALL_CFLAGS = $(MOD_CFLAGS) $(EXTRA_CFLAGS) $(NOTEST_CFLAGS) $(CFLAGS)
30 ALL_CPPFLAGS = $(DEFS) $(INTERNAL_CPPFLAGS) $(MOD_CPPFLAGS) $(EXTRA_CPPFLAGS) $(NOTEST_CPPFLAGS) $(CPPFLAGS)
31 ALL_CXXFLAGS = $(MOD_CXXFLAGS) $(EXTRA_CXXFLAGS) $(NOTEST_CXXFLAGS) $(CXXFLAGS)
32 ALL_LDFLAGS = $(MOD_LDFLAGS) $(EXTRA_LDFLAGS) $(NOTEST_LDFLAGS) $(LDFLAGS)
33 ALL_LIBS = $(MOD_LIBS) $(EXTRA_LIBS) $(NOTEST_LIBS) $(LIBS)
34 ALL_INCLUDES = $(MOD_INCLUDES) $(INCLUDES) $(EXTRA_INCLUDES)
38 BASE_CC = $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(ALL_INCLUDES)
39 BASE_CXX = $(CXX) $(ALL_CXXFLAGS) $(ALL_CPPFLAGS) $(ALL_INCLUDES)
41 COMPILE = $(BASE_CC) $(PICFLAGS)
42 CXX_COMPILE = $(BASE_CXX) $(PICFLAGS)
44 SH_COMPILE = $(LIBTOOL) --mode=compile $(BASE_CC) $(SHLTCFLAGS) -c $< && touch $@
45 SH_CXX_COMPILE = $(LIBTOOL) --mode=compile $(BASE_CXX) $(SHLTCFLAGS) -c $< && touch $@
47 LT_COMPILE = $(LIBTOOL) --mode=compile $(COMPILE) $(LTCFLAGS) -c $< && touch $@
48 LT_CXX_COMPILE = $(LIBTOOL) --mode=compile $(CXX_COMPILE) $(LTCFLAGS) -c $< && touch $@
50 # Link-related commands
52 LINK = $(LIBTOOL) --mode=link $(CC) $(ALL_CFLAGS) $(PILDFLAGS) $(LT_LDFLAGS) $(ALL_LDFLAGS) -o $@
53 SH_LINK = $(SH_LIBTOOL) --mode=link $(CC) $(ALL_CFLAGS) $(LT_LDFLAGS) $(ALL_LDFLAGS) $(SH_LDFLAGS) $(CORE_IMPLIB) $(SH_LIBS) -o $@
54 MOD_LINK = $(LIBTOOL) --mode=link $(CC) $(ALL_CFLAGS) -static $(LT_LDFLAGS) $(ALL_LDFLAGS) -o $@
56 # Cross compile commands
60 INSTALL_DATA = $(INSTALL) -m 644
61 INSTALL_PROGRAM = $(INSTALL) -m 755 $(INSTALL_PROG_FLAGS)
64 # Standard build rules
67 depend: depend-recursive
68 clean: clean-recursive
69 distclean: distclean-recursive
70 extraclean: extraclean-recursive
71 install: install-recursive
72 shared-build: shared-build-recursive
74 all-recursive install-recursive depend-recursive:
75 @otarget=`echo $@|sed s/-recursive//`; \
76 list=' $(BUILD_SUBDIRS) $(SUBDIRS)'; \
78 if test -d "$$i"; then \
80 echo "Making $$target in $$i"; \
81 if test "$$i" = "."; then \
83 target="local-$$target"; \
85 (cd $$i && $(MAKE) $$target) || exit 1; \
88 if test "$$otarget" = "all" && test -z '$(TARGETS)'; then \
91 if test "$$made_local" != "yes"; then \
92 $(MAKE) "local-$$otarget" || exit 1; \
95 clean-recursive distclean-recursive extraclean-recursive:
96 @otarget=`echo $@|sed s/-recursive//`; \
97 list='$(CLEAN_SUBDIRS) $(SUBDIRS)'; \
99 if test -d "$$i"; then \
100 target="$$otarget"; \
101 echo "Making $$target in $$i"; \
102 if test "$$i" = "."; then \
104 target="local-$$target"; \
106 (cd $$i && $(MAKE) $$target); \
109 if test "$$otarget" = "all" && test -z '$(TARGETS)'; then \
112 if test "$$made_local" != "yes"; then \
113 $(MAKE) "local-$$otarget"; \
116 shared-build-recursive:
117 @if test `pwd` = "$(top_builddir)"; then \
118 $(PRE_SHARED_CMDS) ; \
120 list='$(SUBDIRS)'; for i in $$list; do \
121 target="shared-build"; \
122 if test "$$i" = "."; then \
124 target="local-shared-build"; \
126 if test "$$i" != "srclib"; then \
127 (cd $$i && $(MAKE) $$target) || exit 1; \
130 if test -f 'modules.mk'; then \
131 if test -n '$(SHARED_TARGETS)'; then \
132 echo "Building shared: $(SHARED_TARGETS)"; \
133 if test "$$made_local" != "yes"; then \
134 $(MAKE) "local-shared-build" || exit 1; \
138 if test `pwd` = "$(top_builddir)"; then \
139 $(POST_SHARED_CMDS) ; \
142 local-all: $(TARGETS)
144 local-shared-build: $(SHARED_TARGETS)
146 local-depend: x-local-depend
147 @if test -n "`ls $(srcdir)/*.c 2> /dev/null`"; then \
149 list='$(srcdir)/*.c'; \
150 for i in $$list; do \
151 $(MKDEP) $(ALL_CPPFLAGS) $(ALL_INCLUDES) $$i | sed 's/\.o:/.lo:/' >> .deps; \
153 sed 's/\.lo:/.slo:/' < .deps > .deps.$$; \
154 cat .deps.$$ >> .deps; \
158 local-clean: x-local-clean
159 rm -f *.o *.lo *.slo *.obj *.a *.la $(CLEAN_TARGETS) $(TARGETS)
162 local-distclean: local-clean x-local-distclean
163 rm -f .deps Makefile $(DISTCLEAN_TARGETS)
165 local-extraclean: local-distclean x-local-extraclean
166 @if test -n "$(EXTRACLEAN_TARGETS)"; then \
167 echo "rm -f $(EXTRACLEAN_TARGETS)"; \
168 rm -f $(EXTRACLEAN_TARGETS) ; \
171 program-install: $(TARGETS) $(SHARED_TARGETS)
172 @if test -n '$(bin_PROGRAMS)'; then \
173 test -d $(DESTDIR)$(bindir) || $(MKINSTALLDIRS) $(DESTDIR)$(bindir); \
174 list='$(bin_PROGRAMS)'; for i in $$list; do \
175 $(INSTALL_PROGRAM) $$i $(DESTDIR)$(bindir); \
178 @if test -n '$(sbin_PROGRAMS)'; then \
179 test -d $(DESTDIR)$(sbindir) || $(MKINSTALLDIRS) $(DESTDIR)$(sbindir); \
180 list='$(sbin_PROGRAMS)'; for i in $$list; do \
181 $(INSTALL_PROGRAM) $$i $(DESTDIR)$(sbindir); \
185 local-install: program-install $(INSTALL_TARGETS)
187 # to be filled in by the actual Makefile if extra commands are needed
188 x-local-depend x-local-clean x-local-distclean x-local-extraclean:
191 # Implicit rules for creating outputs from input files
197 .SUFFIXES: .S .c .$(CXX_SUFFIX) .lo .o .s .y .l .slo .def .la
221 $(YACC) $(YFLAGS) $< && mv y.tab.c $*.c
222 if test -f y.tab.h; then \
223 if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
227 $(LEX) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
229 # Makes an import library from a def file
231 $(LIBTOOL) --mode=compile $(MK_IMPLIB) -o $@ $<
236 @ap_make_include@ @ap_make_delimiter@$(builddir)/.deps@ap_make_delimiter@
238 .PHONY: all all-recursive install-recursive local-all $(PHONY_TARGETS) \
239 shared-build shared-build-recursive local-shared-build \
240 depend depend-recursive local-depend x-local-depend \
241 clean clean-recursive local-clean x-local-clean \
242 distclean distclean-recursive local-distclean x-local-distclean \
243 extraclean extraclean-recursive local-extraclean x-local-extraclean \
244 install local-install docs $(INSTALL_TARGETS)