@@ -346,6 +346,7 @@ define do_links
cd $(dir $@); \
ln -sf $(dir $<)include/*.h include/; \
ln -sf $(dir $<)*.[ch] .; \
+ [ -e $(dir $<)Makefile.common ] && ln -sf $(dir $<)Makefile.common . ||:; \
ln -sf $(dir $<)Makefile .
touch $@
endef
@@ -355,10 +356,14 @@ define BUILD_lib
libxen$(1): libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a
libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: $$(LIBDEPS_$(1)) $$(LIBDEP_$(1))
libs-$$(XEN_TARGET_ARCH)/$(1)/libxen$(1).a: mk-headers-$$(XEN_TARGET_ARCH) $$(NEWLIB_STAMPFILE) .phony
- CPPFLAGS="$$(TARGET_CPPFLAGS)" CFLAGS="$$(TARGET_CFLAGS)" $$(MAKE) CONFIG_LIBXC_MINIOS=y -C $$(@D) $$(@F)
+ CPPFLAGS="$$(TARGET_CPPFLAGS)" CFLAGS="$$(TARGET_CFLAGS)" $$(MAKE) CONFIG_LIBXC_MINIOS=y $$(if $$(wildcard $$(@D)/Makefile.common),-f $(CURDIR)/xenlibs.mk) -C $$(@D) $$(@F)
clean-libxen$(1):
- [ ! -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile ] || $$(MAKE) DESTDIR= -C libs-$$(XEN_TARGET_ARCH)/$(1) clean
+ if [ -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile.common ]; then \
+ $$(MAKE) -f $(CURDIR)/xenlibs.mk -C libs-$$(XEN_TARGET_ARCH)/$(1) clean; \
+ elif [ -e libs-$$(XEN_TARGET_ARCH)/$(1)/Makefile ]; then \
+ $$(MAKE) -C libs-$$(XEN_TARGET_ARCH)/$(1) clean; \
+ fi
libs-$$(XEN_TARGET_ARCH)/$(1)/stamp: $$(XEN_ROOT)/tools/libs/$(1)/Makefile
$$(do_links)
new file mode 100644
@@ -0,0 +1,13 @@
+include $(XEN_ROOT)/tools/Rules.mk
+
+include Makefile.common
+
+LIBNAME := $(notdir $(CURDIR))
+FILENAME_$(LIBNAME) ?= xen$(LIBNAME)
+LIB_FILE_NAME = $(FILENAME_$(LIBNAME))
+
+lib$(LIB_FILE_NAME).a: $(OBJS-y)
+ $(AR) rc $@ $^
+
+clean::
+ rm -f $(OBJS-y) lib$(LIB_FILE_NAME).a