2008-04-07 21:16:31 +00:00
|
|
|
SRC_DIR := $(SRC_PATH_BARE)/lib$(NAME)
|
|
|
|
|
|
|
|
include $(SUBDIR)../common.mak
|
|
|
|
|
|
|
|
LIBVERSION := $(lib$(NAME)_VERSION)
|
|
|
|
LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR)
|
|
|
|
|
2009-07-28 08:58:48 +00:00
|
|
|
ifeq ($(CONFIG_STATIC),yes)
|
2008-04-07 21:16:31 +00:00
|
|
|
all: $(SUBDIR)$(LIBNAME)
|
|
|
|
|
|
|
|
install-libs: install-lib$(NAME)-static
|
|
|
|
|
|
|
|
$(SUBDIR)$(LIBNAME): $(OBJS)
|
|
|
|
rm -f $@
|
|
|
|
$(AR) rc $@ $^ $(EXTRAOBJS)
|
|
|
|
$(RANLIB) $@
|
|
|
|
endif
|
|
|
|
|
|
|
|
INCINSTDIR := $(INCDIR)/lib$(NAME)
|
|
|
|
|
2009-07-28 08:58:48 +00:00
|
|
|
THIS_LIB := $(SUBDIR)$($(CONFIG_SHARED:yes=S)LIBNAME)
|
2009-04-01 00:53:31 +00:00
|
|
|
|
2008-04-07 21:16:31 +00:00
|
|
|
define RULES
|
2009-04-01 00:53:22 +00:00
|
|
|
$(SUBDIR)%$(EXESUF): $(SUBDIR)%.o
|
2009-07-12 13:29:40 +00:00
|
|
|
$(LD) $(FFLDFLAGS) -o $$@ $$^ -l$(FULLNAME) $(FFEXTRALIBS) $$(ELIBS)
|
2009-04-01 00:53:22 +00:00
|
|
|
|
|
|
|
$(SUBDIR)%-test.o: $(SUBDIR)%.c
|
2009-07-16 22:29:17 +00:00
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c -o $$@ $$^
|
2009-04-01 00:53:22 +00:00
|
|
|
|
|
|
|
$(SUBDIR)%-test.o: $(SUBDIR)%-test.c
|
2009-07-16 22:29:17 +00:00
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) -DTEST -c -o $$@ $$^
|
2009-04-01 00:53:22 +00:00
|
|
|
|
|
|
|
$(SUBDIR)x86/%.o: $(SUBDIR)x86/%.asm
|
2009-08-23 11:02:32 +00:00
|
|
|
$(YASM) $(YASMFLAGS) -I $$(<D)/ -M -o $$@ $$< > $$(@:.o=.d)
|
2009-04-01 00:53:22 +00:00
|
|
|
$(YASM) $(YASMFLAGS) -I $$(<D)/ -o $$@ $$<
|
|
|
|
|
|
|
|
clean::
|
2009-04-20 11:14:19 +00:00
|
|
|
rm -f $(addprefix $(SUBDIR),*-example$(EXESUF) *-test$(EXESUF) $(CLEANFILES) $(CLEANSUFFIXES) $(LIBSUFFIXES)) \
|
2009-04-01 00:53:22 +00:00
|
|
|
$(addprefix $(SUBDIR), $(foreach suffix,$(CLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
|
|
|
|
|
|
|
|
distclean:: clean
|
|
|
|
rm -f $(addprefix $(SUBDIR),$(DISTCLEANSUFFIXES)) \
|
|
|
|
$(addprefix $(SUBDIR), $(foreach suffix,$(DISTCLEANSUFFIXES),$(addsuffix /$(suffix),$(DIRS))))
|
|
|
|
|
2009-07-28 08:58:48 +00:00
|
|
|
ifdef CONFIG_SHARED
|
2008-04-07 21:16:31 +00:00
|
|
|
all: $(SUBDIR)$(SLIBNAME)
|
|
|
|
|
|
|
|
install-libs: install-lib$(NAME)-shared
|
|
|
|
|
|
|
|
$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR)
|
|
|
|
cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME)
|
|
|
|
|
2008-05-26 06:34:57 +00:00
|
|
|
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS)
|
2008-04-07 21:16:31 +00:00
|
|
|
$(SLIB_CREATE_DEF_CMD)
|
2009-07-12 13:29:40 +00:00
|
|
|
$(LD) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$(filter %.o,$$^) $(FFEXTRALIBS) $(EXTRAOBJS)
|
2008-04-07 21:16:31 +00:00
|
|
|
$(SLIB_EXTRA_CMD)
|
|
|
|
|
2008-04-07 22:17:47 +00:00
|
|
|
ifdef SUBDIR
|
2008-04-09 21:11:39 +00:00
|
|
|
$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(DEP_LIBS)
|
2008-04-07 21:16:31 +00:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME)
|
|
|
|
install -d "$(SHLIBDIR)"
|
2009-03-22 13:00:15 +00:00
|
|
|
install -m 755 $$< "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
|
2008-04-07 21:16:31 +00:00
|
|
|
$(STRIP) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
|
|
|
|
cd "$(SHLIBDIR)" && \
|
|
|
|
$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME_WITH_MAJOR)
|
|
|
|
cd "$(SHLIBDIR)" && \
|
|
|
|
$(LN_S) $(SLIBNAME_WITH_VERSION) $(SLIBNAME)
|
|
|
|
$(SLIB_INSTALL_EXTRA_CMD)
|
|
|
|
|
|
|
|
install-lib$(NAME)-static: $(SUBDIR)$(LIBNAME)
|
|
|
|
install -d "$(LIBDIR)"
|
2009-03-22 13:00:15 +00:00
|
|
|
install -m 644 $$< "$(LIBDIR)"
|
2008-04-07 21:16:31 +00:00
|
|
|
$(LIB_INSTALL_EXTRA_CMD)
|
|
|
|
|
|
|
|
install-headers::
|
|
|
|
install -d "$(INCINSTDIR)"
|
|
|
|
install -d "$(LIBDIR)/pkgconfig"
|
|
|
|
install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)"
|
2008-06-16 18:01:55 +00:00
|
|
|
install -m 644 $(BUILD_ROOT)/lib$(NAME)/lib$(NAME).pc "$(LIBDIR)/pkgconfig"
|
2008-04-07 21:16:31 +00:00
|
|
|
|
|
|
|
uninstall-libs::
|
|
|
|
-rm -f "$(SHLIBDIR)/$(SLIBNAME_WITH_MAJOR)" \
|
|
|
|
"$(SHLIBDIR)/$(SLIBNAME)" \
|
|
|
|
"$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)"
|
|
|
|
-$(SLIB_UNINSTALL_EXTRA_CMD)
|
|
|
|
-rm -f "$(LIBDIR)/$(LIBNAME)"
|
|
|
|
|
|
|
|
uninstall-headers::
|
|
|
|
rm -f $(addprefix "$(INCINSTDIR)/",$(HEADERS))
|
|
|
|
rm -f "$(LIBDIR)/pkgconfig/lib$(NAME).pc"
|
|
|
|
-rmdir "$(INCDIR)"
|
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(RULES))
|
2009-04-01 00:53:22 +00:00
|
|
|
|
2009-04-01 00:53:31 +00:00
|
|
|
$(EXAMPLES) $(TESTPROGS): $(THIS_LIB) $(DEP_LIBS)
|
|
|
|
|
2009-04-01 00:53:22 +00:00
|
|
|
examples: $(EXAMPLES)
|
|
|
|
testprogs: $(TESTPROGS)
|