Skip to contentSkip to conversation

libxl: Fix missing dependency in api check rule

PATCH In review Ian Jackson 3 participants 3 messages Sep 11, 2012 – Sep 14, 2012

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 libxl: Fix missing dependency in api check rule

Without this, the api check cpp run might happen before the various autogenerated files which are #include by libxl.h are ready.

We need to remove the api-ok file from AUTOINCS to avoid a circular dependency. Instead, we list it explicitly as a dependency of the object files. The result is that the api check is the last thing to be done before make considers the preparation done and can start work on compiling .c files into .o's.

---
v2: Remove .api-ok from AUTOINCS instead of using $(filter-out...)

 tools/libxl/Makefile |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
tools/libxl/Makefile +4 -4
index a9d9ec6..0986901 100644
@@ -74,8 +74,7 @@ LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) -include $(XEN_ROOT)/tools/config.h
 
 AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h _libxl_list.h _paths.h \
-	_libxl_save_msgs_callout.h _libxl_save_msgs_helper.h \
-        libxl.api-ok
+	_libxl_save_msgs_callout.h _libxl_save_msgs_helper.h
 AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c
 AUTOSRCS += _libxl_save_msgs_callout.c _libxl_save_msgs_helper.c
 LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o \
@@ -102,7 +101,8 @@ testidl.c: libxl_types.idl gentest.py libxl.h $(AUTOINCS)
 all: $(CLIENTS) libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
 	$(AUTOSRCS) $(AUTOINCS)
 
-$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS): $(AUTOINCS)
+$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS): \
+	$(AUTOINCS) libxl.api-ok
 
 %.c %.h:: %.y
 	@rm -f $*.[ch]
@@ -119,7 +119,7 @@ libxl.api-ok: check-libxl-api-rules _libxl.api-for-check
 	$(PERL) $^
 	touch $@
 
-_%.api-for-check: %.h
+_%.api-for-check: %.h $(AUTOINCS)
 	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -E $< $(APPEND_CFLAGS) \
 		-DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
 		>[email protected]
Signature · 1 line
tg: (0730dd5..) t/xen/xl.make-api-depend-fix (depends on: base)
Tested-by on v2 1/1
#1 lore raw
Quoted 2 lines · Ian Jackson

Without this, the api check cpp run might happen before the various autogenerated files which are #include by libxl.h are ready.

The package still builds fine with this patch.

#2 lore raw
In reply to Ian Jackson
Quoted 11 lines · Ian Jackson

Without this, the api check cpp run might happen before the various autogenerated files which are #include by libxl.h are ready.

We need to remove the api-ok file from AUTOINCS to avoid a circular dependency. Instead, we list it explicitly as a dependency of the object files. The result is that the api check is the last thing to be done before make considers the preparation done and can start work on compiling .c files into .o's.

Acked + Tested by Olaf + applied.

Thanks.

Quoted 40 lines

---
v2: Remove .api-ok from AUTOINCS instead of using $(filter-out...)

 tools/libxl/Makefile |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
tools/libxl/Makefile +4 -4
index a9d9ec6..0986901 100644
@@ -74,8 +74,7 @@ LIBXL_OBJS += _libxl_types.o libxl_flask.o _libxl_types_internal.o
 $(LIBXL_OBJS): CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl) -include $(XEN_ROOT)/tools/config.h
 
 AUTOINCS= libxlu_cfg_y.h libxlu_cfg_l.h _libxl_list.h _paths.h \
-	_libxl_save_msgs_callout.h _libxl_save_msgs_helper.h \
-        libxl.api-ok
+	_libxl_save_msgs_callout.h _libxl_save_msgs_helper.h
 AUTOSRCS= libxlu_cfg_y.c libxlu_cfg_l.c
 AUTOSRCS += _libxl_save_msgs_callout.c _libxl_save_msgs_helper.c
 LIBXLU_OBJS = libxlu_cfg_y.o libxlu_cfg_l.o libxlu_cfg.o \
@@ -102,7 +101,8 @@ testidl.c: libxl_types.idl gentest.py libxl.h $(AUTOINCS)
 all: $(CLIENTS) libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
 	$(AUTOSRCS) $(AUTOINCS)
 
-$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS): $(AUTOINCS)
+$(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS): \
+	$(AUTOINCS) libxl.api-ok
 
 %.c %.h:: %.y
 	@rm -f $*.[ch]
@@ -119,7 +119,7 @@ libxl.api-ok: check-libxl-api-rules _libxl.api-for-check
 	$(PERL) $^
 	touch $@
 
-_%.api-for-check: %.h
+_%.api-for-check: %.h $(AUTOINCS)
 	$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_$*.o) -c -E $< $(APPEND_CFLAGS) \
 		-DLIBXL_EXTERNAL_CALLERS_ONLY=LIBXL_EXTERNAL_CALLERS_ONLY \
 		>[email protected]