title: Makefile under Windows Troubles
body: <p>I got a Makefile that works just fine under linux. Though, I have tried in two ways to use it under windows: </p>
  
  <p>1) with nmake. I get the error "makefile(122) : fatal error U1033: syntax error : '$(CPPCOMPILER)' unexpected" thats te line "$(CPPCOMPILER) src/train.cpp $(TRANSITION_O) \".</p>
  
  <p>2) with Cygwin and the make plugin: "I get no rule to make target include/aux.cpp required by include/aux.o"</p>
  
  <p>But I can find no proper help online for making a very simple Makefile uch as this one just work under Windows that worked under Linux </p>
  
  <pre><code>########################################################################
  # variables
  ########################################################################
  
  LIST_H = include/lists/list.h
  LIST_CPP = include/lists/list.cpp
  LIST_O = include/lists/list.o
  
  TRANSITION_H = include/lists/transition.h
  TRANSITION_CPP = include/lists/transition.cpp
  TRANSITION_O = include/lists/transition.o
  
  TRANSITION_LIST_H = include/lists/transitionList.h
  TRANSITION_LIST_CPP = include/lists/transitionList.cpp
  TRANSITION_LIST_O = include/lists/transitionList.o
  
  STRING_LIST_H = include/lists/stringList.h
  STRING_LIST_CPP = include/lists/stringList.cpp
  STRING_LIST_O = include/lists/stringList.o
  
  ELEMENT_H = include/lists/element.h
  ELEMENT_CPP = include/lists/element.cpp
  ELEMENT_O = include/lists/element.o
  
  TEST_CPP = include/lists/test.cpp
  TEST_BIN = test.exe
  
  AUX_H = include/aux.h
  AUX_CPP = include/aux.cpp
  AUX_O = include/aux.o
  
  TRIE_H = include/trie/trie.h
  TRIE_CPP = include/trie/trie.cpp
  TRIE_O = include/trie/trie.o
  
  HMM_H = include/hmm/hmm.h
  HMM_O = include/hmm/hmm.o
  
  TRELLIS_H = include/hmm/trellis.h
  TRELLIS_O = include/hmm/trellis.o
  
  TRAINER_H = include/trainer/trainer.h
  TRAINER_O = include/trainer/trainer.o
  
  STATICSTICS = data/hmm/x.txt
  
  CPPCOMPILER = cl
  CPPCOMPILEROPTIONS1 = /Ox
  
  # doxygen-file
  DOC_INDEX = doc/html/index.html
  
  # corpus file
  corpus = '../data/tiger.txt'
  # comment tag
  tag = \#
  in = 'data/testfile.txt'
  
  STATS = data/HMM/all_trans.dat
  
  
  ########################################################################
  # targets
  ########################################################################
  
  
  $(TRANSITION_O) : $(TRANSITION_CPP) $(TRANSITION_H)
      $(CPPCOMPILER) $(CPPCOMPILEROPTIONS1) $(TRANSITION_CPP) -o \
      $(TRANSITION_O)
  
  $(TRANSITION_LIST_O) : $(TRANSITION_LIST_CPP) $(TRANSITION_LIST_H)
      $(CPPCOMPILER) $(CPPCOMPILEROPTIONS1) $(TRANSITION_LIST_CPP) -o \
      $(TRANSITION_LIST_O)
  
  $(STRING_LIST_O) : $(STRING_LIST_CPP) $(STRING_LIST_H) $(LIST_O) \
      $(ELEMENT_O)
      $(CPPCOMPILER) $(CPPCOMPILEROPTIONS1) $(STRING_LIST_CPP) -o \
      $(STRING_LIST_O)
  
  $(AUX_O) : $(AUX_CPP) $(AUX_H)
      $(CPPCOMPILER) $(CPPCOMPILEROPTIONS1) $(AUX_CPP) -o $(AUX_O)
  
  $(ELEMENT_O) : $(ELEMENT_CPP) $(ELEMENT_H)
      $(CPPCOMPILER) $(CPPCOMPILEROPTIONS1) $(ELEMENT_CPP) -o $(ELEMENT_O)
  
  $(LIST_O) : $(LIST_CPP) $(LIST_H)
      $(CPPCOMPILER) $(CPPCOMPILEROPTIONS1) $(LIST_CPP) -o $(LIST_O)
  
  $(TRIE_O) : $(TRIE_CPP) $(TRIE_H)
      $(CPPCOMPILER) $(CPPCOMPILEROPTIONS1) $(TRIE_CPP) -o $(TRIE_O)
  
  $(HMM_O) : $(HMM_H) $(TRELLIS_H)
      $(CPPCOMPILER) $(CPPCOMPILEROPTIONS1) $(HMM_H) -o $(HMM_O)
  
  # make documentation
  documentation: $(DOC_INDEX)
  
  $(DOC_INDEX):
      doxygen doc/hmm.doxygen
      mv html doc
  
  clean:
      rm -rf doc/html
      rm -rf doc/latex
      find . -name '*.o' -delete
      find . -name '*.exe' -delete
      find . -name '*.gch' -delete
      find . -name '*.out' -delete
      find . -name '*.png' -delete
      find . -name '*.dat' -delete
  
  # gathers statistics from corpus file to train HMM on. Requires
  # one token-tag-tuple per line. call format:
  # 'make statistics corpus=&lt;corpus file&gt; tag=&lt;comment tag char&gt;'
  statistics: $(STATS)
  
  $(STATS): $(TRANSITION_O) $(TRANSITION_LIST_O) $(AUX_O) $(LIST_O) \
      $(ELEMENT_O) $(TRIE_O) $(STRING_LIST_O)
  
      $(CPPCOMPILER) src/train.cpp $(TRANSITION_O) \
      $(TRANSITION_LIST_O) $(AUX_O) $(LIST_O) $(ELEMENT_O) $(TRIE_O) \
      $(STRING_LIST_O) -o train.exe
      mv train.exe bin/train.exe
      cd bin; ./train.exe $(corpus) '$(tag)'
  
  # taggs sentences in input file. Requires a sentence to occupy a line
  # all by itself; call format: 'make test in=&lt;file&gt;'
  test: $(TRANSITION_O) $(TRANSITION_LIST_O) $(AUX_O) $(LIST_O) \
      $(ELEMENT_O) $(TRIE_O) $(STRING_LIST_O) $(STATS) $(HMM_O)
  
      $(CPPCOMPILER) src/hmm_test.cpp $(TRANSITION_O) \
      $(TRANSITION_LIST_O) $(AUX_O) $(LIST_O) $(ELEMENT_O) $(TRIE_O) \
      $(STRING_LIST_O) -o hmm_test.exe
      mv hmm_test.exe bin/hmm_test.exe
      cd bin; ./hmm_test.exe ../$(in)
  </code></pre>
  
  <h1>EDIT</h1>
  
  <p>I got make to work under windows now, but it still behaves weird, producing object files in the same directory the Makefile is located, rather than in their own respective directories.</p>
  
  <pre><code>########################################################################
  # variables
  ########################################################################
  
  LIST_H = include\lists\list.h
  LIST_CPP = include\lists\list.cpp
  LIST_O = include\lists\list.obj
  
  TRANSITION_H = include\lists\transition.h
  TRANSITION_CPP = include\lists\transition.cpp
  TRANSITION_O = include\lists\transition.obj
  
  TRANSITION_LIST_H = include\lists\transitionList.h
  TRANSITION_LIST_CPP = include\lists\transitionList.cpp
  TRANSITION_LIST_O = include\lists\transitionList.obj
  
  STRING_LIST_H = include\lists\stringList.h
  STRING_LIST_CPP = include\lists\stringList.cpp
  STRING_LIST_O = include\lists\stringList.obj
  
  ELEMENT_H = include\lists\element.h
  ELEMENT_CPP = include\lists\element.cpp
  ELEMENT_O = include\lists\element.obj
  
  TEST_CPP = include\lists\test.cpp
  TEST_BIN = test.exe
  
  AUXILS_H = include\auxils.h
  AUXILS_CPP = include\auxils.cpp
  AUXILS_O = include\auxils.obj
  
  TRIE_H = include\trie\trie.h
  TRIE_CPP = include\trie\trie.cpp
  TRIE_O = include\trie\trie.obj
  
  HMM_H = include\hmm\hmm.h
  HMM_O = include\hmm\hmm.obj
  
  TRELLIS_H = include\hmm\trellis.h
  TRELLIS_O = include\hmm\trellis.obj
  
  TRAINER_H = include\trainer\trainer.h
  TRAINER_O = include\trainer\trainer.obj
  
  CPPCOMPILER = cl
  
  # doxygen-file
  DOC_INDEX = doc\html\index.html
  
  # corpus file
  corpus = '..\data\tiger.txt'
  # comment tag
  tag = \#
  in = 'data\testfile.txt'
  
  STATS = data\HMM\all_trans.dat
  
  
  ########################################################################
  # targets
  ########################################################################
  
  
  $(TRANSITION_O) : $(TRANSITION_CPP) $(TRANSITION_H)
      $(CPPCOMPILER) $(TRANSITION_CPP)
  
  $(TRANSITION_LIST_O) : $(TRANSITION_LIST_CPP) $(TRANSITION_LIST_H)
      $(CPPCOMPILER) $(TRANSITION_LIST_CPP)
  
  $(STRING_LIST_O) : $(STRING_LIST_CPP) $(STRING_LIST_H) $(LIST_O) \
      $(ELEMENT_O)
      $(CPPCOMPILER) $(STRING_LIST_CPP) 
  
  $(AUXILS_O) : $(AUXILS_CPP) $(AUXILS_H)
      $(CPPCOMPILER) $(AUXILS_CPP)
  
  $(ELEMENT_O) : $(ELEMENT_CPP) $(ELEMENT_H)
      $(CPPCOMPILER) $(ELEMENT_CPP)
  
  $(LIST_O) : $(LIST_CPP) $(LIST_H)
      $(CPPCOMPILER) $(LIST_CPP)
  
  $(TRIE_O) : $(TRIE_CPP) $(TRIE_H)
      $(CPPCOMPILER) $(TRIE_CPP)
  
  $(HMM_O) : $(HMM_H) $(TRELLIS_H)
      $(CPPCOMPILER) $(HMM_H)
  
  # make documentation
  documentation: $(DOC_INDEX)
  
  $(DOC_INDEX):
      doxygen doc\hmm.doxygen
      mv html doc
  
  clean:
      rm -rf doc\html
      rm -rf doc\latex
      find . -name '*.obj' -delete
      find . -name '*.exe' -delete
      find . -name '*.gch' -delete
      find . -name '*.out' -delete
      find . -name '*.png' -delete
      find . -name '*.dat' -delete
  
  # gathers statistics from corpus file to train HMM on. Requires
  # one token-tag-tuple per line. call format:
  # 'make statistics corpus=&lt;corpus file&gt; tag=&lt;comment tag char&gt;'
  statistics: $(STATS)
  
  $(STATS): $(TRANSITION_O) $(TRANSITION_LIST_O) $(AUXILS_O) $(LIST_O) \
      $(ELEMENT_O) $(TRIE_O) $(STRING_LIST_O)
  
      $(CPPCOMPILER) src\train.cpp $(TRANSITION_O) \
      $(TRANSITION_LIST_O) $(AUXILS_O) $(LIST_O) $(ELEMENT_O) $(TRIE_O) \
      $(STRING_LIST_O)
      mv train.exe bin\train.exe
      cd bin; train.exe $(corpus) '$(tag)'
  
  # taggs sentences in input file. Requires a sentence to occupy a line
  # all by itself; call format: 'make test in=&lt;file&gt;'
  test: $(TRANSITION_O) $(TRANSITION_LIST_O) $(AUXILS_O) $(LIST_O) \
      $(ELEMENT_O) $(TRIE_O) $(STRING_LIST_O) $(STATS) $(HMM_O)
  
      $(CPPCOMPILER) src\hmm_test.cpp $(TRANSITION_O) \
      $(TRANSITION_LIST_O) $(AUXILS_O) $(LIST_O) $(ELEMENT_O) $(TRIE_O) \
      $(STRING_LIST_O)
      mv hmm_test.exe bin\hmm_test.exe
      cd bin; hmm_test.exe ..\$(in)
  </code></pre>
  
  <h1>EDIT 2</h1>
  
  <p>I added the object file flag according to <a href="https://msdn.microsoft.com/en-us/library/yb8e9b8y.aspx" rel="nofollow">https://msdn.microsoft.com/en-us/library/yb8e9b8y.aspx</a></p>
  
  <p>But apparently I got it wrong. I  get:</p>
  
  <pre><code>C:\&lt;path&gt;&gt;make test
  cl /Fo\include\lists\transition.obj include\lists\transition.cpp
  
  transition.cpp
  C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xlocale(337) : warning C4530: C++ exception handler used, but unwind semantics are not
  enabled. Specify /EHsc
  C:\&lt;path&gt;\include\lists\transition.cpp : fatal error C1083: Cannot open compiler generated file: '\in
  clude\lists\transition.obj': No such file or directory
  make: *** [\include\lists\transition.obj] Error 1
  
  
  
  
  
  
  ########################################################################
      # variables
  </code></pre>
  
  #
  
  <pre><code>LIST_H = include\lists\list.h
  LIST_CPP = include\lists\list.cpp
  LIST_O = \include\lists\list.obj
  
  TRANSITION_H = include\lists\transition.h
  TRANSITION_CPP = include\lists\transition.cpp
  TRANSITION_O = \include\lists\transition.obj
  
  TRANSITION_LIST_H = include\lists\transitionList.h
  TRANSITION_LIST_CPP = include\lists\transitionList.cpp
  TRANSITION_LIST_O = \include\lists\transitionList.obj
  
  STRING_LIST_H = include\lists\stringList.h
  STRING_LIST_CPP = include\lists\stringList.cpp
  STRING_LIST_O = \include\lists\stringList.obj
  
  ELEMENT_H = include\lists\element.h
  ELEMENT_CPP = include\lists\element.cpp
  ELEMENT_O = \include\lists\element.obj
  
  TEST_CPP = include\lists\test.cpp
  TEST_BIN = test.exe
  
  AUXILS_H = include\auxils.h
  AUXILS_CPP = include\auxils.cpp
  AUXILS_O = \include\auxils.obj
  
  TRIE_H = include\trie\trie.h
  TRIE_CPP = include\trie\trie.cpp
  TRIE_O = \include\trie\trie.obj
  
  HMM_H = include\hmm\hmm.h
  HMM_O = \include\hmm\hmm.obj
  
  TRELLIS_H = include\hmm\trellis.h
  TRELLIS_O = \include\hmm\trellis.obj
  
  TRAINER_H = include\trainer\trainer.h
  TRAINER_O = \include\trainer\trainer.obj
  
  CPPCOMPILER = cl
  TO_OBJ = /Fo
  
  # doxygen-file
  DOC_INDEX = doc\html\index.html
  
  # corpus file
  corpus = '..\data\tiger.txt'
  # comment tag
  tag = \#
  in = 'data\testfile.txt'
  
  STATS = data\HMM\all_trans.dat
  
  
  ########################################################################
  # targets
  ########################################################################
  
  
  $(TRANSITION_O) : $(TRANSITION_CPP) $(TRANSITION_H)
      $(CPPCOMPILER) $(TO_OBJ)$(TRANSITION_O) $(TRANSITION_CPP)
  
  $(TRANSITION_LIST_O) : $(TRANSITION_LIST_CPP) $(TRANSITION_LIST_H)
      $(CPPCOMPILER) $(TO_OBJ)$(TRANSITION_LIST_O) $(TRANSITION_LIST_CPP)
  
  $(STRING_LIST_O) : $(STRING_LIST_CPP) $(STRING_LIST_H) $(LIST_O) \
      $(ELEMENT_O)
      $(CPPCOMPILER) $(TO_OBJ)$(STRING_LIST_O) $(STRING_LIST_CPP)
  
  $(AUXILS_O) : $(AUXILS_CPP) $(AUXILS_H)
      $(CPPCOMPILER) $(TO_OBJ)$(AUXILS_O) $(AUXILS_CPP)
  
  $(ELEMENT_O) : $(ELEMENT_CPP) $(ELEMENT_H)
      $(CPPCOMPILER) $(TO_OBJ)$(ELEMENT_O) $(ELEMENT_CPP)
  
  $(LIST_O) : $(LIST_CPP) $(LIST_H)
      $(CPPCOMPILER) $(TO_OBJ)$(LIST_O) $(LIST_CPP)
  
  $(TRIE_O) : $(TRIE_CPP) $(TRIE_H)
      $(CPPCOMPILER) $(TO_OBJ)$(TRIE_O) $(TRIE_CPP)
  
  $(HMM_O) : $(HMM_H) $(TRELLIS_H)
      $(CPPCOMPILER) $(TO_OBJ)$(HMM_O) $(HMM_H)
  
  # make documentation
  documentation: $(DOC_INDEX)
  
  $(DOC_INDEX):
      doxygen doc\hmm.doxygen
      mv html doc
  
  clean:
      rm -rf doc\html
      rm -rf doc\latex
      find . -name '*.obj' -delete
      find . -name '*.exe' -delete
      find . -name '*.gch' -delete
      find . -name '*.out' -delete
      find . -name '*.png' -delete
      find . -name '*.dat' -delete
  
  # gathers statistics from corpus file to train HMM on. Requires
  # one token-tag-tuple per line. call format:
  # 'make statistics corpus=&lt;corpus file&gt; tag=&lt;comment tag char&gt;'
  statistics: $(STATS)
  
  $(STATS): $(TRANSITION_O) $(TRANSITION_LIST_O) $(AUXILS_O) $(LIST_O) \
      $(ELEMENT_O) $(TRIE_O) $(STRING_LIST_O)
  
      $(CPPCOMPILER) src\train.cpp $(TRANSITION_O) \
      $(TRANSITION_LIST_O) $(AUXILS_O) $(LIST_O) $(ELEMENT_O) $(TRIE_O) \
      $(STRING_LIST_O)
      mv train.exe bin\train.exe
      cd bin; train.exe $(corpus) '$(tag)'
  
  # taggs sentences in input file. Requires a sentence to occupy a line
  # all by itself; call format: 'make test in=&lt;file&gt;'
  test: $(TRANSITION_O) $(TRANSITION_LIST_O) $(AUXILS_O) $(LIST_O) \
      $(ELEMENT_O) $(TRIE_O) $(STRING_LIST_O) $(STATS) $(HMM_O)
  
      $(CPPCOMPILER) src\hmm_test.cpp $(TRANSITION_O) \
      $(TRANSITION_LIST_O) $(AUXILS_O) $(LIST_O) $(ELEMENT_O) $(TRIE_O) \
      $(STRING_LIST_O)
      mv hmm_test.exe bin\hmm_test.exe
      cd bin; hmm_test.exe ..\$(in)
  </code></pre>
  
  <p>ANd when I remove the blackslash before include (which would not agree with the template on the MS website) I get:</p>
  
  <pre><code>/out:transitionList.exe
  include\lists\transitionList.obj
  LINK : fatal error LNK1561: entry point must be defined
  make: *** [include\lists\transitionList.obj] Error 2
  </code></pre>