root / xseg / sys / user / Makefile @ 7cf0125c
History | View | Annotate | Download (6.3 kB)
1 |
# Copyright 2012 GRNET S.A. All rights reserved. |
---|---|
2 |
# |
3 |
# Redistribution and use in source and binary forms, with or |
4 |
# without modification, are permitted provided that the following |
5 |
# conditions are met: |
6 |
# |
7 |
# 1. Redistributions of source code must retain the above |
8 |
# copyright notice, this list of conditions and the following |
9 |
# disclaimer. |
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. |
14 |
# |
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. |
27 |
# |
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. |
32 |
# |
33 |
|
34 |
.PHONY: default all clean drivers install install-src |
35 |
|
36 |
include $(XSEG_HOME)/base.mk |
37 |
|
38 |
FILES="Makefile" |
39 |
FILES+=$(shell ls *.h) |
40 |
FILES+=$(shell ls *.c) |
41 |
|
42 |
EFILES+="make_symbol_map.sh" |
43 |
|
44 |
SUBDIR:=$(subst $(XSEG_HOME),,$(CURDIR)) |
45 |
|
46 |
MAJOR=0 |
47 |
MINOR=2 |
48 |
AR=ar |
49 |
|
50 |
DRIVERS=xseg_posix xseg_segdev xseg_pthread |
51 |
DRVDIR=$(BASE)/drivers/user |
52 |
DRVOBJS=$(addsuffix .o, $(addprefix $(DRVDIR)/, $(DRIVERS))) |
53 |
SHELL=/bin/bash |
54 |
|
55 |
default: all |
56 |
|
57 |
all: libxseg.a libxseg.so |
58 |
make -C python all MAJOR=$(MAJOR) MINOR=$(MINOR) |
59 |
make -C xq all |
60 |
make -C xpool all |
61 |
make -C xhash all |
62 |
make -C xheap all |
63 |
make -C xobj all |
64 |
make -C xworkq all |
65 |
make -C xwaitq all |
66 |
make -C xbinheap all |
67 |
make -C xcache all |
68 |
|
69 |
COMMA=, |
70 |
_initialize.c: drivers |
71 |
$(BASE)/tools/create_initializer $(DRIVERS) > _initialize.c |
72 |
|
73 |
xseg.o: $(BASE)/xseg/xseg.c $(BASE)/xseg/xseg.h $(BASE)/xtypes/xq.h |
74 |
$(CC) $(CFLAGS) $(INC) -c -o $@ $< |
75 |
|
76 |
xseg.pic.o: $(BASE)/xseg/xseg.c $(BASE)/xseg/xseg.h _initialize.c |
77 |
$(CC) $(CFLAGS) $(INC) -fPIC -c -o $@ $< |
78 |
|
79 |
libxseg.so: libxseg.so.$(MAJOR) |
80 |
ln -sf $< $@ |
81 |
cp -vaf $@ $(LIB) |
82 |
|
83 |
libxseg.so.$(MAJOR): libxseg.so.$(MAJOR).$(MINOR) |
84 |
ln -sf $< $@ |
85 |
cp -vaf $@ $(LIB) |
86 |
|
87 |
drivers: |
88 |
make -C $(DRVDIR) $(addsuffix .o, $(DRIVERS)) |
89 |
|
90 |
xq/xq.o: |
91 |
make -C xq xq.o |
92 |
|
93 |
xq/xq.pic.o: |
94 |
make -C xq xq.pic.o |
95 |
|
96 |
xpool/xpool.o: |
97 |
make -C xpool xpool.o |
98 |
|
99 |
xpool/xpool.pic.o: |
100 |
make -C xpool xpool.pic.o |
101 |
|
102 |
xhash/xhash.o: |
103 |
make -C xhash xhash.o |
104 |
|
105 |
xhash/xhash.pic.o: |
106 |
make -C xhash xhash.pic.o |
107 |
|
108 |
xheap/xheap.o: |
109 |
make -C xheap xheap.o |
110 |
|
111 |
xheap/xheap.pic.o: |
112 |
make -C xheap xheap.pic.o |
113 |
|
114 |
xobj/xobj.o: |
115 |
make -C xobj xobj.o |
116 |
|
117 |
xobj/xobj.pic.o: |
118 |
make -C xobj xobj.pic.o |
119 |
|
120 |
xworkq/xworkq.o: |
121 |
make -C xworkq xworkq.o |
122 |
|
123 |
xworkq/xworkq.pic.o: |
124 |
make -C xworkq xworkq.pic.o |
125 |
|
126 |
xwaitq/xwaitq.o: |
127 |
make -C xwaitq xwaitq.o |
128 |
|
129 |
xwaitq/xwaitq.pic.o: |
130 |
make -C xwaitq xwaitq.pic.o |
131 |
|
132 |
xcache/xcache.o: |
133 |
make -C xcache xcache.o |
134 |
|
135 |
xcache/xcache.pic.o: |
136 |
make -C xcache xcache.pic.o |
137 |
|
138 |
xbinheap/xbinheap.o: |
139 |
make -C xbinheap xbinheap.o |
140 |
|
141 |
xbinheap/xbinheap.pic.o: |
142 |
make -C xbinheap xbinheap.pic.o |
143 |
|
144 |
xseg_user.o: xseg_user.c |
145 |
$(CC) $(CFLAGS) $(INC) -Wall -O2 -finline-functions -fPIC -c -o $@ $< |
146 |
|
147 |
libxseg.map: $(BASE)/xtypes/xq_exports.h $(BASE)/xseg/xseg_exports.h \ |
148 |
$(BASE)/xtypes/xpool_exports.h $(BASE)/xtypes/xhash_exports.h\ |
149 |
$(BASE)/xtypes/xobj_exports.h $(BASE)/xtypes/xworkq_exports.h\ |
150 |
$(BASE)/xtypes/xwaitq_exports.h $(BASE)/xtypes/xcache_exports.h \ |
151 |
$(BASE)/xtypes/xbinheap_exports.h |
152 |
cat $(BASE)/xtypes/xq_exports.h $(BASE)/xseg/xseg_exports.h \ |
153 |
$(BASE)/xtypes/xpool_exports.h $(BASE)/xtypes/xhash_exports.h \ |
154 |
$(BASE)/xtypes/xobj_exports.h $(BASE)/xtypes/xworkq_exports.h \ |
155 |
$(BASE)/xtypes/xwaitq_exports.h $(BASE)/xtypes/xcache_exports.h \ |
156 |
$(BASE)/xtypes/xbinheap_exports.h | ./make_symbol_map.sh > $@ |
157 |
|
158 |
libxseg.so.$(MAJOR).$(MINOR): xseg.pic.o xseg_user.o libxseg.map \ |
159 |
xq/xq.pic.o xpool/xpool.pic.o xhash/xhash.pic.o \ |
160 |
xheap/xheap.pic.o xobj/xobj.pic.o \ |
161 |
xworkq/xworkq.pic.o xwaitq/xwaitq.pic.o \ |
162 |
xcache/xcache.pic.o xbinheap/xbinheap.pic.o $(DRVOBJS) |
163 |
$(CC) $(CFLAGS) -shared \ |
164 |
-Wl,-soname=libxseg.so.$(MAJOR) \ |
165 |
-o libxseg.so.$(MAJOR).$(MINOR) \ |
166 |
xseg.pic.o xseg_user.o xq/xq.pic.o \ |
167 |
xpool/xpool.pic.o xhash/xhash.pic.o\ |
168 |
xheap/xheap.pic.o xobj/xobj.pic.o \ |
169 |
xworkq/xworkq.pic.o xwaitq/xwaitq.pic.o \ |
170 |
xcache/xcache.pic.o xbinheap/xbinheap.pic.o \ |
171 |
_initialize.o $(DRVOBJS) \ |
172 |
-Wl,--version-script=libxseg.map \ |
173 |
-ldl -lrt -pthread |
174 |
cp -vaf $@ $(LIB) |
175 |
|
176 |
libxseg.a: xseg.o xq/xq.o drivers _initialize.o |
177 |
$(AR) r libxseg.a xseg.o xq/xq.o _initialize.o $(DRVOBJS) |
178 |
cp -vaf $@ $(LIB) |
179 |
|
180 |
install: |
181 |
make -C python install |
182 |
install -d $(DESTDIR)$(libdir) |
183 |
#install -t $(DESTDIR)$(libdir) libxseg.so |
184 |
#install -t $(DESTDIR)$(libdir) libxseg.so.$(MAJOR) |
185 |
install -o 0 -g 0 -m 644 -t $(DESTDIR)$(libdir) libxseg.so.$(MAJOR).$(MINOR) |
186 |
cp -vaf libxseg.so.$(MAJOR) $(DESTDIR)$(libdir) |
187 |
cp -vaf libxseg.so $(DESTDIR)$(libdir) |
188 |
|
189 |
install-src: |
190 |
make -C xq install-src |
191 |
make -C xpool install-src |
192 |
make -C xhash install-src |
193 |
make -C xheap install-src |
194 |
make -C xobj install-src |
195 |
make -C xworkq install-src |
196 |
make -C xwaitq install-src |
197 |
make -C xbinheap install-src |
198 |
make -C xcache install-src |
199 |
make -C python install-src |
200 |
install -d $(DESTDIR)$(srcdir)$(SUBDIR) ; |
201 |
@for f in $(FILES) ; do \ |
202 |
install -o 0 -g 0 -m 644 -t $(DESTDIR)$(srcdir)$(SUBDIR) $$f ; \ |
203 |
done |
204 |
@for f in $(EFILES) ; do \ |
205 |
install -o 0 -g 0 -m 755 -t $(DESTDIR)$(srcdir)$(SUBDIR) $$f ; \ |
206 |
done |
207 |
|
208 |
|
209 |
clean: |
210 |
make -C xq clean |
211 |
make -C xpool clean |
212 |
make -C xhash clean |
213 |
make -C xheap clean |
214 |
make -C xobj clean |
215 |
make -C xworkq clean |
216 |
make -C xwaitq clean |
217 |
make -C xbinheap clean |
218 |
make -C xcache clean |
219 |
make -C python clean |
220 |
rm -f _initialize.c _initialize.o |
221 |
rm -f xseg.o xseg.pic.o xseg_user.o |
222 |
rm -f libxseg.a libxseg.map |
223 |
rm -f libxseg.so libxseg.so.$(MAJOR) libxseg.so.$(MAJOR).$(MINOR) |