常用的一个简单生成静态库的makefile

通用Makefile的编写和在项目工程中使用Makefile(包括动态库、静态库的链接、整个工程联合编译) 一、通用Makefile文件的编写        (1)、什么是通用Makefile?                     这里的通用Makefile指的是它既能编译可执行文件、也能编译动态链接库、又能编译静态库,只需要更改很少的内容即可。        (2)、写一个通用Makefile #-------------------------配置区域------ 阅读详情

#=============================================
# Makefile (linux) for S21SDK Sample : testnc
#=============================================

SHELL = /bin/sh

CC = mipsel-linux-gcc
AR = mipsel-linux-ar


CCSIPDIR ?= $(shell cd "../../" && pwd)
CFLAG = -O2 -W -Wall
INCPATH = -I./include -I./src -I../../../include/ -I$(CCSIPDIR)/Common/include -I$(CCSIPDIR)/include

TEST_TARGET = ./lib/libNtp1.a
TEST_OBJ = csip_ntp.o
TEST_SRC = ./src/csip_ntp.c

all : $(TEST_TARGET)

$(TEST_OBJ): $(TEST_SRC)
 $(CC) $(CFLAG) $(INCPATH) -c $(TEST_SRC)

$(TEST_TARGET) : $(TEST_OBJ)
 $(AR) cq $@ $^
# $(AR) $(TRGLINKOPT) cq $@ $^
# $(CC) -o $@ $(TEST_OBJ) $(LIBS)

# clean
clean:
 rm -f *.o $(TEST_TARGET)  

Linux Makefile:使用CMake生成Makefile文件_cmake写makefile 从前面几个case中可以看到,如果不这样做,cmake运行时生成的附带文件就会跟源码文件混在一起,这样会对程序的目录结构造成污染,而在build目录下运行cmake,生成的附带文件就只会待在build目录下,如果我们不想要这些文件了就可以直接清空build目录,非常方便。正规一点来说,一般会把源文件放到src目录下,把头文件放入到include文件下,生成的对象文件放入到build目录下,最终输出的elf文件会放到bin目录下,这样整个结构更加清晰。既然我们已经生成了库,那么就进行链接测试下。 阅读详情

相关推荐

Makefile变量及动态库静态库

Makefile变量及动态库静态库。ar命令和动态库的封装。

渣渣馬的博客 2265

使用makefile生成动态库和静态库

1.makefile 2.动态库和静态库 3.shell

xinyuantianzi的博客 1万+

AD936x Evaluation Software 实战配置指南:从寄存器设置到滤波器优化

本文提供AD936x Evaluation Software的实战配置指南,详细解析从工程创建、RF向导与时钟模块配置,到数字滤波器优化、数字接口设置及增益控制的完整流程。重点分享寄存器设置、滤波器系数权衡及PLL稳定技巧等核心要点,帮助开发者高效配置AD9361/AD9363射频芯片,快速应用于SDR、基站等场景。

perl8的博客 697

makefile之静态库的生成

makefile之静态库的生成

菜鸡搞计算机 498

ESP32 STA AP模式下,设备连接 ESP的AP 后无法上网,无法访问域名上网(或者Failed to enable NAPT)

ESP32 STA AP模式下,设备连接 ESP的AP 后无法上网,无法访问域名上网(或者Failed to enable NAPT)1.可能是ESP STA模式未成功连接到路由器,确保 STA 成功连接到外部网络。2.检查 STA 和 AP 的网络配置是否正确,避免子网冲突。3.ESP32的NAPT功能未正确启用,确保 menuconfig 中已启用 IP_NAPT。4.DNS服务器未正确配置。

qq_34885669的博客 1539

华为HPLC模组全拆解之电力载波收发原理分析

电力线载波通信(PLC)是一种使用电力线进行数据传输的通信技术,即利用现有电网作为信号的传输介质,使电网在传输电力的同时可以进行数据传输。目前根据所用频段的不同,低压电力线载波通信一般分为窄带电力线载波通信(10KHz~500KHz)和宽带电力线载波通信(2MHz~20MHz)。这里的频率可以简单理解为单片机串口的通信波特率,频率越小通信速度越慢,频率越大通信速度越快。为了研究电力载波通信原理,笔者以华为的一款宽带电力载波模组为例进行详细的分析,该模组主控采用的是海思芯片,型号为Hi3921EV100。

xingxingdiandeng69的博客 2万+

制作静态库和动态库

1

work_hard423的博客 4724

【漏洞复现】CVE-2024-44902 Thinkphp反序列化漏洞

Thinkphp v6.1.3至v8.0.4版本中存在反序列化漏洞,攻击者可利用此漏洞执行任意代码。

渗透之路,攻防之间皆学问 6705

linux下动态库和静态库的制作、寻找、比较及相关Makefile的编写

一.库的定义 什么是库,在windows平台和linux平台下都大量存在着库。 本质上来说库是一种可执行代码的二进制形式,可以被操作系统载入内存执行。 由于windows和linux的本质不同,因此二者库的二进制是不兼容的。 本文仅限于介绍linux下的库。 二.库的种类 1.在windows中 .dll 动态库 .lib 静态库 库即为源代码的二进制文件 2.在linux

1、测试博主技术知识分享 2、pos行业知识技术分享 3、java后端技术知识分享 4、嵌入式技术知识分享 5、运维部署相关知识分享 4069

AutoSAR MemMap模块详解及使用注意事项

在本文中,我们将深入探讨MemMap模块的实例解析,并介绍在使用该模块时需要注意的一些事项。在上述代码中,我们使用了MEMMAP_START_SEC_VAR_32BIT和MEMMAP_START_SEC_CODE来定义MemMap区域的起始位置,使用MEMMAP_STOP_SEC_VAR_32BIT和MEMMAP_STOP_SEC_CODE来定义MemMap区域的结束位置。1.合理划分MemMap区域:根据实际需求,合理划分MemMap区域,将不同类型的变量放置在不同的区域中,以便于管理和访问。

weixin_50547796的博客 2531

YOLOv8 架构改造实战:添加 P2 小目标检测头与 P6 超大目标检测头

上采样是指将特征图的空间尺寸变大(例如从 20×20 → 80×80),用来提升图像的分辨率。常见于解码器结构或特征融合中。下采样是指将特征图的空间尺寸缩小(例如从 256×256 → 128×128),通常用于减少计算量、提取更高级语义特征。操作目的方法尺寸变化上采样放大特征图插值算法变大(如2×)下采样压缩特征图、提取语义stride卷积等变小(如1/2)

FJN110的博客 574

Makefile学习7:编译动态链接库和静态库

Makefile编译动态库和静态库

weixin_45783574的博客 1万+

从零手搓大模型(一)文本如何变成 LLM 的输入

本文介绍了从原始文本到LLM输入向量的完整处理流程。主要内容包括: 文本预处理:通过正则表达式将原始文本分割成token列表,处理标点和空格。 词表构建:创建token到ID的映射字典(vocabulary),这是文本数字化的关键步骤。 简单tokenizer实现:封装了编码(encode)和解码(decode)功能,完成文本与token ID的相互转换。 处理流程:原始文本 → 分词 → token ID → 嵌入表示 → 最终输入向量。 数据形状变化:从字符串逐步转换为(batch_size, cont

echo的博客 998

使用Makefile生成静态库

1.创建一个目录 2.libmath.c中是我们自定义的函数,libmath.h中是函数的声明 libmath.c 1 #include<stdio.h> 2 int libmath_init() 3 { 4 printf("libmath_init...\n"); 5 } ~ libmath.h 1 #ifndef __LIBMATH_H 2 #define __LIBMATH_H 3 void libmath_init();

weixin_42097108的博客 3098

企业数据治理体系中的AI与业务融合:架构师的3个成功案例

企业数据治理的痛点从来不是“有没有做”,而是“做了之后有没有用”——很多企业花了数百万建数据仓库、做元数据管理,最后却陷入“数据躺在库里睡大觉”“AI模型因数据质量差而失效”的困境。本文通过零售、金融、制造3个真实案例,拆解架构师如何用AI连接数据治理与业务场景:从“客户画像不准”到“精准推荐提升30%转化率”,从“欺诈检测漏报”到“实时拦截减少50%损失”,从“库存积压”到“供应链周转率提升20%”。如何让数据治理从「合规驱动」转向「价值驱动」?

AI 原生应用开发的博客 992

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

保姆级讲解:对一个项目使用Makefile生成静态库并带你看懂Makefile文件内容

到这步基本上没有啥大问题了,这一步用于实现某些功能,我这里简单地列举了两个。clean(名字也是自己定),之后在终端make+自己定义的名字,就会实现定义名字对应的功能。比如说在终端输入“make clean”,就会对Build目录,Executable目录和Library目录的删除,用于重新执行make命令clean:#clean实现清除指定的文件夹run:#run实现编译Executable文件夹下的main可执行文件静态库适合需移植性强、依赖简单的场景。

kljljy的博客 1207

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

makefile编译静态库与动态库

在大型的项目中,一个工程中的源文件不计数,其按类型、功能、模块分别放在若干个目录中。为了方便调用其他文件夹中的文件,最通用的方法就是将一些文件编译成静态的库或动态库,这样在包含其他文件夹的头文件时可以更加简便。 1.编译静态库 bin :存放可执行文件 build:存放编译生产的二进制文件(xx.o) include:存放程序编译时需要调用的头文件(xx.h) lib:存放程序链接时(生成可执行...

青山绿水 1万+

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

Makefile多文件编程+Makefile制作Linux动态库和静态库【实例化、简单易懂】

目录 一、多文件编程 二、Makefile 简单实例 2.1 简介 2.2 格式 2.3 实践 三、使用Makefile制作动态库、静态库 3.1 Linux下的库(动态库、静态库)简介 3.1.1 什么是库 3.1.2库的种类 3.2.3 库存在的意义 3.2.4在linux下如何制作库文件 3.2.5 查看可执行程序依赖的库(ldd命令) 3.2.6 如何让系找到库 3.2 Makefile制作静态库 3.3Makefile 制作动态库 3.4 Makefile的改...

jnxhz2008的博客 6908

调用一个makefile并同时生成动静态库

makefile、多个文件生成、动态库、静态库

xinyuantianzi的博客 2463

静态库和动态库介绍以及Makefile

1、库文件介绍 (1)库文件的提供方式:静态库/动态库 + 头文件说明。其中头文件是说明静态库/动态库里都实现了哪些函数,就好像是库的说明书一样,使用库的开发者需要根据头文件来使用库; (2)库文件的实质:就是将很多.o文件打包在一起。其中涉及到程序的预编译、编译、汇编、链接等过程,.o文件就是只编译不链接的文件; 2、库文件的作用 1.加快项目开发:库文件可以将大工程划分为一个一个的模块,每个模块的代码以库的形式提供,库与库之间只需要提前商定好交互头文件,然后每个库的开发人员就按照头文件进行同步开发

weixin_42031299的博客 3754

C++生成、编译动静态库(包含Makefile与CMake例子)

C++编译动静、态库(包含Makefile与CMake例子)编写demo只使用g++和ar使用Makefile使用Cmake 在Linux中,我们难免会用到各种各样的库,如静态库.a文件,动态库.so文件,我们要了解,库有什么用?库里面包含什么,通俗来讲,其实库里面包含了各种函数,调用库相当于调用库里面的函数。写这篇博客的意图源自于这两天使用到了库,但却对其不熟悉,调用总显示未定义。这篇博客将从三...

追 6454

ubuntu makefile 静态库的生成与调用,动态库的生成与调用

ubuntu makefile 静态库的生成与调用,动态库的生成与调用 准备工作 首先建立一个文件夹用以存放我们的文件 命令行下输入以下命令建立文件夹 mkdir Test cd Test 1.静态库的生成 新建一个文件夹,static用来存放静态库的数据,在static下新建include和src文件夹,在include文件夹下建立头文件static.h 内容如下: //st...

CaptainHailong的博客 1892

Makefile 生成静态库 工程源码实战

在 Makefile 中创建静态库具有重要的意义,尤其是在项目管理和软件构建方面。能够使代码模块化,代码重用度高。易于易于维护对某个功能进行修改或优化,只需要在一个地方更改静态库中的代码,而不是在项目的多个位置修改相同的代码。同时可以构建效率,减少编译时间。

weixin_42105599的博客 1215
上一篇: linux的库操作命令ar和nm
下一篇: Grep学习笔记
superlinux110
博客等级 码龄19年 1粉丝 2原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值