最近遇到这样脑缠问题,在纠结中;其实就是没有弄清楚原理:
#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
原创,希望对大几有用。