1 # Copyright 2012 GRNET S.A. All rights reserved.
3 # Redistribution and use in source and binary forms, with or
4 # without modification, are permitted provided that the following
7 # 1. Redistributions of source code must retain the above
8 # copyright notice, this list of conditions and the following
11 # 2. Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following
13 # disclaimer in the documentation and/or other materials
14 # provided with the distribution.
16 # THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 # POSSIBILITY OF SUCH DAMAGE.
29 # The views and conclusions contained in the software and
30 # documentation are those of the authors and should not be
31 # interpreted as representing official policies, either expressed
32 # or implied, of GRNET S.A.
35 .PHONY: default all clean install install-src
37 include $(XSEG_HOME)/base.mk
40 FILES+=$(shell ls *.py)
42 SUBDIR:=$(subst $(XSEG_HOME),,$(CURDIR))
50 all: xseg/xseg_api.py xseg/xprotocol.py
51 if [ ! -e xseg/version.py ] ; then \
52 echo '__version__ = "'`devflow-version python`'"' > xseg/version.py ; \
56 $(BASE)/sys/user/libxseg.so:
57 make -C $(BASE)/sys/user libxseg.so
59 xseg.xml: $(BASE)/xseg/xseg.h $(BASE)/xtypes/xq.h $(BASE)/xtypes/xlock.h \
60 $(BASE)/xtypes/xpool.h $(BASE)/xtypes/xhash.h \
61 $(BASE)/xtypes/xheap.h $(BASE)/xtypes/xobj.h \
62 $(BASE)/sys/domain.h $(BASE)/sys/util.h $(BASE)/sys/user/_sysutil.h $(BASE)/xseg/protocol.h
63 $(H2XML) -c $(INC) -o $@ $(BASE)/xseg/xseg.h
66 $(H2XML) -c $(INC) -o $@ $(BASE)/xseg/protocol.h
68 xseg/xseg_api.py: xseg.xml
69 $(XML2PY) -d -k defst -l $(BASE)/lib/user/libxseg.so.$(MAJOR) -c $< -o $@
70 sed -i -e 's/xseg_get_data_nonstatic.restype = STRING/xseg_get_data_nonstatic.restype = POINTER(c_char)/g' xseg/xseg_api.py
71 sed -i -e 's/xseg_get_target_nonstatic.restype = STRING/xseg_get_target_nonstatic.restype = POINTER(c_char)/g' xseg/xseg_api.py
72 sed -i -e 's/xseg_get_signal_desc_nonstatic.restype = STRING/xseg_get_signal_desc_nonstatic.restype = POINTER(c_char)/g' xseg/xseg_api.py
73 sed -i -e 's/STRING = 1//g' xseg/xseg_api.py
74 sed -i -e 's,$(BASE)/lib/user/libxseg.so.$(MAJOR),libxseg.so.$(MAJOR),g' xseg/xseg_api.py
77 xseg/xprotocol.py: xprotocol.xml
78 $(XML2PY) -d -k defst -c $< -o $@
79 sed -i -e 's/xseg_reply_map_scatterlist \* 0/POINTER(xseg_reply_map_scatterlist)/g' xseg/xprotocol.py
83 if [ ! -e xseg/version.py ] ; then \
84 echo '__version__ = "'`devflow-version python`'"' > xseg/version.py ; \
86 python setup.py install --install-layout=deb --root=$(DESTDIR)
89 install -d $(DESTDIR)$(srcdir)$(SUBDIR) ;
90 @for f in $(FILES) ; do \
91 install -o 0 -g 0 -m 644 -t $(DESTDIR)$(srcdir)$(SUBDIR) $$f ; \
93 install -d $(DESTDIR)$(srcdir)$(SUBDIR)/xseg ;
94 install -o 0 -g 0 -m 644 -t $(DESTDIR)$(srcdir)$(SUBDIR)/xseg xseg/__init__.py ; \
99 rm -rf build/ xseg.egg-info/ xseg.xml xprotocol.xml xseg/xseg_api.py \
100 xseg/xseg_api.pyc xseg/xprotocol.py xseg/xprotocol.pyc \