1XEN_ROOT = $(CURDIR)/../../..
2include $(XEN_ROOT)/tools/Rules.mk
3
4OBJS-y += libxlu_cfg_y.o
5OBJS-y += libxlu_cfg_l.o
6OBJS-y += libxlu_cfg.o
7OBJS-y += libxlu_disk_l.o
8OBJS-y += libxlu_disk.o
9OBJS-y += libxlu_vif.o
10OBJS-y += libxlu_pci.o
11
12CFLAGS += -Wno-format-zero-length -Wmissing-declarations -Wformat-nonliteral
13CFLAGS += $(CFLAGS_libxenctrl)
14
15CFLAGS += $(PTHREAD_CFLAGS)
16LDFLAGS += $(PTHREAD_LDFLAGS)
17
18ifeq ($(FLEX),)
19%.c %.h:: %.l
20	$(warning Flex is needed to rebuild some libxl parsers and \
21		  scanners, please install it and rerun configure)
22endif
23
24ifeq ($(BISON),)
25%.c %.h:: %.y
26	$(warning Bison is needed to rebuild some libxl parsers and \
27		  scanners, please install it and rerun configure)
28endif
29
30AUTOINCS = libxlu_cfg_y.h libxlu_cfg_l.h libxlu_disk_l.h
31
32LIBHEADER := libxlutil.h
33PKG_CONFIG_NAME := Xlutil
34PKG_CONFIG_DESC := The xl utility library for Xen hypervisor
35
36NO_HEADERS_CHK := y
37
38include $(XEN_ROOT)/tools/libs/libs.mk
39
40$(OBJS-y) $(PIC_OBJS): $(AUTOINCS)
41
42# Adding the .c conterparts of the headers generated by flex/bison as
43# prerequisite of all objects.
44# This is to tell make that if only the .c file is out-of-date but not the
45# header, it should still wait for the .c file to be rebuilt.
46# Otherwise, make doesn't considered "%.c %.h" as grouped targets, and will run
47# the flex/bison rules in parallel of CC rules which only need the header.
48$(OBJS-y) $(PIC_OBJS): libxlu_cfg_l.c libxlu_cfg_y.c libxlu_disk_l.c
49
50%.c %.h:: %.y
51	@rm -f $*.[ch]
52	$(BISON) --output=$*.c $<
53
54%.c %.h:: %.l
55	@rm -f $*.[ch]
56	$(FLEX) --header-file=$*.h --outfile=$*.c $<
57