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
10 # 2. Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following
12 # disclaimer in the documentation and/or other materials
13 # provided with the distribution.
15 # THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
16 # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
19 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
25 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 # POSSIBILITY OF SUCH DAMAGE.
28 # The views and conclusions contained in the software and
29 # documentation are those of the authors and should not be
30 # interpreted as representing official policies, either expressed
31 # or implied, of GRNET S.A.
34 .PHONY: default all clean drivers install install-src
36 include $(XSEG_HOME)/base.mk
39 FILES+=$(shell ls *.h)
40 FILES+=$(shell ls *.c)
42 EFILES+="make_symbol_map.sh"
44 SUBDIR:=$(subst $(XSEG_HOME),,$(CURDIR))
50 DRIVERS=xseg_posix xseg_segdev xseg_pthread
51 DRVDIR=$(BASE)/drivers/user
52 DRVOBJS=$(addsuffix .o, $(addprefix $(DRVDIR)/, $(DRIVERS)))
57 all: libxseg.a libxseg.so
58 make -C python all MAJOR=$(MAJOR) MINOR=$(MINOR)
66 _initialize.c: drivers
67 $(BASE)/tools/create_initializer $(DRIVERS) > _initialize.c
69 xseg.o: $(BASE)/xseg/xseg.c $(BASE)/xseg/xseg.h $(BASE)/xtypes/xq.h
70 $(CC) $(CFLAGS) $(INC) -c -o $@ $<
72 xseg.pic.o: $(BASE)/xseg/xseg.c $(BASE)/xseg/xseg.h _initialize.c
73 $(CC) $(CFLAGS) $(INC) -fPIC -c -o $@ $<
75 libxseg.so: libxseg.so.$(MAJOR)
79 libxseg.so.$(MAJOR): libxseg.so.$(MAJOR).$(MINOR)
84 make -C $(DRVDIR) $(addsuffix .o, $(DRIVERS))
96 make -C xpool xpool.pic.o
102 make -C xhash xhash.pic.o
105 make -C xheap xheap.o
108 make -C xheap xheap.pic.o
114 make -C xobj xobj.pic.o
116 xseg_user.o: xseg_user.c
117 $(CC) $(CFLAGS) $(INC) -Wall -O2 -finline-functions -fPIC -c -o $@ $<
119 libxseg.map: $(BASE)/xtypes/xq_exports.h $(BASE)/xseg/xseg_exports.h \
120 $(BASE)/xtypes/xpool_exports.h $(BASE)/xtypes/xhash_exports.h\
121 $(BASE)/xtypes/xobj_exports.h
122 cat $(BASE)/xtypes/xq_exports.h $(BASE)/xseg/xseg_exports.h \
123 $(BASE)/xtypes/xpool_exports.h $(BASE)/xtypes/xhash_exports.h \
124 $(BASE)/xtypes/xobj_exports.h | ./make_symbol_map.sh > $@
126 libxseg.so.$(MAJOR).$(MINOR): xseg.pic.o xseg_user.o libxseg.map \
127 xq/xq.pic.o xpool/xpool.pic.o xhash/xhash.pic.o \
128 xheap/xheap.pic.o xobj/xobj.pic.o $(DRVOBJS)
129 $(CC) $(CFLAGS) -shared \
130 -Wl,-soname=libxseg.so.$(MAJOR) \
131 -o libxseg.so.$(MAJOR).$(MINOR) \
132 xseg.pic.o xseg_user.o xq/xq.pic.o \
133 xpool/xpool.pic.o xhash/xhash.pic.o\
134 xheap/xheap.pic.o xobj/xobj.pic.o \
135 _initialize.o $(DRVOBJS) \
136 -Wl,--version-script=libxseg.map \
140 libxseg.a: xseg.o xq/xq.o drivers _initialize.o
141 $(AR) r libxseg.a xseg.o xq/xq.o _initialize.o $(DRVOBJS)
145 make -C python install
146 install -d $(DESTDIR)$(libdir)
147 #install -t $(DESTDIR)$(libdir) libxseg.so
148 #install -t $(DESTDIR)$(libdir) libxseg.so.$(MAJOR)
149 install -o 0 -g 0 -m 644 -t $(DESTDIR)$(libdir) libxseg.so.$(MAJOR).$(MINOR)
150 cp -vaf libxseg.so.$(MAJOR) $(DESTDIR)$(libdir)
151 cp -vaf libxseg.so $(DESTDIR)$(libdir)
154 make -C xq install-src
155 make -C xpool install-src
156 make -C xhash install-src
157 make -C xheap install-src
158 make -C xobj install-src
159 make -C python install-src
160 install -d $(DESTDIR)$(srcdir)$(SUBDIR) ;
161 @for f in $(FILES) ; do \
162 install -o 0 -g 0 -m 644 -t $(DESTDIR)$(srcdir)$(SUBDIR) $$f ; \
164 @for f in $(EFILES) ; do \
165 install -o 0 -g 0 -m 755 -t $(DESTDIR)$(srcdir)$(SUBDIR) $$f ; \
176 rm -f _initialize.c _initialize.o
177 rm -f xseg.o xseg.pic.o xseg_user.o
178 rm -f libxseg.a libxseg.map
179 rm -f libxseg.so libxseg.so.$(MAJOR) libxseg.so.$(MAJOR).$(MINOR)