简体   繁体   中英

How do I run this Makefile?

I'm trying to run this Makefil but I don't know really how to do it. 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.

Do a Google for GNU make . Find the instructions to install on your system. Then run gmake from the directory containing your Makefile . Or it might just be make -- see the instructions when you install GNU make for specifics.

As the OP question is How do I run this Makefile? , so a proper question would be: you need an interpretar for makefiles in windows environment, such as nmake and gnu make. Nmake is shipped in Windows SDK. Gnu Make: you need a gnu development for windows like msys2. Notice that both nmake and gnu make has different syntax if you planning to work with makefiles.

One option to compile your code is to use CygWin ( https://cygwin.com/ )

It contains GNU Make, the clang compiler, a shell, and thousands of Unix/Linux tools ported to Windows. From their FAQ:

Cygwin is a distribution of popular GNU and other Open Source tools running on Microsoft Windows. The core part is the Cygwin library which provides the POSIX system calls and environment these programs expect.

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. 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. Cygwin allows easy porting of many Unix programs without the need for extensive changes to the source code. This includes configuring and building most of the available GNU or BSD software, including the packages included with the Cygwin distribution themselves. They can be used from one of the provided Unix shells like bash, tcsh or zsh

The installer is quite friendly, allows you to select which extra packages you need (in your case make and clang++). You can also install other compilers (like GNU g++), the GNU or the LLVM debuggers, and a long etcetera.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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