当前位置:网站首页>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 .
边栏推荐
猜你喜欢
Transformation transformation operator
Niuke cold training camp 6B (Freund has no green name level)
Segmenttree
Dynamic planning idea "from getting started to giving up"
Tensorflow GPU installation
Body mass index program, entry to write dead applet project
Do you understand this patch of the interface control devaxpress WinForms skin editor?
身体质量指数程序,入门写死的小程序项目
Installation of gazebo & connection with ROS
[hfctf2020]babyupload session parsing engine
随机推荐
Byte P7 professional level explanation: common tools and test methods for interface testing, Freeman
Implementation principle of waitgroup in golang
MySQL中回表的代价
Openjudge noi 1.7 10: simple password
Maidong Internet won the bid of Beijing life insurance to boost customers' brand value
Taro2.* applet configuration sharing wechat circle of friends
[hfctf2020]babyupload session parsing engine
斗地主游戏的案例开发
NEON优化:关于交叉存取与反向交叉存取
Taro applet enables wxml code compression
2022 Google CTF SEGFAULT LABYRINTH wp
2022 Google CTF SEGFAULT LABYRINTH wp
机器学习:随机梯度下降(SGD)与梯度下降(GD)的区别与代码实现。
Using the entry level of DVA in taro3.*
The difference between spin and sleep
Your cache folder contains root-owned files, due to a bug in npm ERR! previous versions of npm which
2022 Google CTF SEGFAULT LABYRINTH wp
树莓派/arm设备上安装火狐Firefox浏览器
阿里云中mysql数据库被攻击了,最终数据找回来了
Grc: personal information protection law, personal privacy, corporate risk compliance governance