zoukankan      html  css  js  c++  java
  • make编译文件名非为'makefile'、'Makefile'、'GNUmakefile'时的编译技巧

     在网络上看到下卖弄这么一段话

    The make command by default looks for makefile, Makefile, and GNUMakefile as the input file and you are having Makefile.txt in your folder. Just remove the file extension (.txt) and it should work.

    其实就是告诉我们make编译的时候,会在当前目录下按顺序查找寻文件名为“GNUmakefile”、“makefile”、“Makefile”的文件,然后进行编译,但是有的时候我们在练习或者测试的时候,需要编写不同版本的makefile文件,文件名有可能就不同了,那么怎么办呢?一下是我的使用心得,与大家一起分享:

    在我的文件夹里有如下的文件(windows sp3平台,TDM-GCC-4.5.2编译器):

    F:\Linux\makefile\example\exam1>ls
    main.c  makefile.mak  makefile2.mak  makefile3.mak  makefile4.mak  print.c  print.h

    想要用makefile编译makefile3.mak的时候,就:

    make -f makefil3.mak

    F:\Linux\makefile\example\exam1>make -f makefile3.mak
    gcc -c main.c
    gcc -c print.c
    gcc -o helloword main.o print.o

    这个不难,等到我们要make clean 的时候也要加-f的

    就是:

    make -f makefile3.mak clean

    F:\Linux\makefile\example\exam1>make clean -f makefile3.mak
    rm helloword.exe main.o print.o

    是不是成功了!?

    就是说-f选项会提示make去查找某个指定的makefile文件。

  • 相关阅读:
    [codevs2800]送外卖
    python JSON处理
    python系统编码格式
    python,django,mysql版本号查询
    django开发总结:
    python之---类和实例
    django Q和F查询
    合并多个python list以及合并多个 django QuerySet 的方法
    python学习之---匿名函数,返回函数,偏函数
    python学习之---生成器
  • 原文地址:https://www.cnblogs.com/CodeWorkerLiMing/p/12007769.html
Copyright © 2011-2022 走看看