1 # Makefile: compilation of sources and documentation, test environment
3 # Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
4 # Karel Slany (slany AT fit.vutbr.cz)
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions are met:
10 # * Redistributions of source code must retain the above copyright notice,
11 # this list of conditions and the following disclaimer.
12 # * Redistributions in binary form must reproduce the above copyright
13 # notice, this list of conditions and the following disclaimer in the
14 # documentation and/or other materials provided with the distribution.
15 # * Neither the name of the organization nor the names of its
16 # contributors may be used to endorse or promote products derived from this
17 # software without specific prior written permission.
19 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
23 # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
32 .PHONY: help clean testenv test doc te bw bw3 sw sw3
35 @echo "Please use \`make <target>' where <target> is one of"
36 @echo " testenv to make test environment and run bash "
37 @echo " usefull in case you don't want to install ldns but want to test examples"
38 @echo " doc to make documentation"
39 @echo " clean clean all"
41 ../../Makefile: ../../configure
42 cd ../.. && ./configure --with-python
44 _ldns.so: ../../Makefile
47 ../../.libs/libldns.so.1: ../../Makefile
52 rm -f _ldns.so ldns_wrapper.o
53 $(MAKE) -C ../.. clean
55 testenv: ../../.libs/libldns.so.1 _ldns.so
57 cd examples && mkdir ldns && ln -s ../../ldns.py ldns/__init__.py && ln -s ../../../../.libs/_ldns.so ldns/_ldns.so && ln -s ../../../../.libs/libldns.so.1 ldns/libldns.so.1 && ls -la
58 @echo "Run a script by typing ./script_name.py"
59 cd examples && LD_LIBRARY_PATH=ldns bash
62 test: ../../.libs/libldns.so.1 _ldns.so examples/test_buffer.py examples/test_rdf.py examples/test_dname.py examples/test_rr.py
64 @cd examples && mkdir ldns && ln -s ../../ldns.py ldns/__init__.py && ln -s ../../../../.libs/_ldns.so ldns/_ldns.so && ln -s ../../../../.libs/libldns.so.1 ldns/libldns.so.1
65 @cd examples && LD_LIBRARY_PATH=ldns ./test_buffer.py 2>/dev/null
66 @cd examples && LD_LIBRARY_PATH=ldns ./test_rdf.py 2>/dev/null
67 @cd examples && LD_LIBRARY_PATH=ldns ./test_dname.py 2>/dev/null
68 @cd examples && LD_LIBRARY_PATH=ldns ./test_rr.py 2>/dev/null
71 doc: ../../.libs/libldns.so.1 _ldns.so
74 ln -s ../../.libs/_ldns.so
78 # For development only:
80 # Test environment, does not build the wrapper from dependencies.
83 cd examples && mkdir ldns && ln -s ../../ldns.py ldns/__init__.py && ln -s ../../../../.libs/_ldns.so ldns/_ldns.so && ln -s ../../../../.libs/libldns.so.1 ldns/libldns.so.1 && ls -la
84 @echo "Run a script by typing ./script_name.py"
85 cd examples && LD_LIBRARY_PATH=ldns bash
88 # Builds Python 2 wrapper from present wrapper C code.
90 gcc -c ldns_wrapper.c -O9 -fPIC -I../.. -I../../ldns -I/usr/include/python2.7 -I. -o ldns_wrapper.o
92 ld -shared ldns_wrapper.o -L../../.libs -lldns -o ../../.libs/_ldns.so
94 # Builds Python 3 wrapper from present wrapper C code.
96 gcc -c ldns_wrapper.c -O9 -fPIC -I../.. -I../../ldns -I/usr/include/python3.2 -I. -o ldns_wrapper.o
98 ld -shared ldns_wrapper.o -L../../.libs -ldns -o ../../.libs/_ldns.so
100 # Builds Python 2 wrapper from interface file.
102 swig -python -o ldns_wrapper.c -I../.. ldns.i
105 # Builds Python 3 wrapper from interface file.
107 swig -python -py3 -DPY3 -o ldns_wrapper.c -I../.. ldns.i