Makefile + SourceInsight的开发模式初探
来源:互联网 发布:自动止损软件 编辑:程序博客网 时间:2024/06/10 00:01
前言
之前对于这种开发模式,知道的并不多;但是后来到了公司之后发现再也见不到windows下那么傻瓜式的IDE了。目前,公司采用的samba+sourceinsight+linux云服务器。
1. samba主要是提供了linux和windows的文件共享;
2. SI主要用来看代码和写代码;
3. linux云则主要是用来交叉编译的。
这样整个开发流程就非常清楚了,非常适合感兴趣的同学对其中细节进行探索。本文就对其中的开发模式进行初步的搭建:主系统windows7+VirtualBox+ubuntu虚拟机;
ok 开干!
准备
1.系统自己装吧
2.安装Oracle VM VirtualBox,该软件免费;自己来吧~
3.到官网下载ubuntu镜像,将其导入VirtualBox中;自己来 哈哈~
实战
首先在SI里创建源文件和头文件,为了示例本文就写几个简单的函数了,大家可以举一反三:
注意:在此之前一定要设置一下,主机和虚拟机的共享文件夹(具体的实现方法可以自行搜索);这样你才能在windows下面编辑,并把修改的代码同步的保存到了虚拟机当中。
测试文件:
1.main.c
/** * function:the demo for the Makefile * describe:just demo * author:LaMar */#include "hello.h"int main(){ int iVal = 666; printf("MyVal is %d", iVal); printHello(); return 0;}
2.hello.c
/** * function:the demo for the Makefile * describe:just demo * author:LaMar */#include "hello.h"void printHello(){ char *cHello = "this is my first for Makefile..."; printf("\nHello everyone\n"); printf("%s\t\n", cHello);}
3.hello.h
/** * function:the demo for the Makefile * describe:just demo * author:LaMar */#ifndef __HELLO_H__#define __HELLO_H__#include<stdio.h>void printHello(void);#endif
好了,最后主角登场了(初学,请大牛们清喷~~)
Makefile
## just for the demo Makefile#BASE_DIR = $(shell pwd)OBJ = main.o hello.o.PHONY:all cleanall:demo mv *.o $(BASE_DIR)/obj mv demo $(BASE_DIR)/app @echo "compile finished..."demo:$(OBJ) cc -o demo $(OBJ)main.o:main.c cc -c $< -o $@hello.o:hello.c hello.h cc -c $< -o $@clean: rm $(BASE_DIR)/app/* $(BASE_DIR)/obj/*
测试结果
1.建立共享文件夹之后,我们可以看到windows下的东西和虚拟机下的东西一模一样:
然后是虚拟机的:
2.之后就是在当前目录下执行:make,一步到位把可执行文件和编译中间生成的.o文件分门别类的存放;最后,执行可执行文件,如我们所预期的那样,可以正常的运行程序。
参考资料(致敬前辈):
1. GNU+makefile中文手册
2. 跟我一起写 Makefile
WeChat:flappy_two 欢迎交流~
- Makefile + SourceInsight的开发模式初探
- 初探makefile
- 初探Makefile
- Android开发,MVP开发模式初探。
- Makefile的静态模式
- tvOS的开发初探
- 让sourceinsight支持查看makefile、kconfig以及.s代码的方法
- 【开发工具】[SourceInsight]:source insight 的sublime text 配色方案
- 为sourceinsight添加makefile和kconfig文件
- 为sourceinsight添加makefile和kconfig文件
- 为sourceinsight添加makefile和kconfig文件
- SourceInsight添加makefile,konfig,.s文件介绍
- 为sourceinsight添加makefile和configure文件
- 为sourceinsight添加makefile、kco…
- 为sourceinsight添加makefile、kco…
- sourceinsight添加makefile、kconfig、*.S文件支持
- 为sourceinsight添加makefile、kco…
- 初探MIS开发中C/S模式和B/S模式的结合策略
- ZOJ3704 I am Nexus Master!
- 导入或创建Android工程时报错:Errors running builder 'Android resource manager' on project
- 从源码讲解java线程池ThreadPoolExecuter的实现原理
- struts
- C各种数据类型总结
- Makefile + SourceInsight的开发模式初探
- 最好用的日志分析工具ELK
- ubuntu 下疑难杂症
- 九度OJ题目1026:又一版A+B
- 寻找单链表的中间结点
- [机器学习]机器学习笔记整理全解
- TCP编程
- System类的getProperties()和getProperty(String)
- Android对话框_详解