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文件。

  • 相关阅读:
    列表 查找元素二分查找
    文件的追加
    Syste.IO 类介绍
    Ctack堆栈
    判断文件是否存在(Exists)
    复杂排序
    元素出栈和入站
    HTML文档中meta标签的作用 Generator KEYWords DEscription Author httpequiv属性
    Page.ClientScript.RegisterClientScriptBlock 失效
    用户名只能由字母或者数字组成(用户控件与HTML控件)
  • 原文地址:https://www.cnblogs.com/CodeWorkerLiMing/p/12007770.html
Copyright © 2011-2022 走看看