当前位置:网站首页>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 .
边栏推荐
- ESP Arduino (IV) PWM waveform control output
- Boot - Prometheus push gateway use
- pyflink的安装和测试
- 力扣1037. 有效的回旋镖
- C语言实例_5
- Oracle: Practice of CDB restricting PDB resources
- Byte P7 professional level explanation: common tools and test methods for interface testing, Freeman
- 实现mysql与ES的增量数据同步
- Neon Optimization: an instruction optimization case of matrix transpose
- Informatics Olympiad YBT 1171: factors of large integers | 1.6 13: factors of large integers
猜你喜欢

Force buckle 1037 Effective boomerang

Do you understand this patch of the interface control devaxpress WinForms skin editor?

1123. The nearest common ancestor of the deepest leaf node

Dark horse notes - exception handling

ARM裸板调试之JTAG原理

Js逆向——捅了【马蜂窝】的ob混淆与加速乐

Maidong Internet won the bid of Beijing life insurance to boost customers' brand value

2022 Google CTF SEGFAULT LABYRINTH wp
![[case sharing] basic function configuration of network loop detection](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[case sharing] basic function configuration of network loop detection

go-zero微服务实战系列(九、极致优化秒杀性能)
随机推荐
Installation and testing of pyflink
[chip scheme design] pulse oximeter
ARM裸板调试之JTAG调试体验
2022 Google CTF SEGFAULT LABYRINTH wp
mysql: error while loading shared libraries: libtinfo. so. 5: cannot open shared object file: No such
7.6模拟赛总结
Neon Optimization: performance optimization FAQ QA
Your cache folder contains root-owned files, due to a bug in npm ERR! previous versions of npm which
NEON优化:关于交叉存取与反向交叉存取
Case development of landlord fighting game
Taro2.* 小程序配置分享微信朋友圈
Boot - Prometheus push gateway use
The MySQL database in Alibaba cloud was attacked, and finally the data was found
c语言—数组
Go zero micro service practical series (IX. ultimate optimization of seckill performance)
Windows installation mysql8 (5 minutes)
Let's see through the network i/o model from beginning to end
分享一个通用的so动态库的编译方法
Taro applet enables wxml code compression
C # method of calculating lunar calendar date 2022