vmm: Attempt to backtrace the guest on error
[akaros.git] / user / Makefrag-user-lib
index c920ae5..2e27ad9 100644 (file)
@@ -3,15 +3,14 @@
 # e.g.  LIBNAME = parlib
 
 ARCH ?= none   # catch bugs
+SRCDIR ?=
+INCDIR ?= $(SRCDIR)include
+OBJDIR ?= $(SRCDIR)obj
 CFLAGS_USER += $(CFLAGS_USER_LIBS)
 # DEPLIBS passed in from the top-level Makefile
 DEPLIBS := $(DEPLIBS)
 DEPLIBAS = $(patsubst %, $(XCC_TARGET_LIB)/lib%.a, $(DEPLIBS))
 
-SRCDIR :=
-OBJDIR := $(SRCDIR)obj
-INCDIR = $(SRCDIR)include
-
 INCS = -I$(INCDIR)
 FINALLIB = $(OBJDIR)/lib$(LIBNAME).a
 FINALLIB-INSTALL = $(XCC_TARGET_LIB)/lib$(LIBNAME).a
@@ -44,11 +43,15 @@ $(FINALLIB): $(OBJS)
        @mkdir -p $(@D)
        $(Q)$(AR) rc $@ $(OBJS)
 
+# Allow two different patterns for installing include files
 $(FINALLIB-INSTALL): $(FINALLIB)
        @cp $(FINALLIB) $@
-       @cp -R $(INCDIR)/* $(XCC_TARGET_INCLUDE)/
-       @rm -rf $(XCC_TARGET_INCLUDE)/$(LIBNAME)
-       @ln -fs . $(XCC_TARGET_INCLUDE)/$(LIBNAME)
+       @if [ -d "$(INCDIR)/$(LIBNAME)" ]; then \
+               rm -rf $(XCC_TARGET_INCLUDE)/$(LIBNAME) ; \
+               cp -r $(INCDIR)/$(LIBNAME) $(XCC_TARGET_INCLUDE)/ ; \
+       else \
+               cp -r $(INCDIR)/*.h $(XCC_TARGET_INCLUDE)/ ; \
+       fi;
 
 install: $(FINALLIB-INSTALL)
        @echo > /dev/null