all: fc-solve.exe freecell-solver-range-parallel-solve.exe

OFLAGS=/Og2 /DWIN32
DFLAGS=$(OFLAGS) /DDEBUG
INCLUDES=alloc.h caas.h cl_chop.h config.h fcs_cl.h fcs.h fcs_enums.h fcs_hash.h fcs_isa.h fcs_move.h fcs_user.h inline.h jhjtypes.h lookup2.h move.h ms_ca.h prefix.h pqueue.h preset.h rand.h state.h test_arr.h tests.h
CC=cl
LIB32=link.exe


OBJECTS = alloc.obj caas.obj card.obj cl_chop.obj cmd_line.obj fcs_hash.obj fcs_isa.obj freecell.obj intrface.obj lib.obj lookup2.obj move.obj pqueue.obj preset.obj rand.obj scans.obj simpsim.obj state.obj


alloc.obj: alloc.c $(INCLUDES)
	$(CC) /c /Foalloc.obj $(OFLAGS) alloc.c

caas.obj: caas.c $(INCLUDES)
	$(CC) /c /Focaas.obj $(OFLAGS) caas.c

card.obj: card.c $(INCLUDES)
	$(CC) /c /Focard.obj $(OFLAGS) card.c

cl_chop.obj: cl_chop.c $(INCLUDES)
	$(CC) /c /Focl_chop.obj $(OFLAGS) cl_chop.c

cmd_line.obj: cmd_line.c $(INCLUDES)
	$(CC) /c /Focmd_line.obj $(OFLAGS) cmd_line.c

fcs_hash.obj: fcs_hash.c $(INCLUDES)
	$(CC) /c /Fofcs_hash.obj $(OFLAGS) fcs_hash.c

fcs_isa.obj: fcs_isa.c $(INCLUDES)
	$(CC) /c /Fofcs_isa.obj $(OFLAGS) fcs_isa.c

freecell.obj: freecell.c $(INCLUDES)
	$(CC) /c /Fofreecell.obj $(OFLAGS) freecell.c

intrface.obj: intrface.c $(INCLUDES)
	$(CC) /c /Fointrface.obj $(OFLAGS) intrface.c

lib.obj: lib.c $(INCLUDES)
	$(CC) /c /Folib.obj $(OFLAGS) lib.c

lookup2.obj: lookup2.c $(INCLUDES)
	$(CC) /c /Folookup2.obj $(OFLAGS) lookup2.c

move.obj: move.c $(INCLUDES)
	$(CC) /c /Fomove.obj $(OFLAGS) move.c

pqueue.obj: pqueue.c $(INCLUDES)
	$(CC) /c /Fopqueue.obj $(OFLAGS) pqueue.c

preset.obj: preset.c $(INCLUDES)
	$(CC) /c /Fopreset.obj $(OFLAGS) preset.c

rand.obj: rand.c $(INCLUDES)
	$(CC) /c /Forand.obj $(OFLAGS) rand.c

scans.obj: scans.c $(INCLUDES)
	$(CC) /c /Foscans.obj $(OFLAGS) scans.c

simpsim.obj: simpsim.c $(INCLUDES)
	$(CC) /c /Fosimpsim.obj $(OFLAGS) simpsim.c

state.obj: state.c $(INCLUDES)
	$(CC) /c /Fostate.obj $(OFLAGS) state.c

main.obj: main.c $(INCLUDES)
	$(CC) /c /Fomain.obj $(OFLAGS) main.c

test_multi_parallel.obj: test_multi_parallel.c $(INCLUDES)
	$(CC) /c /Fotest_multi_parallel.obj $(OFLAGS) test_multi_parallel.c



###
### Final Targets
###


fc-solve.exe: freecell-solver-static.lib main.obj
	$(CC) /Fefc-solve.exe /F0x2000000 freecell-solver-static.lib main.obj

freecell-solver-range-parallel-solve.exe: freecell-solver-static.lib test_multi_parallel.obj
	$(CC) /Fefreecell-solver-range-parallel-solve.exe /F0x2000000 freecell-solver-static.lib test_multi_parallel.obj

freecell-solver-static.lib: $(OBJECTS)
	$(LIB32) -lib $(OBJECTS) /out:freecell-solver-static.lib

freecell-solver.dll: $(OBJECTS) freecell-solver.def
	$(LIB32) kernel32.lib user32.lib gdi32.lib /dll /out:freecell-solver.dll /implib:freeecell-solver.lib /DEF:freecell-solver.def $(OBJECTS)

clean:
	del *.obj *.exe *.lib *.dll *.exp
