Makefile revision 291767
1#
2# Makefile: compilation of pyUnbound and documentation, testing
3#
4# Copyright (c) 2009, Zdenek Vasicek (vasicek AT fit.vutbr.cz)
5#                     Marek Vavrusa  (xvavru00 AT stud.fit.vutbr.cz)
6#
7# This software is open source.
8# 
9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions
11# are met:
12# 
13#    * Redistributions of source code must retain the above copyright notice,
14#      this list of conditions and the following disclaimer.
15# 
16#    * Redistributions in binary form must reproduce the above copyright notice,
17#      this list of conditions and the following disclaimer in the documentation
18#      and/or other materials provided with the distribution.
19# 
20#    * Neither the name of the organization nor the names of its
21#      contributors may be used to endorse or promote products derived from this
22#      software without specific prior written permission.
23#
24# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
28# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34# POSSIBILITY OF SUCH DAMAGE.
35
36help:
37	@echo "Please use \`make <target>' where <target> is one of"
38	@echo "  testenv   to make test environment and run bash "
39	@echo "            usefull in case you don't want to install unbound but want to test examples"
40	@echo "  doc       to make documentation"
41	@echo "  clean     clean all"
42
43.PHONY: testenv clean doc swig
44
45#_unbound.so:	../../Makefile
46	#$(MAKE) -C ../..
47
48#../../.libs/libunbound.so.0:	../../Makefile
49	#$(MAKE) -C ../..
50
51clean:
52	rm -rdf examples/unbound
53	rm -f _unbound.so libunbound_wrap.o
54	$(MAKE) -C ../.. clean
55
56testenv: ../../.libs/libunbound.so.2 ../../.libs/_unbound.so
57	rm -rdf examples/unbound
58	cd examples && mkdir unbound && ln -s ../../unbound.py unbound/__init__.py && ln -s ../../_unbound.so unbound/_unbound.so && ln -s ../../../../.libs/libunbound.so.2 unbound/libunbound.so.2 && ls -la
59	cd examples && if test -f ../../../.libs/_unbound.so; then cp ../../../.libs/_unbound.so . ; fi
60	@echo "Run a script by typing ./script_name.py"
61	cd examples && LD_LIBRARY_PATH=unbound bash
62	rm -rdf examples/unbound examples/_unbound.so
63
64doc: ../../.libs/libunbound.so.0 _unbound.so
65	$(MAKE) -C docs html
66
67#for development only
68swig: libunbound.i 
69	swig -python -o libunbound_wrap.c -I../.. libunbound.i
70	gcc -c libunbound_wrap.c -O9 -fPIC -I../.. -I/usr/include/python2.5 -I. -o libunbound_wrap.o
71	gcc -shared libunbound_wrap.o -L../../.libs -lunbound -o _unbound.so 
72
73