Statistics
| Branch: | Tag: | Revision:

root / xseg / sys / user / Makefile @ 3b145fa0

History | View | Annotate | Download (6 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 xcache all
67

    
68
COMMA=,
69
_initialize.c: drivers
70
	$(BASE)/tools/create_initializer $(DRIVERS) > _initialize.c
71

    
72
xseg.o: $(BASE)/xseg/xseg.c $(BASE)/xseg/xseg.h $(BASE)/xtypes/xq.h
73
	$(CC) $(CFLAGS) $(INC) -c -o $@ $<
74

    
75
xseg.pic.o: $(BASE)/xseg/xseg.c $(BASE)/xseg/xseg.h _initialize.c
76
	$(CC) $(CFLAGS) $(INC) -fPIC -c -o $@ $<
77

    
78
libxseg.so: libxseg.so.$(MAJOR)
79
	ln -sf $< $@
80
	cp -vaf $@ $(LIB)
81

    
82
libxseg.so.$(MAJOR): libxseg.so.$(MAJOR).$(MINOR)
83
	ln -sf $< $@
84
	cp -vaf $@ $(LIB)
85

    
86
drivers:
87
	make -C $(DRVDIR) $(addsuffix .o, $(DRIVERS))
88

    
89
xq/xq.o:
90
	make -C xq xq.o
91

    
92
xq/xq.pic.o:
93
	make -C xq xq.pic.o
94

    
95
xpool/xpool.o:
96
	make -C xpool xpool.o
97

    
98
xpool/xpool.pic.o:
99
	make -C xpool xpool.pic.o
100

    
101
xhash/xhash.o:
102
	make -C xhash xhash.o
103

    
104
xhash/xhash.pic.o:
105
	make -C xhash xhash.pic.o
106

    
107
xheap/xheap.o:
108
	make -C xheap xheap.o
109

    
110
xheap/xheap.pic.o:
111
	make -C xheap xheap.pic.o
112

    
113
xobj/xobj.o:
114
	make -C xobj xobj.o
115

    
116
xobj/xobj.pic.o:
117
	make -C xobj xobj.pic.o
118

    
119
xworkq/xworkq.o:
120
	make -C xworkq xworkq.o
121

    
122
xworkq/xworkq.pic.o:
123
	make -C xworkq xworkq.pic.o
124

    
125
xwaitq/xwaitq.o:
126
	make -C xwaitq xwaitq.o
127

    
128
xwaitq/xwaitq.pic.o:
129
	make -C xwaitq xwaitq.pic.o
130

    
131
xcache/xcache.o:
132
	make -C xcache xcache.o
133

    
134
xcache/xcache.pic.o:
135
	make -C xcache xcache.pic.o
136

    
137
xseg_user.o: xseg_user.c
138
	$(CC) $(CFLAGS) $(INC) -Wall -O2 -finline-functions -fPIC -c -o $@ $<
139

    
140
libxseg.map: $(BASE)/xtypes/xq_exports.h $(BASE)/xseg/xseg_exports.h \
141
		$(BASE)/xtypes/xpool_exports.h $(BASE)/xtypes/xhash_exports.h\
142
		$(BASE)/xtypes/xobj_exports.h $(BASE)/xtypes/xworkq_exports.h\
143
		$(BASE)/xtypes/xwaitq_exports.h $(BASE)/xtypes/xcache_exports.h
144
	cat $(BASE)/xtypes/xq_exports.h $(BASE)/xseg/xseg_exports.h \
145
		$(BASE)/xtypes/xpool_exports.h $(BASE)/xtypes/xhash_exports.h \
146
		$(BASE)/xtypes/xobj_exports.h $(BASE)/xtypes/xworkq_exports.h \
147
		$(BASE)/xtypes/xwaitq_exports.h $(BASE)/xtypes/xcache_exports.h \
148
		| ./make_symbol_map.sh > $@
149

    
150
libxseg.so.$(MAJOR).$(MINOR): xseg.pic.o xseg_user.o libxseg.map \
151
				 xq/xq.pic.o xpool/xpool.pic.o xhash/xhash.pic.o \
152
				 xheap/xheap.pic.o xobj/xobj.pic.o \
153
				 xworkq/xworkq.pic.o xwaitq/xwaitq.pic.o \
154
				 xcache/xcache.pic.o $(DRVOBJS)
155
	$(CC) $(CFLAGS) -shared \
156
                        -Wl,-soname=libxseg.so.$(MAJOR) \
157
                        -o libxseg.so.$(MAJOR).$(MINOR) \
158
                        xseg.pic.o xseg_user.o xq/xq.pic.o \
159
			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 \
163
			 _initialize.o $(DRVOBJS) \
164
                        -Wl,--version-script=libxseg.map \
165
                        -ldl -lrt -pthread
166
	cp -vaf $@ $(LIB)
167

    
168
libxseg.a: xseg.o xq/xq.o drivers _initialize.o
169
	$(AR) r libxseg.a xseg.o xq/xq.o _initialize.o $(DRVOBJS)
170
	cp -vaf $@ $(LIB)
171

    
172
install:
173
	make -C python install
174
	install -d $(DESTDIR)$(libdir)
175
	#install -t $(DESTDIR)$(libdir) libxseg.so
176
	#install -t $(DESTDIR)$(libdir) libxseg.so.$(MAJOR)
177
	install -o 0 -g 0 -m 644 -t $(DESTDIR)$(libdir) libxseg.so.$(MAJOR).$(MINOR)
178
	cp -vaf libxseg.so.$(MAJOR) $(DESTDIR)$(libdir)
179
	cp -vaf libxseg.so $(DESTDIR)$(libdir)
180

    
181
install-src:
182
	make -C xq install-src
183
	make -C xpool install-src
184
	make -C xhash install-src
185
	make -C xheap install-src
186
	make -C xobj install-src
187
	make -C xworkq install-src
188
	make -C xwaitq install-src
189
	make -C xcache install-src
190
	make -C python install-src
191
	install -d $(DESTDIR)$(srcdir)$(SUBDIR) ;
192
	@for f in $(FILES) ; do \
193
		install -o 0 -g 0 -m 644 -t $(DESTDIR)$(srcdir)$(SUBDIR) $$f ; \
194
	done
195
	@for f in $(EFILES) ; do \
196
		install -o 0 -g 0 -m 755 -t $(DESTDIR)$(srcdir)$(SUBDIR) $$f ; \
197
	done
198

    
199

    
200
clean:
201
	make -C xq clean
202
	make -C xpool clean
203
	make -C xhash clean
204
	make -C xheap clean
205
	make -C xobj clean
206
	make -C xworkq clean
207
	make -C xwaitq clean
208
	make -C xcache clean
209
	make -C python clean
210
	rm -f _initialize.c _initialize.o
211
	rm -f xseg.o xseg.pic.o xseg_user.o
212
	rm -f libxseg.a libxseg.map
213
	rm -f libxseg.so libxseg.so.$(MAJOR) libxseg.so.$(MAJOR).$(MINOR)