Reputation: 751
all: prd.exe
CC=cl
CFLAGS=-O2 -I../src -I. /W4
LDFLAGS = /Zi
LIBSRC = $(addprefix ../lib/, \
open.c malloc.c \
) \
$(addprefix ../src/, \
main.c \
) \
helper.c
LIBOBJS = $(LIBSRC:.c=.o)
prd.exe: ../src/main.obj
$(CC) $(LDFLAGS) -Fe$@ *.o
../src/main.obj: ../src/main.c
$(CC) $(CFLAGS) $(LIBOBJS) -c $< -Fo $@
.c.o:
$(CC) $(CFLAGS) $(LIBOBJS) -c $< -Fo $@
.c.i:
$(CC) $(CFLAGS) $(LIBOBJS) -C -E $< > $@
clean:
del /s /f /q ..\lib\*.o ..\src\*.o *.o *.exe *.pdb
distclean: clean
I get this error
fatal error U1000: syntax error : ')' missing in macro invocation at line 6
Am i missing something here? nmake does recognize addprefix, right?
Upvotes: 7
Views: 1694
Reputation: 72697
No, addprefix
is a GNU make extension. You have a GNUmakefile that requires GNU make (gmake) to process.
Alternatively, you could rewrite the GNU makefile to not use GNU extensions. In your case this should be easy:
LIBSRC = $(addprefix ../lib/, \
open.c malloc.c \
) \
$(addprefix ../src/, \
main.c \
) \
helper.c
becomes
LIBSRC = ../lib/open.c ../lib/malloc.c ../src/main.c helper.c
Upvotes: 3