aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxutil/Makefile
blob: ec453f1af8596958ca48447ec4c4040ffc6fc1ba (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
XEN_ROOT = ../..
include $(XEN_ROOT)/tools/Make.defs

CC = gcc

LIB_SRCS :=
LIB_SRCS += allocate.c
LIB_SRCS += file_stream.c
LIB_SRCS += gzip_stream.c
LIB_SRCS += iostream.c
#LIB_SRCS += sys_net.c
LIB_SRCS += sys_string.c

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

CFLAGS   += -Wall
CFLAGS   += -Werror
CFLAGS   += -g
CFLAGS   += -O3
CFLAGS   += -fno-strict-aliasing

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

MAJOR    := 1.3
MINOR    := 0
LIB_NAME := libxutil
LIB      := $(LIB_NAME).so 
LIB      += $(LIB_NAME).so.$(MAJOR)
LIB      += $(LIB_NAME).so.$(MAJOR).$(MINOR)

all: check-for-zlib $(LIB)

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

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

$(LIB_NAME).so.$(MAJOR).$(MINOR): $(LIB_OBJS)
	$(CC) -Wl,-soname -Wl,$(LIB_NAME).so.$(MAJOR) -shared -o $@ $^

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

install: all
	mkdir -p $(prefix)/usr/lib
	install -m0755 $(LIB) $(prefix)/usr/lib
	ln -sf $(LIB_NAME).so.$(MAJOR).$(MINOR) $(prefix)/usr/lib/$(LIB_NAME).so.$(MAJOR)
	ln -sf $(LIB_NAME).so.$(MAJOR) $(prefix)/usr/lib/$(LIB_NAME).so

clean:
	$(RM) *.a *.so *.so.* *.o *.rpm 
	$(RM) *~
	$(RM) $(DEPS)

-include $(DEPS)