TARGET = main
OBJ_PATH = objs
PREFIX_BIN =
CC = gcc
CPP = g++
INCLUDES = -I include
LIBS =
CFLAGS =-Wall -Werror -O2 -g
LINKFLAGS =
SRCDIR = . ./lua
#C_SOURCES = $(wildcard *.c)
C_SRCDIR = $(SRCDIR)
C_SOURCES = $(foreach d,$(C_SRCDIR),$(wildcard $(d)/*.c) )
C_OBJS = $(patsubst %.c, $(OBJ_PATH)/%.o, $(C_SOURCES))
#CPP_SOURCES = $(wildcard *.cpp)
CPP_SRCDIR = $(SRCDIR)
CPP_SOURCES = $(foreach d,$(CPP_SRCDIR),$(wildcard $(d)/*.cpp) )
CPP_OBJS = $(patsubst %.cpp, $(OBJ_PATH)/%.o, $(CPP_SOURCES))
default:init compile
$(C_OBJS):$(OBJ_PATH)/%.o:%.c
$(CC) -c $(CFLAGS) $(INCLUDES) $< -o $@
$(CPP_OBJS):$(OBJ_PATH)/%.o:%.cpp
$(CPP) -c $(CFLAGS) $(INCLUDES) $< -o $@
init:
$(foreach d,$(SRCDIR), mkdir -p $(OBJ_PATH)/$(d);)
test:
@echo "C_SOURCES: $(C_SOURCES)"
@echo "C_OBJS: $(C_OBJS)"
@echo "CPP_SOURCES: $(CPP_SOURCES)"
@echo "CPP_OBJS: $(CPP_OBJS)"
compile:$(C_OBJS) $(CPP_OBJS)
$(CPP) $^ -o $(TARGET) $(LINKFLAGS) $(LIBS)
clean:
rm -rf $(OBJ_PATH)
rm -f $(TARGET)
install: $(TARGET)
cp $(TARGET) $(PREFIX_BIN)
uninstall:
rm -f $(PREFIX_BIN)/$(TARGET)
rebuild: clean init compile
相关推荐
Linux makefile 文件的使用例子,用Makefile编译多个文件
Linux makefile 文件的使用例子,用Makefile编译多个文件。 一个简单的Makefile的编写,适合初学者.
vscode, cmake编译多个C++文件
目的是利用vscode及相关插件编译多个C++文件。 我已经装好cmake和mingw并且将它们的路径添加到系统变量path中了。 vscode装上如下几个插件: 点击vscode左上角 文件->首选项->设置,弹出如下窗口: cmake tools里头有一项cmake.preferredGenerators要根据编译器修改成对应的值,mingw对应的是...
Makefile标准模板,清晰明了,支持c和c++混合编程
更多请参考我的链接:http://blog.youkuaiyun.com/haohaojian/article/details/54630572
多目录、多文件的Makefile的编写
makefile多目录设计
Makefile万能通用版(C++和C混合编译也适用)
通用版,Makefile C++和c混合编译
LINUX C++下多个Makefile编写方法
在Readme文档中有详细描述。这个小程序有3个makefile组成,一个主makefile,两个子makefile。在各个makefile中都有详细的注释,供学习使用。
多文件目录下makefile文件递归执行编译所有c文件
首先说说本次嵌套执行makefile文件的目的:只需make根目录下的makefile文件,即可编译所有c文件,包括子目录下的。 **意义:**自动化编译行为,以后编译自己的c文件时可把这些makefile文件直接复制到相应目录即可方便编译出所有文件。这些makefile文件是通用的,只需根据自己的工程情况改动少许内容即可。下面会说。 **总体思路是:**把目标文件放在debug文件夹下的obj目录下,把最终的二进制文件放在debug文件夹下的bin目录下;如何递归编译所有除了debug目录下的makefi
RK3568开发板Debian系统屏幕旋转终极指南:从临时调整到永久设置
本文提供了RK3568开发板在Debian系统下实现屏幕旋转的完整解决方案。从使用xrandr命令进行临时调整,到修改X11配置文件实现永久设置,详细讲解了操作步骤与核心原理。指南还涵盖了多屏异显配置、触摸屏坐标校准等进阶技巧,帮助开发者彻底解决显示方向问题。
makefile 中c/c++混编编译遇到的问题
makefile 中c/c++混编编译遇到的问题 前提:三个文件server.c client.c wrapper.c,c风格编写的,server.c包含了c++11的内容。mac os下面编译。 其中server.c包含了c++11的内容,其他部分使用c风格的方式写的,为了以后扩展写了makefile编译,其中遇到了很多问题,花了很长时间来解决,记录如下: 编译命令是gcc/g++,有clang的warning报错 clang: warning: treating ‘c’ input as ‘c++’
【多模态大模型】GLIP:零样本目标检测新范式与视觉语言理解
本文深入解析了多模态大模型GLIP在零样本目标检测和视觉语言理解领域的创新应用。GLIP通过统一目标检测与自然语言理解任务,实现了零样本学习能力,能够精准定位复杂文本描述对应的图像区域。文章详细介绍了GLIP的核心技术、数据策略及实战表现,并对比了与其他多模态模型的差异,为AI视觉理解提供了新范式。
生成对抗网络(GAN、DCGAN、ACGAN)-----学习笔记
生成对抗网络学习笔记 生成对抗网络有两个关键结构:生成模型、判别模型。 生成模型:输入是一个服从正态分布的N维向量,利用这个N维向量生成一张图片。 判别模型:对于生成模型输出的图像判别它是不是真的图像。 生成模型和判别模型的博弈关系在于:生成模型的目的是生成让判别模型无法判别真伪的图像,而判别模型的目的是判断输入图像的真伪。 结合代码来看生成对抗网络中,生成器和判别器的训练过程: 判别模型的训...
Linux开发(4):使用Make工具编译文件,编写Makefile文件
在学习开发Linux的过程中,我们时常需要编译繁多的C文件,而仅靠gcc编译器来进行编译,所执行的操作语句繁多,并且每次编译都要重新编译所有相关文件,占用系统内存较大,因此需要使用Make工具来进行批量的编译,类似于在visual studio中点击编译,系统自动将大量文件编译成程序一样。Make使用Makefile的过程:首先目的是达成A,为了生成A,需要B和C,达成B和C又分别需要执行相应的命令语句,执行完后最终生成A。rm -f hello.c # 达成clear执行的语句/目标要执行的命令。
C# Socket网络通信UDP(关键字:Socket)
简单Socket-Udp通信 在本文中涉及到通信,仅做简单的通信(服务端接受消息,由客户端发出消息) 如有需要,根据需求可直接copy使用 关键字Socket 需要引用命名空间: using System.Net; using System.Net.Sockets; 服务端: using System; using System.Net; using System.Net.Sockets; u...
Linux C++ Makefile
bash高级教程&Makefile https://blog.youkuaiyun.com/andrewgithub/column/info/28744 Linux技术 https://blog.youkuaiyun.com/qdylan/article/category/754137 Linux下C++的通用Makefile与解析 https://blog.youkuaiyun.com/d...
深入解析SerDes系统中的时钟数据恢复电路(CDR)——基于Cadence的PLL/Bang-Bang/PS-PI架构实现与仿真
本文深入解析SerDes系统中的时钟数据恢复电路(CDR),重点探讨基于Cadence平台的PLL、Bang-Bang和PS-PI三种架构的实现与仿真。通过详细的技术对比和工程实践案例,揭示CDR在高速串行通信中的关键作用,并提供TSMC 28nm工艺下的优化策略与故障排查经验,助力工程师应对10Gbps以上SerDes设计挑战。
一文搞定 GitHub SSH Key:生成、配置、好处全攻略
本文详细介绍了如何配置GitHub SSH Key,实现免密安全认证。主要内容包括:SSH协议的四大优势(免密登录、安全性高、稳定省心、支持自动化);Git身份配置步骤;检查本地SSH Key;生成RSA密钥对;添加密钥到SSH代理;复制公钥到GitHub;测试连接。配置完成后,开发者可通过SSH地址克隆仓库,实现push/pull全程免密操作。该方案显著提升Git使用效率,同时保障安全性,是开发者必备技能。
C和CPP联合交叉编译,出现arm-himix200-linux-g++:linker input file unused because linking not done 提示
最近在用海思的makefile编译一些库,在遇到C和CPP联合混编的时候出现一些问题,以此做个记录 Makefile如下: SMP_SRCS := $(shell find ./ -name "*.c") SMP_SRCPPS := $(shell find ./ -name "*.cpp") OBJS := $(SMP_SRCS:%.c=%.o) CPPOBJS := $(SMP_SRCPPS:%.cpp=%.o) CFLAGS += $(COMM_INC) TARGET := libxxx.
【雕爷学编程】Arduino动手做(111)---震动提醒模块
37款传感器与执行器的提法,在网络上广泛流传,其实Arduino能够兼容的传感器模块肯定是不止这37种的。鉴于本人手头积累了一些传感器和执行器模块,依照实践出真知(一定要动手做)的理念,以学习和交流为目的,这里准备逐一动手尝试系列实验,不管成功(程序走通)与否,都会记录下来---小小的进步或是搞不掂的问题,希望能够抛砖引玉。
linux 交叉编译 makefile,简单谈谈Makefile和交叉编译工具链
先来简单谈谈生成一个可执行文件所需要的过程预处理(preprocessing)->编译(compilation)->汇编(assembly)->连接(linking)编译:.c->.s 汇编:.s->.o 连接:多个.o合并成一个可执行文件。在平常通过将上述四步统称为“编译”接下来通过两个简单的例子来简单分析MakefileMakefile三大组成:目标、依赖、命令一...
Python 爬虫实战:去哪儿网机票价格爬取与出行比价分析
本文介绍了一个基于Python的机票价格监控系统,通过爬取去哪儿网数据实现多航线查询与智能比价。系统采用requests+BeautifulSoup+selenium技术栈,具备以下功能: 实时查询指定航线价格 历史价格追踪与分析 最低价推荐与价格预警 数据可视化展示 文章详细解析了去哪儿网的页面结构和反爬机制,提供了Selenium浏览器的完整配置方案,并实现了一个可稳定运行的机票采集爬虫。该系统能帮助用户掌握价格波动规律,选择最优购票时机,每年可节省可观的出行成本。
STM32F407中文手册
STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。
makefile交叉编译helloworld
makefile交叉编译helloworld主要需要修改的是在本地编译helloworld基础上修改本地工具链为交叉编译工具链。 1.本地使用makefile编译helloworld 如图为工程目录结构 . ├── hello.c ├── hello.h ├── main.c ├── Makefile ├── world.c └── world.h hello.c文件 #include<stdio.h> #include"hello.h" void hello() { prin
深度学习工具包 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');```[](https://bitdeli.com/free "Bitdeli Badge")
C++使用指定Makefile文件进行编译
如果在同一目录下存在多个Makefile文件,或者使用其他目录下的Makefile文件,可以使用“make -f xxx-Makeflie”
jre9下载 jdk9
(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】
数学建模模型总结
这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!
MakeFile 学习日记三(C++)makeFile 注释、引用其他makefile、通配符、文件搜索
一、Makefile的注释: Make file中只有行注释,在Unix的Shell脚本一样,其注释是用”#“字符,类似于C++中的"//”,如果要在Makefile中使用“#” 要用“\”进行转义 :“\#” 在makefile中的命令,必须要以【Tab】键开始 二、引用其他的Makefile 在Make file中可以使用include关键字可以把别的Makefile包含进来,被包含的文件要放在当前文件的包含位置。Make file的语法: Inc...
C++通用makefile文件
#创建bin目录用来存放可执行程序 TAG_DIR = ./bin $(shell mkdir -p ${TAG_DIR}) #将当前路径和src目录下的所有cpp文件包含 SRC = $(wildcard .cpp) $(wildcard src/.cpp) DIR=$(notdir (SRC))OBJ=(SRC)) OBJ=(SRC))OBJ=(patsubst %.cpp, %.o, KaTeX parse error: Expected 'EOF', got '#' at position 8: (
Makefile编译C++多文件
Makefile编译C++多文件 今天刚开始接触Makefile,发现挺有用的对于C/C++多文件编译 1、多文件: main.cpp Monster.h Monster.cpp Ultraman.h Ultraman.cpp 2、Makefile编写 CC=g++ target=main srcpp=main.cpp Monster.cpp Ultraman.cpp obj=$(...
1160



被折叠的 条评论
为什么被折叠?



