blob: 17088021160952602c95c3183145a2042cf7af3d (
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
|
INSTALL = install
INSTALL_PROG = $(INSTALL) -m0755
INSTALL_DATA = $(INSTALL) -m0644
INSTALL_DIR = $(INSTALL) -d -m0755
MAJOR = 3.0
MINOR = 0
CC = gcc
XEN_ROOT = ../../..
include $(XEN_ROOT)/tools/Rules.mk
SRCS := xendebug.c
CFLAGS += -Werror -O3 -fno-strict-aliasing
CFLAGS += $(INCLUDES) -I. -I$(XEN_ROOT)/tools/libxc
# Get gcc to generate the dependencies for us.
CFLAGS += -Wp,-MD,.$(@F).d
DEPS = .*.d
LDFLAGS += -L$(XEN_ROOT)/tools/libxc -lxenctrl
LIB_OBJS := $(patsubst %.c,%.o,$(SRCS))
PIC_OBJS := $(patsubst %.c,%.opic,$(SRCS))
LIB := libxendebug.a libxendebug.so
LIB += libxendebug.so.$(MAJOR) libxendebug.so.$(MAJOR).$(MINOR)
all: build
build:
$(MAKE) $(LIB)
install: build
[ -d $(DESTDIR)/usr/$(LIBDIR) ] || $(INSTALL_DIR) $(DESTDIR)/usr/$(LIBDIR)
[ -d $(DESTDIR)/usr/include ] || $(INSTALL_DIR) $(DESTDIR)/usr/include
$(INSTALL_PROG) libxendebug.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)
$(INSTALL_DATA) libxendebug.a $(DESTDIR)/usr/$(LIBDIR)
ln -sf libxendebug.so.$(MAJOR).$(MINOR) $(DESTDIR)/usr/$(LIBDIR)/libxendebug.so.$(MAJOR)
ln -sf libxendebug.so.$(MAJOR) $(DESTDIR)/usr/$(LIBDIR)/libxendebug.so
$(INSTALL_DATA) xendebug.h $(DESTDIR)/usr/include
.PHONY: TAGS clean rpm install all
TAGS:
etags -t $(SRCS) *.h
clean:
rm -rf *.a *.so* *.o *.opic *.rpm $(LIB) *~ $(DEPS) xen
rpm: build
rm -rf staging
mkdir staging
mkdir staging/i386
rpmbuild --define "staging$$PWD/staging" --define '_builddir.' \
--define "_rpmdir$$PWD/staging" -bb rpm.spec
mv staging/i386/*.rpm .
rm -rf staging
libxendebug.a: $(LIB_OBJS)
$(AR) rc $@ $^
libxendebug.so: libxendebug.so.$(MAJOR)
ln -sf $< $@
libxendebug.so.$(MAJOR): libxendebug.so.$(MAJOR).$(MINOR)
ln -sf $< $@
libxendebug.so.$(MAJOR).$(MINOR): $(PIC_OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxendebug.so.$(MAJOR) -shared -o $@ $^
-include $(DEPS)
|