简体   繁体   English

如何运行这个 Makefile?

[英]How do I run this Makefile?

I'm trying to run this Makefil but I don't know really how to do it.我正在尝试运行这个 Makefil,但我真的不知道该怎么做。 Here's the code:这是代码:

CXX = clang++
CFLAGS = -g -Wall -Wextra

all: hopscotch_hashing clean

hopscotch_hashing: hopscotch_hashing.o hash_funcs.o hopscotch_main.o
    ${CXX} ${CFLAGS} -o hopscotch_hashing hopscotch_main.o \
        hopscotch_hashing.o hash_funcs.o

clean:
    rm -rf *.dSYM
    rm *.o

hopscotch_main.o: hopscotch_main.cpp
hopscotch_hashing.o: hopscotch_hashing.h hopscotch_hashing.cpp
hash_funcs.o: hash_funcs.h hash_funcs.cpp

It's the first time that I encounter this, I'm working on Windows 10. Thanks to everyone.这是我第一次遇到这种情况,我正在研究Windows 10。谢谢大家。

Do a Google for GNU make .做一个 Google for GNU make Find the instructions to install on your system.找到在您的系统上安装的说明。 Then run gmake from the directory containing your Makefile .然后从包含Makefile的目录中运行gmake Or it might just be make -- see the instructions when you install GNU make for specifics.或者它可能只是make -- 请参阅安装GNU make时的说明以了解详细信息。

As the OP question is How do I run this Makefile?由于 OP 问题是如何运行这个 Makefile? , so a proper question would be: you need an interpretar for makefiles in windows environment, such as nmake and gnu make. ,所以一个正确的问题是:您需要一个解释器来解释 windows 环境中的 makefile,例如 nmake 和 gnu make。 Nmake is shipped in Windows SDK. Nmake 在 Windows SDK 中发货。 Gnu Make: you need a gnu development for windows like msys2. Gnu Make:你需要像 msys2 这样的 windows 的 gnu 开发。 Notice that both nmake and gnu make has different syntax if you planning to work with makefiles.请注意,如果您打算使用 makefile,则 nmake 和 gnu make 具有不同的语法。

One option to compile your code is to use CygWin ( https://cygwin.com/ )编译代码的一种选择是使用 CygWin ( https://cygwin.com/ )

It contains GNU Make, the clang compiler, a shell, and thousands of Unix/Linux tools ported to Windows.它包含 GNU Make、clang 编译器、shell 和数千个移植到 Windows 的 Unix/Linux 工具。 From their FAQ:从他们的常见问题解答中:

Cygwin is a distribution of popular GNU and other Open Source tools running on Microsoft Windows. Cygwin 是在 Microsoft Windows 上运行的流行 GNU 和其他开源工具的发行版。 The core part is the Cygwin library which provides the POSIX system calls and environment these programs expect.核心部分是 Cygwin 库,它提供了这些程序所期望的 POSIX 系统调用和环境。

The Cygwin distribution contains thousands of packages from the Open Source world including most GNU tools, many BSD tools, an X server and a full set of X applications. Cygwin 发行版包含来自开源世界的数千个软件包,包括大多数 GNU 工具、许多 BSD 工具、X 服务器和一整套 X 应用程序。 If you're a developer you will find tools, headers and libraries allowing to write Windows console or GUI applications that make use of significant parts of the POSIX API.如果您是开发人员,您会发现工具、头文件和库允许编写使用 POSIX API 重要部分的 Windows 控制台或 GUI 应用程序。 Cygwin allows easy porting of many Unix programs without the need for extensive changes to the source code. Cygwin 允许轻松移植许多 Unix 程序,而无需对源代码进行大量更改。 This includes configuring and building most of the available GNU or BSD software, including the packages included with the Cygwin distribution themselves.这包括配置和构建大多数可用的 GNU 或 BSD 软件,包括 Cygwin 发行版本身包含的软件包。 They can be used from one of the provided Unix shells like bash, tcsh or zsh它们可以从提供的 Unix 外壳之一使用,例如 bash、tcsh 或 zsh

The installer is quite friendly, allows you to select which extra packages you need (in your case make and clang++).安装程序非常友好,允许您 select 您需要哪些额外的软件包(在您的情况下是 make 和 clang++)。 You can also install other compilers (like GNU g++), the GNU or the LLVM debuggers, and a long etcetera.您还可以安装其他编译器(如 GNU g++)、GNU 或 LLVM 调试器,等等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM