Makefile出身:
Uinx、GNU、GNU make、理查德·斯托曼(Richard Matthew Stallman)博士
不說了,大家可看看“GNU/Linux與開源文化的那些人和事”這文章寫的很好,專科生一定要看,
什么是GNU make:
GNU make is the implementation of make written for the Free Software Foundation’s GNU Operating System. The make utility automatically determines which pieces of a large program need to be recompiled, and issues commands to recompile them.
Makefile到底是啥還是沒有懂:
make是一個專解釋Makefile中指令的命令工具,
Makefile實質就是描述了整個工程的編譯、連接等規則的定義檔案,最終目地就是實作“自動化編譯”
這也是“GNU Operating System”靈魂人物“Richard Matthew Stallman”帶領團隊搞出來的,
Android這小弟就是在他的基礎上改改搞搞,
Makefile基本語法:
target... : prerequisites ...
command
...
...
target 目標檔案
prerequisites 目標檔案
command 命令
寫個GNU APP hello world:
vim android.c
#include <stdio.h>
int main(void) {
printf("hello world\n");
return 0;
}
gcc -c android.c //編譯
gcc android.o -o android //生成執行檔案
./android //執行檔案
結果:“hello world”
Makefile上場:
vim Makefile: //定義規則
android: android.c
gcc -c android.c
gcc android.o -o android
clean:
rm -rf android.o
rm -rf android
make android //make解釋Makefile的指令生成了android bin
./android //執行檔案
結果:“hello world”
make clean
android.o android被洗掉
android build hello world.
非常感謝您花費時間閱讀這份稿件,感覺有用可以分享給更多的學習者,轉載請標記出處,
作者: [Alin]
時間: 2021 年 02月 01日
email:380475066@qq.com
參考檔案
GNU
GNU make
GNU/Linux與開源文化的那些人和事
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/256404.html
標籤:其他
