zz40-xc-ovr.m4: fix variable assignment of subshell output bashism
[platform/upstream/c-ares.git] / Makefile.am
1 AUTOMAKE_OPTIONS = foreign nostdinc
2
3 ACLOCAL_AMFLAGS = -I m4
4
5 # Specify our include paths here, and do it relative to $(top_srcdir) and
6 # $(top_builddir), to ensure that these paths which belong to the library
7 # being currently built and tested are searched before the library which
8 # might possibly already be installed in the system.
9 #
10 # When using the low-level hard-hacking memory leak tracking code from
11 # libcurl the generated curl/curlbuild.h file must also be reachable.
12 # Using the libcurl lowlevel code from within c-ares library is ugly and
13 # only works when c-ares is built and linked with a similarly debug-build
14 # libcurl, but we do this anyway for convenience.
15 #
16 # $(top_builddir)/../include/curl for generated curlbuild.h included from curl.h
17 # $(top_builddir)/../include is for libcurl's generated curl/curlbuild.h file
18 # $(top_srcdir)/../include is for libcurl's external include files
19 # $(top_builddir)/../lib is for libcurl's generated lib/curl_config.h file
20 # $(top_srcdir)/../lib is for libcurl's lib/setup.h and other "private" files
21 # $(top_builddir) is for c-ares's generated ares_config.h file
22 # $(top_srcdir) is for c-ares's ares_setup.h and other "c-ares-private" files
23
24 if CURLDEBUG
25 INCLUDES = -I$(top_builddir)/../include/curl \
26            -I$(top_builddir)/../include      \
27            -I$(top_srcdir)/../include        \
28            -I$(top_builddir)/../lib          \
29            -I$(top_srcdir)/../lib            \
30            -I$(top_builddir)                 \
31            -I$(top_srcdir)
32 else
33 INCLUDES = -I$(top_builddir) \
34            -I$(top_srcdir)
35 endif
36
37 lib_LTLIBRARIES = libcares.la
38
39 man_MANS = $(MANPAGES)
40
41 MSVCFILES = vc/vc6aws.dsw vc/acountry/vc6acountry.dsp vc/adig/vc6adig.dsp \
42  vc/ahost/vc6ahost.dsp vc/cares/vc6cares.dsp vc/cares/vc6cares.dsw
43
44 if CURLDEBUG
45 PROGS =
46 else
47 PROGS = ahost adig acountry
48 endif
49
50 noinst_PROGRAMS =$(PROGS)
51
52 # adig and ahost are just sample programs and thus not mentioned with the
53 # regular sources and headers
54 EXTRA_DIST = AUTHORS CHANGES README.cares Makefile.inc Makefile.dj         \
55  Makefile.m32 Makefile.netware Makefile.msvc Makefile.Watcom $(man_MANS)   \
56  config-win32.h RELEASE-NOTES libcares.pc.in buildconf get_ver.awk maketgz \
57  TODO ares_build.h.in $(PDFPAGES) cares.rc README.msvc $(MSVCFILES)        \
58  $(CSOURCES) $(HHEADERS) config-dos.h acountry.1 adig.1 ahost.1 INSTALL
59
60 CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
61
62 DISTCLEANFILES = ares_build.h
63
64 pkgconfigdir = $(libdir)/pkgconfig
65 pkgconfig_DATA = libcares.pc
66
67 VER=-version-info 2:0:0
68 # This flag accepts an argument of the form current[:revision[:age]]. So,
69 # passing -version-info 3:12:1 sets current to 3, revision to 12, and age to
70 # 1.
71 #
72 # If either revision or age are omitted, they default to 0. Also note that age
73 # must be less than or equal to the current interface number.
74 #
75 # Here are a set of rules to help you update your library version information: 
76 #
77 # 1.Start with version information of 0:0:0 for each libtool library.
78 #
79 # 2.Update the version information only immediately before a public release of
80 # your software. More frequent updates are unnecessary, and only guarantee
81 # that the current interface number gets larger faster.
82 #
83 # 3.If the library source code has changed at all since the last update, then
84 # increment revision (c:r+1:a)
85 #
86 # 4.If any interfaces have been added, removed, or changed since the last
87 # update, increment current, and set revision to 0. (c+1:r=0:a)
88 #
89 # 5.If any interfaces have been added since the last public release, then
90 # increment age. (c:r:a+1)
91 #
92 # 6.If any interfaces have been removed since the last public release, then
93 # set age to 0. (c:r:a=0)
94 #
95
96 if NO_UNDEFINED
97 # The -no-undefined flag is crucial for this to build fine on some platforms
98 UNDEF = -no-undefined
99 endif
100
101 libcares_la_LDFLAGS = $(UNDEF) $(VER)
102
103 # Add -Werror if defined
104 CFLAGS += @CARES_CFLAG_EXTRAS@
105
106 CFLAG_CARES_SYMBOL_HIDING = @CFLAG_CARES_SYMBOL_HIDING@
107
108 # For Windows build targets, when building or using static c-ares
109 if USE_CPPFLAG_CARES_STATICLIB
110 AM_CPPFLAGS = -DCARES_STATICLIB
111 else
112 AM_CPPFLAGS =
113 endif
114
115 if DOING_CARES_SYMBOL_HIDING
116 if USE_CPPFLAG_CARES_BUILDING_LIBRARY
117 libcares_la_CPPFLAGS = $(AM_CPPFLAGS) -DCARES_SYMBOL_HIDING -DCARES_BUILDING_LIBRARY
118 else
119 libcares_la_CPPFLAGS = $(AM_CPPFLAGS) -DCARES_SYMBOL_HIDING
120 endif
121 libcares_la_CFLAGS = $(AM_CFLAGS) $(CFLAG_CARES_SYMBOL_HIDING)
122 else
123 if USE_CPPFLAG_CARES_BUILDING_LIBRARY
124 libcares_la_CPPFLAGS = $(AM_CPPFLAGS) -DCARES_BUILDING_LIBRARY
125 else
126 libcares_la_CPPFLAGS = $(AM_CPPFLAGS)
127 endif
128 libcares_la_CFLAGS = $(AM_CFLAGS)
129 endif
130
131 # Makefile.inc provides the CSOURCES and HHEADERS defines
132 include Makefile.inc
133
134 libcares_la_SOURCES = $(CSOURCES) $(HHEADERS)
135
136 # where to install the c-ares headers
137 libcares_ladir = $(includedir)
138 # what headers to install on 'make install':
139 libcares_la_HEADERS = ares.h ares_version.h ares_dns.h \
140         ares_build.h ares_rules.h
141
142 ahost_SOURCES = ahost.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
143 ahost_LDADD = $(top_builddir)/libcares.la
144 ahost_CFLAGS = $(AM_CFLAGS)
145 ahost_CPPFLAGS = $(AM_CPPFLAGS)
146
147 adig_SOURCES = adig.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
148 adig_LDADD = $(top_builddir)/libcares.la
149 adig_CFLAGS = $(AM_CFLAGS)
150 adig_CPPFLAGS = $(AM_CPPFLAGS)
151
152 acountry_SOURCES = acountry.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
153 acountry_LDADD = $(top_builddir)/libcares.la
154 acountry_CFLAGS = $(AM_CFLAGS)
155 acountry_CPPFLAGS = $(AM_CPPFLAGS)
156
157 SOURCEDMANDIR = man3
158 SOURCEDMANPAGES = ares_init.3
159
160 clean-local: clean-sourced-manpages
161
162 clean-sourced-manpages:
163         @srcdmandir='$(SOURCEDMANDIR)'; \
164         echo "rm -rf $(top_builddir)/$$srcdmandir"; \
165         rm -rf $(top_builddir)/$$srcdmandir
166
167 sourced-manpages: clean-sourced-manpages
168         @srcdmandir='$(SOURCEDMANDIR)'; \
169         srcdmanfiles='$(SOURCEDMANPAGES)'; \
170         mkdir $(top_builddir)/$$srcdmandir; \
171         for file in $$srcdmanfiles; do \
172           if test -f $(top_srcdir)/$$file; then \
173             echo "cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file"; \
174             cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file; \
175           fi; \
176         done
177
178 MAN2HTML = roffit --mandir=. < $< >$@
179
180 SUFFIXES = .3 .html
181
182 html: sourced-manpages $(HTMLPAGES)
183
184 .3.html:
185         $(MAN2HTML)
186
187 pdf: sourced-manpages $(PDFPAGES)
188
189 .3.pdf:
190         @(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \
191         groff -Tps -man $< >$$foo.ps; \
192         ps2pdf $$foo.ps $@; \
193         rm $$foo.ps; \
194         echo "converted $< to $@")
195
196 # Make files named *.dist replace the file without .dist extension
197 dist-hook:
198         find $(distdir) -name "*.dist" -exec rm {} \;
199         (distit=`find $(srcdir) -name "*.dist"`; \
200         for file in $$distit; do \
201           strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \
202           cp $$file $(distdir)$$strip; \
203         done)