编译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.
 

你可能感兴趣的:(职场,编译,休闲,编译stapisdk,stlinux)