I used to compile my programs with batch scripts on windows but I recently discovered makefiles which are much more efficient.
I had this line in my .bat
file that copied some dlls to the current directory at runtime and it worked perfectly.
copy C:\lib\glfw\glfw.dll
I tried the same line in my makefile and even tried the alternative cp
but my terminal prints this error even tho the file is IN the location I specified
process_begin: CreateProcess(NULL, copy C:\lib\glfw\glfw.dll, ...) failed
make (e=2): The system cannot find the file specified.
make: *** [core.exe] Error 2
Here is the full makefile that I am using. Mind you, absent the copy line it works like a charm.. what am I doing wrong or is this possible?
EXEC = core.exe
OBJS = src/obp.o
CC = g++
CFLAGS = -W -Wall
LIBS = -lSOIL -lglew32 -lglfw -lopengl32
LDFLAGS =
$(EXEC): $(OBJS)
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
copy C:\lib\glfw\glfw.dll
clean:
rm -f $(EXEC) $(OBJS) *~
It looks like you are running this from an MSYS
(or MinGW
) environment, which does not know about copy
. Instead, you can use
cp C:\lib\glfw\glfw.dll .
If you want to avoid the *nix like cp
, then you could use xcopy
as follows:
xcopy //Y C:\lib\glfw\glfw.dll
Note the double //
which is required to escape the /
.
Or you could run this in a regular MS-DOS
environment, in which case your clean
target will not work because rm
will not be found and you should use del
.
With your current setup, any built-in DOS
command will not be found. See Choosing the shell to read about how make
determines which shell to use.