aboutsummaryrefslogtreecommitdiffstats
path: root/tools/vnet/libxutil/Makefile
blob: 3d490f097187f56ffadfafb81e16e870e92266c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
ifndef VNET_ROOT
export VNET_ROOT = $(shell cd .. && pwd)
include $(VNET_ROOT)/Make.env
endif

include $(XEN_ROOT)/tools/Rules.mk

LIB_SRCS :=
LIB_SRCS += allocate.c
LIB_SRCS += enum.c
LIB_SRCS += file_stream.c
#LIB_SRCS += gzip_stream.c
LIB_SRCS += hash_table.c
LIB_SRCS += iostream.c
LIB_SRCS += lexis.c
LIB_SRCS += mem_stream.c
LIB_SRCS += string_stream.c
LIB_SRCS += sxpr.c
LIB_SRCS += sxpr_parser.c
LIB_SRCS += sys_net.c
LIB_SRCS += sys_string.c
LIB_SRCS += util.c

LIB_OBJS := $(LIB_SRCS:.c=.o)
PIC_OBJS := $(LIB_SRCS:.c=.opic)

CFLAGS   += -Werror -fno-strict-aliasing $(call cc-option,$(CC),-fgnu89-inline,)
CFLAGS   += -O3
#CFLAGS   += -g

# Get gcc to generate the dependencies for us.
CFLAGS   += -Wp,-MD,.$(@F).d
DEPS     = .*.d

MAJOR    := 3.0
MINOR    := 0
LIB      := libxutil.so 
LIB      += libxutil.so.$(MAJOR)
LIB      += libxutil.so.$(MAJOR).$(MINOR)
LIB      += libxutil.a

.PHONY: all
all: build

.PHONY: build
build: #check-for-zlib
	$(MAKE) $(LIB)

gzip_stream.o: check-for-zlib

libxutil.so: libxutil.so.$(MAJOR)
	ln -sf $^ $@

libxutil.so.$(MAJOR): libxutil.so.$(MAJOR).$(MINOR)
	ln -sf $^ $@

libxutil.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
	$(CC) $(CFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libxutil.so.$(MAJOR) $(SHLIB_CFLAGS) -o $@ $^

libxutil.a: $(LIB_OBJS)
	$(AR) rc $@ $^

.PHONY: check-for-zlib
check-for-zlib:
	@if [ ! -e /usr/include/zlib.h ]; then \
	echo "***********************************************************"; \
	echo "ERROR: install zlib header files (http://www.gzip.org/zlib)"; \
	echo "***********************************************************"; \
	false; \
	fi

.PHONY: install
install: build
	[ -d $(DESTDIR)/usr/$(LIBDIR) ] || $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
	$(INSTALL_PROG) libxutil.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
	$(INSTALL_DATA) libxutil.a $(DESTDIR)/usr/$(LIBDIR)
	ln -sf libxutil.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxutil.so.$(MAJOR)
	ln -sf libxutil.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxutil.so

.PHONY: clean
clean:
	-@$(RM) *.a *.so* *.o *.opic *.rpm 
	-@$(RM) *~
	-@$(RM) $(DEPS)

-include $(DEPS)