diff options
author | Måns Rullgård <mans@mansr.com> | 2008-04-07 21:16:31 +0000 |
---|---|---|
committer | Måns Rullgård <mans@mansr.com> | 2008-04-07 21:16:31 +0000 |
commit | 71c61f62a3ca855062c832ec2ed27e331221af45 (patch) | |
tree | 8345f97e1bc07033d6d183fe33c65c3f6e1b0814 /subdir.mak | |
parent | c09ed33e186ea0ba4ab96599bd69aea462aabeda (diff) | |
download | ffmpeg-71c61f62a3ca855062c832ec2ed27e331221af45.tar.gz |
non-recursive makefiles
Originally committed as revision 12760 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'subdir.mak')
-rw-r--r-- | subdir.mak | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/subdir.mak b/subdir.mak new file mode 100644 index 0000000000..6384d8baf8 --- /dev/null +++ b/subdir.mak @@ -0,0 +1,75 @@ +SRC_DIR := $(SRC_PATH_BARE)/lib$(NAME) + +include $(SUBDIR)../common.mak + +LIBVERSION := $(lib$(NAME)_VERSION) +LIBMAJOR := $(lib$(NAME)_VERSION_MAJOR) + +ifeq ($(BUILD_STATIC),yes) +all: $(SUBDIR)$(LIBNAME) + +install-libs: install-lib$(NAME)-static + +$(SUBDIR)$(LIBNAME): $(OBJS) + rm -f $@ + $(AR) rc $@ $^ $(EXTRAOBJS) + $(RANLIB) $@ +endif + +INCINSTDIR := $(INCDIR)/lib$(NAME) + +define RULES +ifeq ($(BUILD_SHARED),yes) +all: $(SUBDIR)$(SLIBNAME) + +install-libs: install-lib$(NAME)-shared + +$(SUBDIR)$(SLIBNAME): $(SUBDIR)$(SLIBNAME_WITH_MAJOR) + cd ./$(SUBDIR) && $(LN_S) $(SLIBNAME_WITH_MAJOR) $(SLIBNAME) + +$(SUBDIR)$(SLIBNAME_WITH_MAJOR): $(OBJS) + $(SLIB_CREATE_DEF_CMD) + $(CC) $(SHFLAGS) $(FFLDFLAGS) -o $$@ $$^ $(FFEXTRALIBS) $(EXTRAOBJS) + $(SLIB_EXTRA_CMD) + +ifneq ($(SUBDIR),) +$(SUBDIR)$(SLIBNAME_WITH_MAJOR): \ + $(foreach L,$(FFLIBS),lib$(L)/$(SLIBPREF)$(L)$(SLIBSUF)) +endif +endif + +install-lib$(NAME)-shared: $(SUBDIR)$(SLIBNAME) + install -d "$(SHLIBDIR)" + install -m 755 $(SUBDIR)$(SLIBNAME) "$(SHLIBDIR)/$(SLIBNAME_WITH_VERSION)" + $(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)" + install -m 644 $(SUBDIR)$(LIBNAME) "$(LIBDIR)" + $(LIB_INSTALL_EXTRA_CMD) + +install-headers:: + install -d "$(INCINSTDIR)" + install -d "$(LIBDIR)/pkgconfig" + install -m 644 $(addprefix "$(SRC_DIR)"/,$(HEADERS)) "$(INCINSTDIR)" + install -m 644 $(BUILD_ROOT)/lib$(NAME).pc "$(LIBDIR)/pkgconfig" + +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)) |