2012-05-14 36 views
0

我想修改一個makefile來交叉編譯二進制文件。有問題的命令如下:瞭解makefile中的make-command?

# GNU Make solution makefile autogenerated by Premake 
# Type "make help" for usage help 



ifndef config 
    config=debug 
endif 
export config 

PROJECTS := json openjaus openjaus-core openjaus-environment openjaus-mobility openjaus-manipulator openjaus-ugv Base Managed PingTest LargeMessageTest PdDemo GposDemo GposClientDemo StillImageSensorDemo StillImageClientDemo 

.PHONY: all clean help $(PROJECTS) 

all: $(PROJECTS) 

json: 
    @echo "==== Building json ($(config)) ====" 
    @${MAKE} --no-print-directory -C .build -f json.make 

可以看出,makefile有幾個目標。它們都與'json'目標具有相同的結構。在有關問題的命令是

@${MAKE} --no-print-directory -C .build -f json.make 

的「$ {MAKE}」變量=做(我已經驗證了這一點回聲) 什麼是-C嗎? .build是做什麼的? 我很好-f json.make

此外,當我運行使得json.make文件獲取創建編譯文件並刪除它自我,所以我沒有訪問該文件。

,當我有問題修改命令我收到的錯誤是

==== Building json (debug) ==== 
make[1]: Nothing to be done for `/home/botbear/openwrt/trunk/staging_dir/toolchain- arm_v6k_gcc-linaro_uClibc-0.9.32_eabi/bin/arm-openwrt-linux-c++'. 

修改後的命令如下:

@${MAKE} /home/botbear/openwrt/trunk/staging_dir/toolchain-arm_v6k_gcc-linaro_uClibc-0.9.32_eabi/bin/arm-openwrt-linux-c++ --no-print-directory -C .build -f json.make 

任何幫助表示讚賞!

+0

可能的重複[如何在makefile中指定編譯器?](http://stackoverflow.com/questions/10541293/how-to-specify-compiler-in-makefile) – Beta

回答

0

可以使用man make瞭解參數make

-C dir, --directory=dir 
     Change to directory dir before reading the makefiles or doing any- 
     thing else. If multiple -C options are specified, each is inter- 
     preted relative to the previous one: -C/-C etc is equivalent to 
     -C /etc. This is typically used with recursive invocations of 
     make. 

-f file, --file=file, --makefile=FILE 
     Use file as a makefile. 

所以-C .build更改目錄.build

我不明白你修改命令的問題。

0

試着找到json.make在哪裏居住。看起來,這是創建&刪除您正在談論的目錄。

從命令行看來,使更改目錄爲.build並執行json.make。不確定json.make如何在那裏結束。是.build創建並刪除的目錄?