~ubuntu-branches/ubuntu/raring/xen/raring-proposed

« back to all changes in this revision

Viewing changes to .pc/tools-libxl-prefix.diff/tools/libxl/Makefile

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-11-08 12:14:30 UTC
  • mfrom: (4.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20121108121430-o2nyj85dsqx15qx1
Tags: 4.2.0-1ubuntu1
* Merge from Debian Experimental, Remaining changes:
  - debian/control:
    - Build depends on ipxe-qemu.
    - libxenstore3.0: Conflict and replaces libxen3.
    - libxen-dev: Conflict and replaces libxen3-dev.
    - xenstore-utils: Conflict and replaces libxen3
    - xen-utils-4.1: Conflict and replaces libxen3, python-xen-3.3,
      and xen-utils-4.1.
    - Make sure the LDFLAGS value passed is suitable for use by ld
      rather than gcc.
  - disable debian/patches/config-etherboot.diff.
  - debian/patches/silence-gcc-warnings.patch: Silence gcc warnings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
XEN_ROOT = $(CURDIR)/../..
6
6
include $(XEN_ROOT)/tools/Rules.mk
7
7
 
8
 
CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations
 
8
CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations \
 
9
        -Wno-declaration-after-statement -Wformat-nonliteral
9
10
CFLAGS += -I. -fPIC
10
 
CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
11
11
 
12
 
LDLIBS_XL =  $(LDLIBS_libxenctrl)
13
 
LDLIBS_XL += -Wl,-rpath-link,$(XEN_LIBXC),-rpath-link,$(XEN_XENSTORE) $(LDRPATH_libblktapctl)
14
 
LDLIBS_LIBXL = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl)
15
12
ifeq ($(CONFIG_Linux),y)
16
 
LDLIBS_XL += -luuid
17
 
LDLIBS_LIBXL += -lutil
 
13
LIBUUID_LIBS += -luuid
18
14
endif
19
15
 
 
16
LIBXL_LIBS =
 
17
LIBXL_LIBS = $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenstore) $(LDLIBS_libblktapctl) $(PTYFUNCS_LIBS) $(LIBUUID_LIBS)
 
18
 
 
19
CFLAGS += $(PTHREAD_CFLAGS)
 
20
LDFLAGS += $(PTHREAD_LDFLAGS)
 
21
LIBXL_LIBS += $(PTHREAD_LIBS)
 
22
 
 
23
LIBXLU_LIBS =
 
24
 
20
25
LIBXL_OBJS-y = osdeps.o libxl_paths.o libxl_bootloader.o flexarray.o
21
26
ifeq ($(LIBXL_BLKTAP),y)
22
27
LIBXL_OBJS-y += libxl_blktap2.o
23
28
else
24
29
LIBXL_OBJS-y += libxl_noblktap2.o
25
30
endif
26
 
LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o
27
 
LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o
 
31
LIBXL_OBJS-$(CONFIG_X86) += libxl_cpuid.o libxl_x86.o
 
32
LIBXL_OBJS-$(CONFIG_IA64) += libxl_nocpuid.o libxl_noarch.o
 
33
LIBXL_OBJS-$(CONFIG_ARM) += libxl_nocpuid.o libxl_noarch.o
 
34
 
 
35
ifeq ($(CONFIG_NetBSD),y)
 
36
LIBXL_OBJS-y += libxl_netbsd.o
 
37
else
 
38
ifeq ($(CONFIG_Linux),y)
 
39
LIBXL_OBJS-y += libxl_linux.o
 
40
else
 
41
$(error Your Operating System is not supported by libxenlight, \
 
42
please check libxl_linux.c and libxl_netbsd.c to see how to get it ported)
 
43
endif
 
44
endif
 
45
 
 
46
ifeq ($(FLEX),)
 
47
%.c %.h:: %.l
 
48
        $(warning Flex is needed to rebuild some libxl parsers and \
 
49
                  scanners, please install it and rerun configure)
 
50
endif
 
51
 
 
52
ifeq ($(BISON),)
 
53
%.c %.h:: %.y
 
54
        $(warning Bison is needed to rebuild some libxl parsers and \
 
55
                  scanners, please install it an rerun configure)
 
56
endif
 
57
 
 
58
LIBXL_LIBS += -lyajl
28
59
 
29
60
LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
30
61
                        libxl_dom.o libxl_exec.o libxl_xshelp.o libxl_device.o \
31
 
                        libxl_internal.o libxl_utils.o $(LIBXL_OBJS-y)
32
 
LIBXL_OBJS += _libxl_types.o
33
 
 
34
 
AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h
 
62
                        libxl_internal.o libxl_utils.o libxl_uuid.o \
 
63
                        libxl_json.o libxl_aoutils.o libxl_numa.o \
 
64
                        libxl_save_callout.o _libxl_save_msgs_callout.o \
 
65
                        libxl_qmp.o libxl_event.o libxl_fork.o $(LIBXL_OBJS-y)
 
66
LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 
67
 
 
68
$(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) -include $(XEN_ROOT)/tools/config.h
 
69
 
 
70
AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h _libxl_list.h _paths.h \
 
71
        _libxl_save_msgs_callout.h _libxl_save_msgs_helper.h \
 
72
        libxl.api-ok
35
73
AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c
36
 
LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o
37
 
 
38
 
XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o
 
74
AUTOSRCS += _libxl_save_msgs_callout.c _libxl_save_msgs_helper.c
 
75
LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o \
 
76
        libxlu_disk_l.o libxlu_disk.o libxlu_vif.o libxlu_pci.o
 
77
$(LIBXLU_OBJS): CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h
 
78
 
 
79
CLIENTS = xl testidl libxl-save-helper
 
80
 
 
81
XL_OBJS = xl.o xl_cmdimpl.o xl_cmdtable.o xl_sxp.o
 
82
$(XL_OBJS) _libxl.api-for-check: \
 
83
            CFLAGS += $(CFLAGS_libxenctrl) # For xentoollog.h
 
84
$(XL_OBJS): CFLAGS += $(CFLAGS_libxenlight)
 
85
$(XL_OBJS): CFLAGS += -include $(XEN_ROOT)/tools/config.h # libxl_json.h needs it.
 
86
 
 
87
SAVE_HELPER_OBJS = libxl_save_helper.o _libxl_save_msgs_helper.o
 
88
$(SAVE_HELPER_OBJS): CFLAGS += $(CFLAGS_libxenctrl)
 
89
 
 
90
testidl.o: CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenlight)
 
91
testidl.c: libxl_types.idl gentest.py libxl.h $(AUTOINCS)
 
92
        $(PYTHON) gentest.py libxl_types.idl testidl.c.new
 
93
        mv testidl.c.new testidl.c
39
94
 
40
95
.PHONY: all
41
 
all: xl libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
 
96
all: $(CLIENTS) libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
42
97
        $(AUTOSRCS) $(AUTOINCS)
43
98
 
44
 
$(LIBXLU_OBJS): $(AUTOINCS)
 
99
$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS): $(AUTOINCS)
45
100
 
46
 
%.c %.h: %.y
 
101
%.c %.h:: %.y
47
102
        @rm -f $*.[ch]
48
103
        $(BISON) --output=$*.c $<
49
104
 
50
 
%.c %.h: %.l
 
105
%.c %.h:: %.l
51
106
        @rm -f $*.[ch]
52
107
        $(FLEX) --header-file=$*.h --outfile=$*.c $<
53
108
 
54
 
genpath-target = $(call buildmakevars2file,_libxl_paths.h.tmp)
 
109
genpath-target = $(call buildmakevars2file,_paths.h.tmp)
55
110
$(eval $(genpath-target))
56
111
 
57
 
_libxl_paths.h: genpath
 
112
libxl.api-ok: check-libxl-api-rules _libxl.api-for-check
 
113
        $(PERL) $^
 
114
        touch $@
 
115
 
 
116
_%.api-for-check: %.h
 
117
        $(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -E $< $(APPEND_CFLAGS) \
 
118
                -DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
 
119
                >$@.new
 
120
        mv -f $@.new $@
 
121
 
 
122
_paths.h: genpath
58
123
        sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" $@.tmp >$@.2.tmp
59
 
        if ! cmp $@.2.tmp $@; then mv -f $@.2.tmp $@; fi
60
 
 
61
 
libxl_paths.c: _libxl_paths.h
 
124
        rm -f $@.tmp
 
125
        $(call move-if-changed,$@.2.tmp,$@)
 
126
 
 
127
_libxl_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h
 
128
        $(PERL) $^ --prefix=libxl >$@.new
 
129
        $(call move-if-changed,$@.new,$@)
 
130
 
 
131
_libxl_save_msgs_helper.c _libxl_save_msgs_callout.c \
 
132
_libxl_save_msgs_helper.h _libxl_save_msgs_callout.h: \
 
133
                libxl_save_msgs_gen.pl
 
134
        $(PERL) -w $< $@ >$@.new
 
135
        $(call move-if-changed,$@.new,$@)
62
136
 
63
137
libxl.h: _libxl_types.h
64
 
 
65
 
$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS): libxl.h
66
 
 
67
 
_libxl_%.h _libxl_%.c: libxl.idl gen%.py libxl%.py
68
 
        $(PYTHON) gen$*.py libxl.idl __libxl_$*.h __libxl_$*.c
69
 
        mv __libxl_$*.h _libxl_$*.h
70
 
        mv __libxl_$*.c _libxl_$*.c
 
138
libxl_json.h: _libxl_types_json.h
 
139
libxl_internal.h: _libxl_types_internal.h _paths.h
 
140
libxl_internal_json.h: _libxl_types_internal_json.h
 
141
xl.h: _paths.h
 
142
 
 
143
$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS): libxl.h
 
144
$(LIBXL_OBJS): libxl_internal.h
 
145
 
 
146
_libxl_type%.h _libxl_type%_json.h _libxl_type%.c: libxl_type%.idl gentypes.py idl.py
 
147
        $(PYTHON) gentypes.py libxl_type$*.idl __libxl_type$*.h __libxl_type$*_json.h __libxl_type$*.c
 
148
        $(call move-if-changed,__libxl_type$*.h,_libxl_type$*.h)
 
149
        $(call move-if-changed,__libxl_type$*_json.h,_libxl_type$*_json.h)
 
150
        $(call move-if-changed,__libxl_type$*.c,_libxl_type$*.c)
71
151
 
72
152
libxenlight.so: $(LIBXL_OBJS)
73
 
        $(CC) $(CFLAGS) $(LDFLAGS) $(LDLIBS_LIBXL) $(SHLIB_LDFLAGS) -o $@ $^
 
153
        $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG),$@ $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXL_LIBS) $(APPEND_LDFLAGS)
74
154
 
75
155
libxenlight.a: $(LIBXL_OBJS)
76
156
        $(AR) rcs libxenlight.a $^
77
157
 
78
158
libxlutil.so: $(LIBXLU_OBJS)
79
 
        $(CC) $(CFLAGS) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^
 
159
        $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG),$@ $(SHLIB_LDFLAGS) -o $@ $^ $(LIBXLU_LIBS) $(APPEND_LDFLAGS)
80
160
 
81
161
libxlutil.a: $(LIBXLU_OBJS)
82
162
        $(AR) rcs libxlutil.a $^
83
163
 
84
164
xl: $(XL_OBJS) libxlutil.so libxenlight.so
85
 
        $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS_XL)
 
165
        $(CC) $(LDFLAGS) -o $@ $(XL_OBJS) libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) -lyajl $(APPEND_LDFLAGS)
 
166
 
 
167
libxl-save-helper: $(SAVE_HELPER_OBJS) libxenlight.so
 
168
        $(CC) $(LDFLAGS) -o $@ $(SAVE_HELPER_OBJS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(APPEND_LDFLAGS)
 
169
 
 
170
testidl: testidl.o libxlutil.so libxenlight.so
 
171
        $(CC) $(LDFLAGS) -o $@ testidl.o libxlutil.so $(LDLIBS_libxenlight) $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
86
172
 
87
173
.PHONY: install
88
174
install: all
90
176
        $(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
91
177
        $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)
92
178
        $(INSTALL_DIR) $(DESTDIR)$(BASH_COMPLETION_DIR)
 
179
        $(INSTALL_DIR) $(DESTDIR)$(XEN_RUN_DIR)
 
180
        $(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR)
93
181
        $(INSTALL_PROG) xl $(DESTDIR)$(SBINDIR)
 
182
        $(INSTALL_PROG) libxl-save-helper $(DESTDIR)$(PRIVATE_BINDIR)
94
183
        $(INSTALL_PROG) libxenlight.so $(DESTDIR)$(LIBDIR)
95
184
        $(INSTALL_DATA) libxenlight.a $(DESTDIR)$(LIBDIR)
96
185
        $(INSTALL_PROG) libxlutil.so $(DESTDIR)$(LIBDIR)
97
186
        $(INSTALL_DATA) libxlutil.a $(DESTDIR)$(LIBDIR)
98
 
        $(INSTALL_DATA) libxl.h _libxl_types.h libxl_uuid.h $(DESTDIR)$(INCLUDEDIR)
 
187
        $(INSTALL_DATA) libxl.h libxl_event.h libxl_json.h _libxl_types.h _libxl_types_json.h _libxl_list.h libxl_utils.h libxl_uuid.h $(DESTDIR)$(INCLUDEDIR)
99
188
        $(INSTALL_DATA) bash-completion $(DESTDIR)$(BASH_COMPLETION_DIR)/xl.sh
100
189
 
101
190
.PHONY: clean
102
191
clean:
103
 
        $(RM) -f _*.h *.o *.so* *.a xl $(DEPS)
104
 
        $(RM) -f _*.c *.pyc _libxl_paths.*.tmp
105
 
#       $(RM) -f $(AUTOSRCS) $(AUTOINCS)
 
192
        $(RM) -f _*.h *.o *.so* *.a $(CLIENTS) $(DEPS)
 
193
        $(RM) -f _*.c *.pyc _paths.*.tmp _*.api-for-check
 
194
        $(RM) -f testidl.c.new testidl.c *.api-ok
106
195
 
107
196
distclean: clean
108
197
 
 
198
realclean: distclean
 
199
        $(RM) -f $(AUTOSRCS) $(AUTOINCS)
 
200
 
109
201
-include $(DEPS)