-# -*- makefile -*-
+# -*- makefile-gmake -*-
# Config file for compilation by OMK for AQuoSA/Linux OS target
OMIT_KERNEL_PASSES=y
RELATIVE_DIR := $(SOURCES_DIR:$(OUTPUT_DIR)%=%)
endif
-ifeq ($(RELATIVE_DIR:ffmpeg%=ffmpeg),ffmpeg)
+FFMPEG_BUILD_DIR=$(OUTPUT_DIR)/_build/user/ffmpeg
# Allow building ffmpeg by OMK
-define FFMPEG_OMKIZE
-lib_LIBRARIES:=$(NAME)
-$(NAME)_SOURCES:=$(OBJS:%.o=%.c) $(OBJS-y:%.o=%.c) $(OBJS-yes:%.o=%.c)
-renamed_include_HEADERS:=$(foreach h,$(HEADERS),$(h)->lib$(NAME)/$(h) )
-INCLUDES += -I $(srcdir)/..
-endef
-
-$(SOURCES_DIR)/Makefile.omk: $(SOURCES_DIR)/Makefile $(MAKERULES_DIR)/ffmpeg/libswscale $(MAKERULES_DIR)/Makefile.omk.ffmpeg
+ifeq ($(RELATIVE_DIR:ffmpeg%=ffmpeg),ffmpeg)
+$(SOURCES_DIR)/Makefile.omk: $(MAKERULES_DIR)/ffmpeg/libswscale \
+ $(MAKERULES_DIR)/Makefile.omk.ffmpeg \
+ $(FFMPEG_BUILD_DIR)/config.mak \
+ $(FFMPEG_BUILD_DIR)/version.h \
+ $(OUTPUT_DIR)/_build/user/$(RELATIVE_DIR)/Makefile
@echo " FFOMK $@"
- $(Q)make DEPS="" -C $(SOURCES_DIR) -qp -f $< |sed -ne '/# Pattern-specific Variable Values/,$$ d' -e '/# makefile/,+1 p'|\
- sed -e /^define/d -e "/^#/d" -e "/^MAKE/d" > $@
-# echo '$(value FFMPEG_OMKIZE)' >> $@ # There is a bug in make
$(Q)echo "FFMPEG_SUBDIR=$(RELATIVE_DIR:ffmpeg/%=%)" >> $@
$(Q)cat $(MAKERULES_DIR)/Makefile.omk.ffmpeg >> $@
- $(Q)echo 'CFLAGS := $(CFLAGS) $$(CFLAGS)' >> $@
+$(OUTPUT_DIR)/_build/user/$(RELATIVE_DIR)/Makefile.inc.ffmpeg: $(OUTPUT_DIR)/_build/user/$(RELATIVE_DIR)/Makefile
+ @echo " SCRIPT $@"
+ $(Q)make DEPS="" -C $(OUTPUT_DIR)/_build/user/$(RELATIVE_DIR) -rqp \
+ | sed -ne '/# Pattern-specific Variable Values/,$$ d' -e '/# makefile/,+1 p' \
+ | sed -e /^define/d -e "/^#/d" -e "/^MAKE/d" > $@
-$(MAKERULES_DIR)/ffmpeg/tools/Makefile:
+$(FFMPEG_BUILD_DIR)/tools/Makefile:
touch $@
-$(MAKERULES_DIR)/ffmpeg/libavcodec/x86/Makefile:
+$(FFMPEG_BUILD_DIR)/libavcodec/x86/Makefile:
touch $@
$(MAKERULES_DIR)/ffmpeg/libswscale:
ln -sf ../../src/libswscale $@
+
+ifeq ($(wildcard $(FFMPEG_BUILD_DIR)/Makefile),)
+$(wildcard $(FFMPEG_BUILD_DIR)/Makefile): $(FFMPEG_BUILD_DIR)/config.mak
+endif
+
+$(FFMPEG_BUILD_DIR)/config.mak: \
+ $(MAKERULES_DIR)/ffmpeg/configure \
+ $(MAKERULES_DIR)/../build/config.target # this file
+ cd $(dir $@) && $(MAKERULES_DIR)/ffmpeg/configure $(if $(CONFIG_FFMPEG_WITH_FRSH:y=),--disable-protocol=frsh)
+
+$(FFMPEG_BUILD_DIR)/version.h:
+ cd $(dir $@) && $(MAKERULES_DIR)/ffmpeg/version.sh $(PWD) $@
endif