I'm running Windows 10 and am trying to write a Makefile to compile a C++ file that uses the SFML library as well as the nuklear libraries. I have MinGW installed and added to my PATH, and I also have GNU Make installed and added to my PATH. So I can call both make
and gcc
from a Command Prompt window.
The Makefile I'm editing is:
# Install
CC = gcc
BIN = demo
# Flags
CFLAGS += -s -O2
SRC = main.cpp
OBJ = $(SRC:.cpp=.o)
# Edit the line below to point to your SFML folder on Windows
SFML_DIR = C:/SFML-2.5.1/
BIN := $(BIN).exe
LIBS = -lmingw32 -DSFML_STATIC -lsfml-window-s -lsfml-system-s -lopengl32 -lwinmm -lgdi32
SFML_INC = -I $(SFML_DIR)/include
SFML_LIB = -L $(SFML_DIR)/lib
$(BIN):
$(CC) $(SRC) $(CFLAGS) -o $(BIN) $(SFML_INC) $(SFML_LIB) $(LIBS)
But as per the nuklear documentation, I need to include nuklear.h
in the Makefile. For my project, I have a directory called include
which contains nuklear.h
. The full path is similar to:
C:/Users/Me/Github Repositories/folder-1/folder-2/include/
So I make the following additions to the Makefile:
SFML_DIR = C:/SFML-2.5.1/
INCL_DIR = C:/Users/Me/Github Repositories/folder-1/folder-2/include/
$(BIN):
# $(CC) $(SRC) $(CFLAGS) -o $(BIN) $(SFML_INC) $(SFML_LIB) $(LIBS)
$(CC) $(SRC) $(CFLAGS) -o $(BIN) -I $(INCL_DIR) $(SFML_INC) $(SFML_LIB) $(LIBS)
I added the path to nuklear.h
and have asked included it in compilation by specifying the -I
flag. But I get the following error when I run Make
:
makefile:23: *** missing separator. Stop.
Now, there's a space in the path ("Github Reposities"). So I believe I need to add quotation marks to include the full path.
But when I add quotation marks to the full path, I get the following error:
make: *** No rule to make target `/Users/Me/Github', needed by `demo.exe'. Stop.
So I'm missing something when it comes to specifying paths in a Makefile on Windows. How can I add a complete path in my Makefile when the path contains spaces?