Easymake
最简单的Makefile,但是还是大程序少不了makefile工具
#CC=arm-linux-gnueabihf-
CC=
target:
$(CC)gcc -o algo_main algo_main.c cJSON.c -lm
clean:
@rm -rf algo_main
一、Easymake太好用了,偷懒神器,强力推荐.
1、根目录下的easymake.mk就是makefile模板,我们自定义的makefile只需要包含这个模板即可
include ../../easymake.mk
2、源码包自带的sample够我们参考应用了。
drwx------ 9月 : basics
drwx------ 9月 : so
drwx------ 9月 : staticLib
drwx------ 9月 : vpath
1) basics常规应用,包含一个shell脚本,也就是copy一份makefile文件
cp ../../easymake.mk Makefile
运行实例
dong@ubuntu:~/cb/easymake-master/samples/basics$ ./test.sh
cp ../../easymake.mk Makefile make
g++ -MP -MMD -c -o bin/math/add.o math/add.cpp
g++ -MP -MMD -c -o bin/add.o add.cpp
# main detected
g++ -o bin/add bin/math/add.o bin/add.o ./bin/add
add(,) returns create add_test.cpp make test
g++ -MP -MMD -c -o bin/add_test.o add_test.cpp
# main detected
g++ -o bin/add_test bin/math/add.o bin/add_test.o # run [bin/add_test]
# add_test: add_test.cpp:: int main(): Assertion `add(,)==' failed.
Makefile:: recipe for target 'test' failed
make: *** [test] Error
2)so生成库文件并且运行,用shell脚本来编译
make bin/libmylib.so g++ add_test.cpp -I. -L./bin/ -lmylib -o bin/target LD_LIBRARY_PATH=./bin/ ./bin/target
运行实例
dong@ubuntu:~/cb/easymake-master/samples/so$ ./so_test.sh
g++ -I. -fPIC -MP -MMD -c -o bin/math/add.o math/add.cpp
g++ -I. -fPIC -MP -MMD -c -o bin/add_test.o add_test.cpp
# main detected g++ -shared -o bin/libmylib.so bin/math/add.o
add(,)=
3)staticLib生成静态库,就不一一编译运行了,同上
4)vpath这个实例可以同时编译多个可运行项目,makefile只需要添加自定义的项目源码路径就行了
VPATH = ../src2 include ../../../easymake.mk
运行实例
dong@ubuntu:~/cb/easymake-master/samples/vpath/proj$ make
g++ -MP -MMD -c -o bin/math/add.o math/add.cpp
g++ -MP -MMD -c -o bin/main.o main.cpp
# main detected
g++ -MP -MMD -c -o bin/hello_world.o ../src2/hello_world.cpp
g++ -MP -MMD -c -o bin/test.o ../src2/test.cpp
# main detected
g++ -o bin/main bin/math/add.o bin/main.o bin/hello_world.o
g++ -o bin/test bin/math/add.o bin/hello_world.o bin/test.o
3、Easymake源码在这里下载
二、还有一堆cmake xmake nmake ...
CMake 入门实战
http://www.hahack.com/codes/cmake/
cmake升级
https://blog.csdn.net/learning_tortosie/article/details/80593956
wget https://cmake.org/files/v3.9/cmake-3.9.2.tar.gz
tar -xvf cmake-3.9.2.tar.gz
cd cmake-3.9.2
./configure
make
sudo make install
三、指定安装目录
一种是在./configure的时候指定路径
./configure --prefix=$(pwd)/_install
一种是make install的时候指定路径
make DESTDIR=$(pwd)/_install install
sudo pip2 install numpy --target=/usr/local/lib/python2.7/site-packages
四、gcc/g++升级和降级
由于在matlab中要使用mex,需要将原本的gcc '5.4.0' 版本降级(替换)为MEX支持的版本: '4.9.x'。
1.加入源,方便更新。
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
2.更新
sudo apt-get update
3.安装
sudo apt-get install gcc-4.9
sudo apt-get install g++-4.9
4.更新
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20
5.成功验证:
gcc --version
成功标志:
g++ (Ubuntu 4.9.4-2ubuntu1~16.04) 4.9.4
gcc --version
成功标志:
gcc (Ubuntu 4.9.4-2ubuntu1~16.04) 4.9.4
原文链接:https://blog.csdn.net/Pancheng1/article/details/83058833
cmake交叉编译
https://blog.csdn.net/qq_24011271/article/details/82498500
Easymake的更多相关文章
- 通用的 makefile 小工具分享 - Easymake 使用说明
Easymake 使用说明 介绍 Easymake 是一个在linux系统中 C/C++ 开发的通用 makefile.在一个简单的 C/C++ 程序中使用 easymake,你甚至可以不写一行 ma ...
- easymake cmake xmake nmake ...
最简单的Makefile,但是还是大程序少不了makefile工具 #CC=arm-linux-gnueabihf-CC=target: $(CC)gcc -o algo_main algo_m ...
- 工程管理之makefile与自动创建makefile文件过程
(风雪之隅 http://www.laruence.com/2009/11/18/1154.html) Linux Makefile自动编译和链接使用的环境 想知道到Linux Makefile系统的 ...
- project管理之makefile与自己主动创建makefile文件过程
(风雪之隅 http://www.laruence.com/2009/11/18/1154.html) Linux Makefile自己主动编译和链接使用的环境 想知道到Linux Makefile系 ...
随机推荐
- ORA-01033因误删表空间文件导致的解决方案
该类问题通常是由于表空间操作不当引起的.解决方法: SQL*Plus无法连接,显示以下错误:ORA-01033:ORACLE initialization or shutdown in progres ...
- Tomcat开机自启动
需要Tomcat开机自动启动应用: 首先.配置Java环境变量: 然后.新建变量:CATALINA_HOME=你的TOMCAT的根目录 最后.在PATH变量最后加上: ;%CATALINA_HOME% ...
- 烂泥:haproxy学习之手机规则匹配
本文由ilanniweb提供友情赞助,首发于烂泥行天下 想要获得更多的文章,可以关注我的微信ilanniweb. 今天我们来介绍下有关haproxy匹配手机的一些规则配置. 一.业务需要 现在根据业务 ...
- JS导出PDF插件(支持中文、图片使用路径)
在WEB上想做一个导出PDF的功能,发现jsPDF比较多人推荐,遗憾的是不支持中文,最后找到pdfmake,很好地解决了此问题.它的效果可以先到http://pdfmake.org/playgroun ...
- android setDestinationInExternalPublicDir 下载到SD卡根目录
一:setDestinationInExternalPublicDir(“Trinea”, “MeiLiShuo.apk”);表示设置下载地址为sd卡的Trinea文件夹,文件名为MeiLiShuo. ...
- JavaScript 动态插入 CSS
写组件时有时想把一些组件特性相关的 CSS 样式封装在 JS 里,这样更内聚,改起来方便.JS 动态插入 CSS 两个步骤就可以 创建一个 style 对象 使用 stylesheet 的 inser ...
- 一种可实时处理 O(1)复杂度图像去雾算法的实现。
在我博文的一系列的文章,有不少算法都于去雾有关,比如限制对比度自适应直方图均衡化算法原理.实现及效果.局部自适应自动色阶/对比度算法在图像增强上的应用这两个增强算法都有一定的去雾能力,而最直接的就是& ...
- C#学习笔记-图像处理篇(一)绘制公章
上个月免费帮别人做事,就一直在服务员和程序员中来回切换,所以好多事情都弄得乱糟糟的,家里也是乱七八糟的,所以学习这一块也放了一段时间. 刚刚开始当服务员的时间看到了形形色色的人,觉得很好玩,他们每个人 ...
- oracle连接方式、创建数据库用户、忘记数据库密码、用户锁定
一.oracle六种连接方式 ①myEclipse中 打开myEclipse,window----show view----Other---输入DB点击DB browser 选中右键New.出现如下页 ...
- 【C#】【Thread】SpinLock
SpinLock结构是一个低级别的互斥同步基元,它在等待获取锁时进行旋转. 在多核计算机上,当等待时间预计较短且极少出现争用情况时,SpinLock 的性能将高于其他类型的锁. 不过,我们建议您仅在通 ...