当前位置:网站首页>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 .
边栏推荐
- Force buckle 1037 Effective boomerang
- Informatics Olympiad YBT 1171: factors of large integers | 1.6 13: factors of large integers
- ClickHouse字段分组聚合、按照任意时间段粒度查询SQL
- Installation of torch and torch vision in pytorch
- 2022 Google CTF segfault Labyrinth WP
- Your cache folder contains root-owned files, due to a bug in npm ERR! previous versions of npm which
- gnet: 一个轻量级且高性能的 Go 网络框架 使用笔记
- [hfctf2020]babyupload session parsing engine
- Dark horse notes - exception handling
- [JS] obtain the N days before and after the current time or the n months before and after the current time (hour, minute, second, year, month, day)
猜你喜欢
1123. 最深叶节点的最近公共祖先
JTAG principle of arm bare board debugging
405 method not allowed appears when the third party jumps to the website
Installation of gazebo & connection with ROS
Lldp compatible CDP function configuration
Can the system hibernation file be deleted? How to delete the system hibernation file
Make Jar, Not War
【C语言进阶篇】指针的8道笔试题
LLDP兼容CDP功能配置
Dynamic planning idea "from getting started to giving up"
随机推荐
Asset security issues or constraints on the development of the encryption industry, risk control + compliance has become the key to breaking the platform
Taro 小程序开启wxml代码压缩
交叉验证如何防止过拟合
Boot - Prometheus push gateway use
Google发布安全更新,修复Chrome中已被利用的0 day
table表格设置圆角
Lldp compatible CDP function configuration
Neon Optimization: an instruction optimization case of matrix transpose
Can the system hibernation file be deleted? How to delete the system hibernation file
「笔记」折半搜索(Meet in the Middle)
C language - array
Eventbus source code analysis
Grc: personal information protection law, personal privacy, corporate risk compliance governance
Anfulai embedded weekly report no. 272: 2022.06.27--2022.07.03
Using the entry level of DVA in taro3.*
Make Jar, Not War
Come on, don't spread it out. Fashion cloud secretly takes you to collect "cloud" wool, and then secretly builds a personal website to be the king of scrolls, hehe
How to evaluate load balancing performance parameters?
让我们,从头到尾,通透网络I/O模型
MySQL script batch queries all tables containing specified field types in the database