1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
Sources :=  $(wildcard *.[ch]pp)
CPPFiles := $(wildcard *.cpp)
Objects :=  $(patsubst %.cpp,%.o,$(CPPFiles))
Target :=   ${patsubst %.cpp,%,${shell grep -l '\<main *(' $(CPPFiles)}}

CC :=       g++
CXX :=      g++
CXXFLAGS := -Wall -g -std=gnu++11
CPPFLAGS :=

.PHONY:     all depend clean realclean
all:        Makefile $(Target)
depend: ;   gcc-makedepend $(CPPFLAGS) $(CPPFiles)
Makefile:   $(Sources)
        gcc-makedepend $(CPPFLAGS) $(CPPFiles)
clean: ;    rm -f $(Objects)
realclean:  clean
        rm -f $(Target)

$(Target):  $(Objects)
        $(CXX) -o $@ $(LDFLAGS) $(Objects) $(LOADLIBES) $(LDLIBS)

# DO NOT DELETE
NimMove.o: NimMove.cpp NimMove.hpp
Nim.o: Nim.cpp NimMove.hpp NimGame.hpp
NimGame.o: NimGame.cpp NimGame.hpp NimMove.hpp