当前位置:网站首页>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 .
边栏推荐
- SuperSocket 1.6 创建一个简易的报文长度在头部的Socket服务器
- Neon Optimization: About Cross access and reverse cross access
- Windows installation mysql8 (5 minutes)
- Oracle:CDB限制PDB资源实战
- 让我们,从头到尾,通透网络I/O模型
- 从底层结构开始学习FPGA----FIFO IP的定制与测试
- Meet in the middle
- go-zero微服务实战系列(九、极致优化秒杀性能)
- AI automatically generates annotation documents from code
- 免费白嫖的图床对比
猜你喜欢
随机推荐
子网划分、构造超网 典型题
MySQL中回表的代价
Make Jar, Not War
C# 计算农历日期方法 2022
Atomic in golang and CAS operations
[chip scheme design] pulse oximeter
[100 cases of JVM tuning practice] 05 - Method area tuning practice (Part 2)
Google发布安全更新,修复Chrome中已被利用的0 day
Install Firefox browser on raspberry pie /arm device
pyflink的安装和测试
SuperSocket 1.6 创建一个简易的报文长度在头部的Socket服务器
MySQL script batch queries all tables containing specified field types in the database
Openjudge noi 1.7 08: character substitution
Oracle:CDB限制PDB资源实战
1123. The nearest common ancestor of the deepest leaf node
2022 Google CTF SEGFAULT LABYRINTH wp
Eventbus source code analysis
域分析工具BloodHound的使用说明
黑马笔记---异常处理
table表格设置圆角