(二)Makefile——自动编译、清理、安装软件
每次都要敲击冗长的编译命令,每次都要清理之前的编译中间结果和最终结果,在安装软件时复制剪切大量的动态库,在卸载软件时删除很多的动态库和配置文件。好吧,我被逼向了makefile。
1 helloworld.o : helloworld.c 2 all: 3 @echo "make all:" 4 gcc -o helloworld.o helloworld.c 5 clean: 6 @echo "make clean:" 7 rm *.o 8 install: 9 @echo "make install:" 10 @echo " copy file to the install fold!" 11 uninstall: 12 @echo "uninstall" 13 doall: all clean install
试试make doall。
1 $ make doall 2 make all: 3 gcc -o helloworld.o helloworld.c 4 make clean: 5 rm *.o 6 make install: 7 copy file to the install fold!