当前位置:网站首页>Share a general compilation method of so dynamic library
Share a general compilation method of so dynamic library
2022-07-07 01:23:00 【wandersky0822】
CC :=$(CROSS_COMPILE)gcc
LD :=$(CROSS_COMPILE)ld
CFLAGS := -fPIC -Wall
LDFLAGS := -shared -Wl,-soname=libdrdev.so.2
SOURCE := $(wildcard *.c)
OBJS := $(patsubst %.c,%.o,$(SOURCE))
TARGET_LIB := libdrdev.so.2.1.0
all:$(OBJS)
@echo $(OBJS)
# $(LD) $(LDFLAGS) -o $(TARGET_LIB) $(OBJS)
$(CC) $(LDFLAGS) -o $(TARGET_LIB) $(OBJS)
%.o:%.c
@echo Compiling $< ...
$(CC) -c $(CFLAGS) $< -o $*.o
.PHONY:clean
clean:
rm $(TARGET_LIB) *.o -rf
Several knowledge points , Explain the following :
-fPIC Position is irrelevant
-shared seeing the name of a thing one thinks of its function , Generating shared libraries
$(wildcard *.c) List all under the folder .c file
$(patsubst %.c,%.o,$(SOURCE)) stay $(SOURCE) Search for .c file , Replace with .o
%.o:%.c % wildcard , You can guess almost
$< All dependence
$* All goals % The previous part .
边栏推荐
- C language - array
- Make Jar, Not War
- Body mass index program, entry to write dead applet project
- Receive user input, height BMI, BMI detection small business entry case
- [Niuke] b-complete square
- Neon Optimization: an instruction optimization case of matrix transpose
- 「笔记」折半搜索(Meet in the Middle)
- Metauniverse urban legend 02: metaphor of the number one player
- Typical problems of subnet division and super network construction
- Data type of pytorch tensor
猜你喜欢

Make Jar, Not War

Segmenttree

Typical problems of subnet division and super network construction

Make Jar, Not War

Installation of gazebo & connection with ROS

Gazebo的安装&与ROS的连接

Dynamic planning idea "from getting started to giving up"

Send template message via wechat official account

UI control telerik UI for WinForms new theme - vs2022 heuristic theme

Maidong Internet won the bid of Beijing life insurance to boost customers' brand value
随机推荐
Informatics Orsay Ibn YBT 1172: find the factorial of n within 10000 | 1.6 14: find the factorial of n within 10000
黑马笔记---创建不可变集合与Stream流
云呐|工单管理软件,工单管理软件APP
接收用户输入,身高BMI体重指数检测小业务入门案例
UI control telerik UI for WinForms new theme - vs2022 heuristic theme
让我们,从头到尾,通透网络I/O模型
[hfctf2020]babyupload session parsing engine
Transformation transformation operator
1123. 最深叶节点的最近公共祖先
THREE. AxesHelper is not a constructor
Boot - Prometheus push gateway use
域分析工具BloodHound的使用说明
斗地主游戏的案例开发
How to manage distributed teams?
Lldp compatible CDP function configuration
Force buckle 1037 Effective boomerang
Vocabulary in Data Book
微信公众号发送模板消息
从底层结构开始学习FPGA----FIFO IP的定制与测试
【C语言进阶篇】指针的8道笔试题