歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> 學習Linux >> centos make install 安裝程序包案例

centos make install 安裝程序包案例

日期:2017/3/3 17:48:38   编辑:學習Linux

centos make install 安裝程序包案例

centos make install 安裝程序包案例


准備寫好的c文件

1、ws.h 【頭文件,聲明函數名,未實現】2、wso.c【包含函數體,實現函數,需要編譯成動態鏈接庫】3、ws.h 【主程序執行文件】

新建makefile文件

toucu makefile 建立makefile文件vi makefile    編輯makefile,

在makefile編寫make命令可執行的code

newws:ws.c libme.so        gcc -L ./ -l me ws.c -o newwslibme.so:ws.c        gcc -shared wso.c -o libme.soinstall:        cp ./libme.so /lib64        ldconfig

命令解析: 1、 makefile格式 最終生成的文件 newws 依賴於 shenyi.c libme.so 2、gcc生成編譯文件命令 -L ./ 當前目錄 -l mewso.c 生成最終newws 3、 libme.so 依賴於 ws.c 4、生成編譯文件.so的命令(ws.c變成成libme.so) 5、make install 安裝

  5.1、將編譯文件拷入核心庫  5.2、更新緩存

http://xxxxxx/Linuxjc/1184668.html TechArticle

Copyright © Linux教程網 All Rights Reserved