I have a GNU makefile written for linux operating system. I want to compile it on windows but there are some syntax changes for windows. I have done some changes but I am getting an error on for loop syntax.
Make file code is already written and I have to modify it for running on windows OS. Original code is attached and the changes i made are also given Original code:
This is the original code:
@for i in $(subdirs); do \ (cd $$i && $(MAKE) $@) || break; \ done
After changes:
# pass make directives to subdirectories
SHELL = sh
%:
for f in $$(subdirs); \
do \
(cd $$i && $(MAKE) $@) || break; \
done
# eof
I am getting the error on line 16 which is first line of for loop
GNUmakefile(16) : fatal error U1035: syntax error : expected ':' or '=' separator
I made certain changes after reading nmake syntax. Now the problem is resolved. The %: is not needed and @for does not work. So we need to turn off echo using @echo off: and then for loop will work with simple 'for' keyword instead of @for. Working code is here:
SHELL = sh
# %:
@echo off :
for i in $(subdirs) ; \
do \
(cd $$i && $(MAKE) $@) || break; \
done
# eof