Help building "cmark" on Windows

I ran .\nmake.bat and got:

NMAKE : fatal error U1064: MAKEFILE not found and no target specified
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.

I inspected “Makefile.nmake” and tried to modify some bits but failed.

Do you have cmake installed?
It is required for the build.

Yes and cmake is in $PATH.
I just modified some bits and have built it successfully.

First, I made some edits to “Makefile.nmake”.

diff --git a/Makefile.nmake b/Makefile.nmake
index b0556e2..e4124a6 100644
--- a/Makefile.nmake
+++ b/Makefile.nmake
@@ -7,7 +7,7 @@ PROG=$(BUILDDIR)\src\cmark.exe
GENERATOR=NMake Makefiles

all: $(BUILDDIR)
    -	@cd $(BUILDDIR) && $(MAKE) /nologo && cd ..
    +	@cd $(BUILDDIR) && $(MAKE) /nologo /f ..\Makefile.nmake && cd ..

    $(BUILDDIR):
        @-mkdir $(BUILDDIR) 2> nul
        @@ -20,7 +20,7 @@ $(BUILDDIR):
            cd ..

            install: all
            -	@cd $(BUILDDIR) && $(MAKE) /nologo install && cd ..
            +	@cd $(BUILDDIR) && $(MAKE) /f ..\Makefile.nmake /nologo install && cd ..

            clean:
            -rmdir /s /q $(BUILDDIR) $(MINGW_INSTALLDIR) 2> nul
            @@ -29,7 +29,7 @@ $(SRCDIR)\case_fold_switch.inc: $(DATADIR)\CaseFolding-3.2.0.txt
            perl mkcasefold.pl < $? > $@

            test: $(SPEC) all
            -	@cd $(BUILDDIR) && $(MAKE) /nologo test ARGS="-V" && cd ..
            +	@cd $(BUILDDIR) && $(MAKE) /f ..\Makefile.nmake /nologo test ARGS="-V" && cd ..

            distclean: clean
            del /q src\scanners.c 2> nul

Then I ran .\nmake.bat and got:

...
cd build &&  cmake  -G "NMake Makefiles"  -D CMAKE_BUILD_TYPE=  -D CMAKE_INSTALL_PREFIX=windows  .. &&  cd ..
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Workspaces/cmark/build
NMAKE : fatal error U1052: file '..\Makefile.nmake' not found
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.

I supposed the build files are generated successfully.
I then reverted the change to “Makefile.nmake” and ran .\nmake.bat again. This time it succeeded.

So it seems the build script is not robust or not correct.

You should probably open an issue on the tracker. I don’t know much about Windows, but we can get the attention of the people who created this build script.

Incidentally, on appveyor we build cmark with one simple command, nmake. It seems to work fine:
https://ci.appveyor.com/project/jgm/cmark

Note that the build script might fail if the build directory exists but was not created with the appropriate files by running cmake. Can you try deleting the entire build directory, reverting nmake.bat to the version in the repository, and running it again? (But really this whole discussion should be moved to the github issue tracker.)

I’ll report this as an issue.

Previously I thought this as an ask-for-help and I want to know if the error is reproducible.

@jgm, @bohrshaw : if you want to build cmark using MSVC, maybe you find my clone helpful, see my comment over there in the issue #85 thread: I build cmark without using cmake or any build scripts, in the Visual Studio 2008 IDE.