歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> linux中的Make使用模板

linux中的Make使用模板

日期:2017/3/3 11:32:26   编辑:Linux技術

如何使用make

基於實現加減乘除的程序

先建立一個test的根目錄,在根目錄中建立add ,sub,div,mul,main,scripts子目錄和文件Makefile

在每個子目錄中建立目錄src和文件Makefile

根據每個功能目錄的名字,在其src中,建立.c文件

圖中的.o文件是已經編譯好的。

打開scripts目錄中的Makefile文件,相應命令如下

cd test

cd scripts

vim Makefile

總控文件Makefile:

cd test

vim Makefile

在子目錄add sub div mul main 中的Makefile中寫入

編譯cd test

make

Copyright © Linux教程網 All Rights Reserved