Statistics
| Branch: | Revision:

root / xseg / sys / user / Makefile @ 164d1586

History | View | Annotate | Download (2.2 kB)

1
.PHONY: default all clean drivers
2

    
3
include $(XSEG_HOME)/base.mk
4

    
5
MAJOR=0
6
MINOR=0.1
7
AR=ar
8

    
9
DRIVERS=xseg_posix xseg_segdev
10
DRVDIR=$(BASE)/drivers/user
11
DRVOBJS=$(addsuffix .o, $(addprefix $(DRVDIR)/, $(DRIVERS)))
12
SHELL=/bin/bash
13

    
14
default: all
15

    
16
all: libxseg.a libxseg.so
17
	make -C xq all
18
	make -C python all
19

    
20
COMMA=,
21
_initialize.c: drivers
22
	$(BASE)/tools/create_initializer $(DRIVERS) > _initialize.c
23

    
24
xseg.o: $(BASE)/xseg/xseg.c $(BASE)/xseg/xseg.h $(BASE)/xtypes/xq.h
25
	$(CC) $(CFLAGS) $(INC) -c -o $@ $<
26

    
27
xseg.pic.o: $(BASE)/xseg/xseg.c $(BASE)/xseg/xseg.h _initialize.c
28
	$(CC) $(CFLAGS) $(INC) -fPIC -c -o $@ $<
29

    
30
libxseg.so: libxseg.so.$(MAJOR)
31
	ln -sf $< $@
32
	cp -vaf $@ $(LIB)
33

    
34
libxseg.so.$(MAJOR): libxseg.so.$(MAJOR).$(MINOR)
35
	ln -sf $< $@
36
	cp -vaf $@ $(LIB)
37

    
38
drivers:
39
	make -C $(DRVDIR) $(addsuffix .o, $(DRIVERS))
40

    
41
xq/xq.o:
42
	make -C xq xq.o
43

    
44
xq/xq.pic.o:
45
	make -C xq xq.pic.o
46

    
47
xpool/xpool.o:
48
	make -C xpool xpool.o
49

    
50
xpool/xpool.pic.o:
51
	make -C xpool xpool.pic.o
52

    
53
xhash/xhash.o:
54
	make -C xhash xhash.o
55

    
56
xhash/xhash.pic.o:
57
	make -C xhash xhash.pic.o
58
xseg_user.o: xseg_user.c
59
	$(CC) $(CFLAGS) $(INC) -Wall -O2 -finline-functions -fPIC -c -o $@ $<
60

    
61
libxseg.map: $(BASE)/xtypes/xq_exports.h $(BASE)/xseg/xseg_exports.h
62
	cat $(BASE)/xtypes/xq_exports.h $(BASE)/xseg/xseg_exports.h | ./make_symbol_map.sh > $@
63

    
64
libxseg.so.$(MAJOR).$(MINOR): xseg.pic.o xseg_user.o libxseg.map \
65
				 xq/xq.pic.o xpool/xpool.pic.o xhash/xhash.pic.o $(DRVOBJS)
66
	$(CC) $(CFLAGS) -shared \
67
                        -Wl,-soname=libxseg.so.$(MAJOR) \
68
                        -o libxseg.so.$(MAJOR).$(MINOR) \
69
                        xseg.pic.o xseg_user.o xq/xq.pic.o \
70
			xpool/xpool.pic.o xhash/xhash.pic.o\
71
			 _initialize.o $(DRVOBJS) \
72
                        -Wl,--version-script=libxseg.map \
73
                        -ldl -lrt
74
	cp -vaf $@ $(LIB)
75

    
76
libxseg.a: xseg.o xq/xq.o drivers _initialize.o
77
	$(AR) r libxseg.a xseg.o xq/xq.o _initialize.o $(DRVOBJS)
78
	cp -vaf $@ $(LIB)
79

    
80
clean:
81
	make -C xq clean
82
	make -C xpool clean
83
	make -C xhash clean
84
	make -C python clean
85
	rm -f _initialize.c _initialize.o
86
	rm -f xseg.o xseg.pic.o xseg_user.o
87
	rm -f libxseg.a libxseg.map
88
	rm -f libxseg.so libxseg.so.$(MAJOR) libxseg.so.$(MAJOR).$(MINOR)