1# 2# @configure_input@ 3# 4# Copyright (c) 2013, Verisign, Inc., NLNet Labs 5# All rights reserved. 6# 7# Redistribution and use in source and binary forms, with or without 8# modification, are permitted provided that the following conditions are met: 9# * Redistributions of source code must retain the above copyright 10# notice, this list of conditions and the following disclaimer. 11# * Redistributions in binary form must reproduce the above copyright 12# notice, this list of conditions and the following disclaimer in the 13# documentation and/or other materials provided with the distribution. 14# * Neither the names of the copyright holders nor the 15# names of its contributors may be used to endorse or promote products 16# derived from this software without specific prior written permission. 17# 18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 19# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21# DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY 22# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 29package = @PACKAGE_NAME@ 30version = @PACKAGE_VERSION@ 31tarname = @PACKAGE_TARNAME@ 32distdir = $(tarname)-$(version) 33 34prefix = @prefix@ 35exec_prefix = @exec_prefix@ 36bindir = @bindir@ 37LIBTOOL = ../../libtool 38 39srcdir = @srcdir@ 40 41EXTENSION_LIBEVENT_EXT_LIBS=@EXTENSION_LIBEVENT_EXT_LIBS@ 42EXTENSION_LIBEVENT_LDFLAGS=@EXTENSION_LIBEVENT_LDFLAGS@ 43EXTENSION_LIBEVENT_LIB=../../src/libgetdns_ext_event.la 44 45CC=@CC@ 46CFLAGS=-I$(srcdir) -I$(srcdir)/../../src -I../../src @CFLAGS@ 47LDFLAGS=@LDFLAGS@ -L../../src 48LDLIBS=../../src/libgetdns.la @LIBS@ 49 50 51OBJS=example-all-functions.lo example-simple-answers.lo example-tree.lo example-synchronous.lo example-reverse.lo 52 53PROGRAMS=example-all-functions example-synchronous example-simple-answers example-tree example-reverse 54 55.SUFFIXES: .c .o .a .lo .h 56 57.c.o: 58 $(CC) $(CFLAGS) -c $< -o $@ 59 60.c.lo: 61 $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $< -o $@ 62 63default: all 64example: all 65 66all: $(PROGRAMS) 67 68$(OBJS): 69 $(LIBTOOL) --quiet --tag=CC --mode=compile $(CC) $(CFLAGS) -c $(srcdir)/$(@:.lo=.c) -o $@ 70 71example-all-functions: example-all-functions.lo 72 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ example-all-functions.lo 73 74example-synchronous: example-synchronous.lo 75 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS) -o $@ example-synchronous.lo 76 77$(EXTENSION_LIBEVENT_LIB): 78 @echo "***" 79 @echo "*** Three examples from the specification need libevent." 80 @echo "*** libevent was not found or usable at configure time." 81 @echo "*** To compile and run all examples from the spec, make sure" 82 @echo "*** libevent is available and usable during configuration." 83 @echo "***" 84 @false 85 86example-simple-answers: example-simple-answers.lo $(EXTENSION_LIBEVENT_LIB) 87 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(EXTENSION_LIBEVENT_LIB) $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) $(LDLIBS) -o $@ example-simple-answers.lo 88 89example-tree: example-tree.lo $(EXTENSION_LIBEVENT_LIB) 90 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(EXTENSION_LIBEVENT_LIB) $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) $(LDLIBS) -o $@ example-tree.lo 91 92example-reverse: example-reverse.lo $(EXTENSION_LIBEVENT_LIB) 93 $(LIBTOOL) --tag=CC --mode=link $(CC) $(CFLAGS) $(LDFLAGS) $(EXTENSION_LIBEVENT_LIB) $(EXTENSION_LIBEVENT_LDFLAGS) $(EXTENSION_LIBEVENT_EXT_LIBS) $(LDLIBS) -o $@ example-reverse.lo 94 95clean: 96 rm -f *.o *.lo $(PROGRAMS) 97 rm -rf .libs 98 99distclean : clean 100 rm -f Makefile config.status config.log 101 rm -Rf autom4te.cache 102 103$(distdir): FORCE 104 mkdir -p $(distdir)/src 105 cp configure.ac $(distdir) 106 cp configure $(distdir) 107 cp Makefile.in $(distdir) 108 cp src/Makefile.in $(distdir)/src 109 110distcheck: $(distdir).tar.gz 111 gzip -cd $(distdir).tar.gz | tar xvf - 112 cd $(distdir) && ./configure 113 cd $(distdir) && $(MAKE) all 114 cd $(distdir) && $(MAKE) check 115 cd $(distdir) && $(MAKE) DESTDIR=$${PWD}/_inst install 116 cd $(distdir) && $(MAKE) DESTDIR=$${PWD}/_inst uninstall 117 @remaining="`find $${PWD}/$(distdir)/_inst -type f | wc -l`"; \ 118 if test "$${remaining}" -ne 0; then 119 echo "@@@ $${remaining} file(s) remaining in stage directory!"; \ 120 exit 1; \ 121 fi 122 cd $(distdir) && $(MAKE) clean 123 rm -rf $(distdir) 124 @echo "*** Package $(distdir).tar.gz is ready for distribution" 125 126Makefile: $(srcdir)/Makefile.in ../../config.status 127 cd ../.. && ./config.status spec/example/Makefile 128 129configure.status: configure 130 cd ../.. && ./config.status --recheck 131 132.PHONY: clean 133 134depend: 135 (cd $(srcdir) ; awk 'BEGIN{P=1}{if(P)print}/^# Dependencies/{P=0}' Makefile.in > Makefile.in.new ) 136 (blddir=`pwd`; cd $(srcdir) ; gcc -MM -I. -I../../src -I"$$blddir"/../../src *.c | \ 137 sed -e "s? $$blddir/? ?g" \ 138 -e 's? \([a-z_-]*\)\.\([ch]\)? $$(srcdir)/\1.\2?g' \ 139 -e 's? \$$(srcdir)/\.\./\.\./src/config\.h? ../../src/config.h?g' \ 140 -e 's? $$(srcdir)/\.\./\.\./src/getdns/getdns_extra\.h? ../../src/getdns/getdns_extra.h?g' \ 141 -e 's? \.\./\.\./src/getdns/getdns_ext_libevent\.h? $$(srcdir)/../../src/getdns/getdns_ext_libevent.h?g' \ 142 -e 's? \.\./\.\./src/getdns/getdns_ext_libev\.h? $$(srcdir)/../../src/getdns/getdns_ext_libev.h?g' \ 143 -e 's? \.\./\.\./src/getdns/getdns_ext_libuv\.h? $$(srcdir)/../../src/getdns/getdns_ext_libuv.h?g' \ 144 -e 's? \.\./\.\./src/debug\.h? $$(srcdir)/../../src/debug.h?g' \ 145 -e 's!\(.*\)\.o[ :]*!\1.lo \1.o: !g' >> Makefile.in.new ) 146 (cd $(srcdir) ; diff Makefile.in.new Makefile.in && rm Makefile.in.new \ 147 || mv Makefile.in.new Makefile.in ) 148 149 150# Dependencies for the examples 151example-all-functions.lo example-all-functions.o: $(srcdir)/example-all-functions.c $(srcdir)/getdns_libevent.h \ 152 ../../src/config.h \ 153 ../../src/getdns/getdns.h \ 154 $(srcdir)/../../src/getdns/getdns_ext_libevent.h \ 155 ../../src/getdns/getdns_extra.h 156example-reverse.lo example-reverse.o: $(srcdir)/example-reverse.c $(srcdir)/getdns_libevent.h \ 157 ../../src/config.h \ 158 ../../src/getdns/getdns.h \ 159 $(srcdir)/../../src/getdns/getdns_ext_libevent.h \ 160 ../../src/getdns/getdns_extra.h 161example-simple-answers.lo example-simple-answers.o: $(srcdir)/example-simple-answers.c $(srcdir)/getdns_libevent.h \ 162 ../../src/config.h \ 163 ../../src/getdns/getdns.h \ 164 $(srcdir)/../../src/getdns/getdns_ext_libevent.h \ 165 ../../src/getdns/getdns_extra.h 166example-synchronous.lo example-synchronous.o: $(srcdir)/example-synchronous.c $(srcdir)/getdns_core_only.h \ 167 ../../src/getdns/getdns.h 168example-tree.lo example-tree.o: $(srcdir)/example-tree.c $(srcdir)/getdns_libevent.h \ 169 ../../src/config.h \ 170 ../../src/getdns/getdns.h \ 171 $(srcdir)/../../src/getdns/getdns_ext_libevent.h \ 172 ../../src/getdns/getdns_extra.h 173