編譯stapisdk遇到的問題

問題以下:
qianjiang@qianjiang-pc:~/pls/newsdk/stapisdk/apilib/src$ make
---- Building libstapi_stpti4.a ----
---- Building build_all_linux ----
make[4]: *** No targets specified and no makefile found.  Stop.
make[3]: [build_all_linux] Error 2 (ignored)
make[3]: [build_all_linux] Error 1 (ignored)
make[3]: [build_all_linux] Error 1 (ignored)
Exporting libmulticom.a
make[3]: *** [/home/qianjiang/pls/newsdk/stapisdk/apilib/lib/mb618_7111_ST40_LINUX_32BITS/libmulticom.a] Error 1
make[2]: *** [default] Error 2
make[1]: *** [libmulticom.a] Error 2
make: *** [default] Error 2

分析:
makefile 中包含 "$(DVD_MAKE)/builddir.mak",處理該文件的default target。
即:
@make -C /home/qianjiang/pls/newsdk/stapisdk/apilib/src/objs/mb618_7111_ST40_LINUX_32BITS -f /home/qianjiang/pls/newsdk/stapisdk/apilib/src/makefile IN_OBJECT_DIR=1 DVD_PARENT_DIR=/home/qianjiang/pls/newsdk/stapisdk/apilib/src

因此再回到makefile,可是IN_OBJECT_DIR=1,所以包含defrules.mak,執行:
default: error_checks start  $(DEFAULT_TARGETS) $(EXTRA_TARGETS) finish
其中DEFAULT_TARGETS是libstapi_stpti4.a, 而這個target是怎麼定義的呢?
找了好久沒有發現線索。

在文件defrules.mak中加入:
$(DEFAULT_TARGETS):
    @$(ECHO) hello world

獲得下面的提示:
makefile:537: warning: overriding commands for target `libstapi_stpti4.a'
defrules.mak:258: warning: ignoring old commands for target `libstapi_stpti4.a'

從而知道在makefile 537行。
$(LIB_PREFIX)stapi_$(DVD_TRANSPORT)$(LIB_SUFFIX): $(IMPORT_LIBS)
    @$(ECHO) Creating $@
    $(BUILD_LIBRARY)

這個依賴$(IMPORT_LIBS)。

而$(IMPORT_LIBS)在defrules.mak中定義,而後make -C到每一個庫文件中.
因此"---- Building build_all_linux ----"源於
@make -C /home/qianjiang/pls/newsdk/stapisdk/apilib/src/multicom

multicom中的makefile指定要編譯
make -C /home/qianjiang/pls/newsdk/stapisdk/apilib/src/multicom/4.0.4/linux

而該目錄無makefile。

因此問題在這裏。

順便掌握了一些makefile的函數,記錄以下:
參考http://sunsite.ualberta.ca/Documentation/Gnu/make-3.79/html_chapter/make_8.html
$(subst from,to,text)
    Performs a textual replacement on the text text: each occurrence of from is replaced by to. The result is substituted for the function call. For example,
    $(subst ee,EE,feet on the street)
    substitutes the string `fEEt on the strEEt'.

$(strip string)
    Removes leading and trailing whitespace from string and replaces each internal sequence of one or more whitespace characters with a single space. Thus, `$(strip a b c )' results in `a b c'. The function strip can be very useful when used in conjunction with conditionals. When comparing something with the empty string `' using ifeq or ifneq, you usually want a string of just whitespace to match the empty string (see section 7 Conditional Parts of Makefiles). Thus, the following may fail to have the desired results:

    .PHONY: all
    ifneq   "$(needs_made)" ""
    all: $(needs_made)
    else
    all:;@echo 'Nothing to make!'
    endif

    Replacing the variable reference `$(needs_made)' with the function call `$(strip $(needs_made))' in the ifneq directive would make it more robust.
 html

相關文章
相關標籤/搜索