关于Makefile的正确使用
2016-03-24 12:08
513 查看
最近遇到这样脑缠问题,在纠结中;其实就是没有弄清楚原理:
#Makefile Example
test :hello.o test1.o test2.o
gcc -o test hello.o test1.o test2.o
hello.o :hello.c head1.h head2.h
gcc -c hello.c
test1.o :test1.c head1.h
gcc -c test1.c
test2.o :test2.c head2.h
gcc -c test2.c
install:
cp test/home/temp
clean:
rm -f*.o
~
~
~
这样用gcc编译的,只能在windows环境下运行,而不能在ARM下运行
也不能用arm-linux-gcc 编译(最近就是犯了大错,在这里纠结,现在才知道原理)
若想要在arm环境下运行,在makefile中把gcc 改为arm-linux-gcc,这样就可以在arm中运行了
#Makefile Example
test :hello.o test1.o test2.o
arm-linux-gcc -o test hello.o test1.o test2.o
hello.o :hello.c head1.h head2.h
arm-linux-gcc -c hello.c
test1.o :test1.c head1.h
arm-linux-gcc -c test1.c
test2.o :test2.c head2.h
arm-linmux-gcc -c test2.c
install:
cp test/home/temp
clean:
rm -f*.o
原创,希望对大几有用。
最近遇到这样脑缠问题,在纠结中;其实就是没有弄清楚原理:
#Makefile Example
test :hello.o test1.o test2.o
gcc -o test hello.o test1.o test2.o
hello.o :hello.c head1.h head2.h
gcc -c hello.c
test1.o :test1.c head1.h
gcc -c test1.c
test2.o :test2.c head2.h
gcc -c test2.c
install:
cp test/home/temp
clean:
rm -f*.o
~
~
~
这样用gcc编译的,只能在windows环境下运行,而不能在ARM下运行
也不能用arm-linux-gcc 编译(最近就是犯了大错,在这里纠结,现在才知道原理)
若想要在arm环境下运行,在makefile中把gcc 改为arm-linux-gcc,这样就可以在arm中运行了
#Makefile Example
test :hello.o test1.o test2.o
arm-linux-gcc -o test hello.o test1.o test2.o
hello.o :hello.c head1.h head2.h
arm-linux-gcc -c hello.c
test1.o :test1.c head1.h
arm-linux-gcc -c test1.c
test2.o :test2.c head2.h
arm-linmux-gcc -c test2.c
install:
cp test/home/temp
clean:
rm -f*.o
原创,希望对大几有用。
相关文章推荐
- Linux socket 初步
- Linux Kernel 4.0 RC5 发布!
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户
- Scientific Linux 5.5 图形安装教程
- XP下使用虚拟机安装配置Solaris[多图]