1AUTOMAKE_OPTIONS = foreign nostdinc
2
3ACLOCAL_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
24if CURLDEBUG
25INCLUDES = -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)
32else
33INCLUDES = -I$(top_builddir) \
34           -I$(top_srcdir)
35endif
36
37lib_LTLIBRARIES = libcares.la
38
39man_MANS = $(MANPAGES)
40
41MSVCFILES = 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
44if CURLDEBUG
45PROGS =
46else
47PROGS = ahost adig acountry
48endif
49
50noinst_PROGRAMS =$(PROGS)
51
52# adig and ahost are just sample programs and thus not mentioned with the
53# regular sources and headers
54EXTRA_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
59
60CLEANFILES = $(PDFPAGES) $(HTMLPAGES)
61
62DISTCLEANFILES = ares_build.h
63
64pkgconfigdir = $(libdir)/pkgconfig
65pkgconfig_DATA = libcares.pc
66
67VER=-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
96if NO_UNDEFINED
97# The -no-undefined flag is crucial for this to build fine on some platforms
98UNDEF = -no-undefined
99endif
100
101libcares_la_LDFLAGS = $(UNDEF) $(VER)
102
103# Add -Werror if defined
104CFLAGS += @CARES_CFLAG_EXTRAS@
105
106# Makefile.inc provides the CSOURCES and HHEADERS defines
107include Makefile.inc
108
109libcares_la_SOURCES = $(CSOURCES) $(HHEADERS)
110
111# where to install the c-ares headers
112libcares_ladir = $(includedir)
113# what headers to install on 'make install':
114libcares_la_HEADERS = ares.h ares_version.h ares_dns.h \
115	ares_build.h ares_rules.h
116
117ahost_SOURCES = ahost.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
118ahost_LDADD = $(top_builddir)/libcares.la
119ahost_CFLAGS = $(AM_CFLAGS)
120
121adig_SOURCES = adig.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
122adig_LDADD = $(top_builddir)/libcares.la
123adig_CFLAGS = $(AM_CFLAGS)
124
125acountry_SOURCES = acountry.c $(SAMPLESOURCES) $(SAMPLEHEADERS)
126acountry_LDADD = $(top_builddir)/libcares.la
127acountry_CFLAGS = $(AM_CFLAGS)
128
129SOURCEDMANDIR = man3
130SOURCEDMANPAGES = ares_init.3
131
132clean-local: clean-sourced-manpages
133
134clean-sourced-manpages:
135	@srcdmandir='$(SOURCEDMANDIR)'; \
136	echo "rm -rf $(top_builddir)/$$srcdmandir"; \
137	rm -rf $(top_builddir)/$$srcdmandir
138
139sourced-manpages: clean-sourced-manpages
140	@srcdmandir='$(SOURCEDMANDIR)'; \
141	srcdmanfiles='$(SOURCEDMANPAGES)'; \
142	mkdir $(top_builddir)/$$srcdmandir; \
143	for file in $$srcdmanfiles; do \
144	  if test -f $(top_srcdir)/$$file; then \
145	    echo "cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file"; \
146	    cp $(top_srcdir)/$$file $(top_builddir)/$$srcdmandir/$$file; \
147	  fi; \
148	done
149
150MAN2HTML = roffit --mandir=. < $< >$@
151
152SUFFIXES = .3 .html
153
154html: sourced-manpages $(HTMLPAGES)
155
156.3.html:
157	$(MAN2HTML)
158
159pdf: sourced-manpages $(PDFPAGES)
160
161.3.pdf:
162	@(foo=`echo $@ | sed -e 's/\.[0-9]$$//g'`; \
163	groff -Tps -man $< >$$foo.ps; \
164	ps2pdf $$foo.ps $@; \
165	rm $$foo.ps; \
166	echo "converted $< to $@")
167
168# Make files named *.dist replace the file without .dist extension
169dist-hook:
170	find $(distdir) -name "*.dist" -exec rm {} \;
171	(distit=`find $(srcdir) -name "*.dist"`; \
172	for file in $$distit; do \
173	  strip=`echo $$file | sed -e s/^$(srcdir)// -e s/\.dist//`; \
174	  cp $$file $(distdir)$$strip; \
175	done)
176