ifndef CCALL
CCALL=$(CC) $(CFLAGS) $(CFLAGSB) $(CPPFLAGS) $(INCLUDES) -I..
endif
ifndef CXXALL
CXXALL=$(CXX) $(CXXFLAGS) $(CXXFLAGSB) $(CPPFLAGS) $(INCLUDES) -I..
endif
ifndef LDALL
LDALL=$(LDY) $(LDFLAGS) $(LIBS)
endif
ifndef CC
CC=gcc
endif
ifndef CXX
CXX=cl -TP
endif
ifndef LD
LD=$(CC)
endif
ifndef LDXX
LDXX=$(CXX)
endif
ifndef LDY
LDY=$(LD)
endif
ifndef CFLAGS
CFLAGS=-O2 -MD -nologo -DW32TEX=1
endif
ifndef CXXFLAGS
CXXFLAGS=-O2 -MD -nologo -DW32TEX=1
endif
ifndef GLOBFILES
GLOBFILES=Makefile Makedep
endif

sam2p_DS=sam2p_main.cpp appliers.cpp crc32.c c_lgcc.cpp out_gif.cpp in_ps.cpp in_tga.cpp in_pnm.cpp in_bmp.cpp in_gif.cpp in_lbm.cpp in_xpm.cpp mapping.cpp in_pcx.cpp in_jai.cpp in_png.cpp in_jpeg.cpp in_tiff.cpp rule.cpp minips.cpp encoder.cpp pts_lzw.c pts_fax.c pts_defl.c error.cpp image.cpp gensio.cpp snprintf.c gensi.cpp
sam2p_H=config2.h crc32.h encoder.hpp error.hpp gensi.hpp gensio.hpp image.hpp mapping.hpp minips.hpp pts_defl.h pts_fax.h rule.hpp snprintf.h

sam2p.exe: $(GLOBFILES) sam2p_main.obj appliers.obj crc32.obj c_lgcc.obj out_gif.obj in_ps.obj in_tga.obj in_pnm.obj in_bmp.obj in_gif.obj in_lbm.obj in_xpm.obj mapping.obj in_pcx.obj in_jai.obj in_png.obj in_jpeg.obj in_tiff.obj rule.obj minips.obj encoder.obj pts_lzw.obj pts_fax.obj pts_defl.obj error.obj image.obj gensio.obj snprintf.obj gensi.obj
	$(LDALL) -Fesam2p.exe sam2p_main.obj appliers.obj crc32.obj c_lgcc.obj out_gif.obj in_ps.obj in_tga.obj in_pnm.obj in_bmp.obj in_gif.obj in_lbm.obj in_xpm.obj mapping.obj in_pcx.obj in_jai.obj in_png.obj in_jpeg.obj in_tiff.obj rule.obj minips.obj encoder.obj pts_lzw.obj pts_fax.obj pts_defl.obj error.obj image.obj gensio.obj snprintf.obj gensi.obj
	@echo "Created executable file: sam2p.exe"

test_DS=test_main.cpp image.cpp c_lgcc.cpp in_tga.cpp in_pnm.cpp in_bmp.cpp in_gif.cpp in_lbm.cpp in_xpm.cpp mapping.cpp minips.cpp encoder.cpp pts_lzw.c pts_fax.c pts_defl.c error.cpp gensio.cpp snprintf.c gensi.cpp
test_H=config2.h encoder.hpp error.hpp gensi.hpp gensio.hpp image.hpp mapping.hpp minips.hpp pts_defl.h pts_fax.h snprintf.h

test.exe: $(GLOBFILES) test_main.obj image.obj c_lgcc.obj in_tga.obj in_pnm.obj in_bmp.obj in_gif.obj in_lbm.obj in_xpm.obj mapping.obj minips.obj encoder.obj pts_lzw.obj pts_fax.obj pts_defl.obj error.obj gensio.obj snprintf.obj gensi.obj
	$(LDALL)  -Fetest.exe test_main.obj image.obj c_lgcc.obj in_tga.obj in_pnm.obj in_bmp.obj in_gif.obj in_lbm.obj in_xpm.obj mapping.obj minips.obj encoder.obj pts_lzw.obj pts_fax.obj pts_defl.obj error.obj gensio.obj snprintf.obj gensi.obj
	@echo "Created executable file: test.exe."

ps_tiny.exe: ps_tiny.obj
	$(LDALL) -Fe$@ $<

test.assert: $(GLOBFILES) $(test_DS) $(test_H)
	$(CXD_assert) $(CXDFAL) $(test_DS) -o test.assert
test.no: $(GLOBFILES) $(test_DS) $(test_H)
	$(CXD_no) $(CXDFAL) $(test_DS) -o test.no
test.yes: $(GLOBFILES) $(test_DS) $(test_H)
	$(CXD_yes) $(CXDFAL) $(test_DS) -o test.yes
test.checker: $(GLOBFILES) $(test_DS) $(test_H)
	$(CXD_checker) $(CXDFAL) $(test_DS) -o test.checker
testfax_DS=testfax_main.c pts_fax.c c_lgcc.cpp
testfax_H=config2.h pts_fax.h
testfax: $(GLOBFILES) testfax_main.obj pts_fax.obj c_lgcc.obj
	$(LDALL) testfax_main.obj pts_fax.obj c_lgcc.obj -o testfax
	@echo "Created executable file: testfax (size: `perl -e 'print -s "testfax"'`)."
testfax.assert: $(GLOBFILES) $(testfax_DS) $(testfax_H)
	$(CXD_assert) $(CXDFAL) $(testfax_DS) -o testfax.assert
testfax.no: $(GLOBFILES) $(testfax_DS) $(testfax_H)
	$(CXD_no) $(CXDFAL) $(testfax_DS) -o testfax.no
testfax.yes: $(GLOBFILES) $(testfax_DS) $(testfax_H)
	$(CXD_yes) $(CXDFAL) $(testfax_DS) -o testfax.yes
testfax.checker: $(GLOBFILES) $(testfax_DS) $(testfax_H)
	$(CXD_checker) $(CXDFAL) $(testfax_DS) -o testfax.checker

StdAfx.obj: $(GLOBFILES) StdAfx.cpp StdAfx.h
	$(CXXALL) -c StdAfx.cpp
appliers.obj: $(GLOBFILES) appliers.cpp config2.h rule.hpp
	$(CXXALL) -c appliers.cpp
c_lgcc.obj: $(GLOBFILES) c_lgcc.cpp
	$(CXXALL) -c c_lgcc.cpp
c_lgcc3.obj: $(GLOBFILES) c_lgcc3.cpp
	$(CXXALL) -c c_lgcc3.cpp
cgif.obj: $(GLOBFILES) cgif.c
	$(CCALL) -c cgif.c
crc32.obj: $(GLOBFILES) config2.h crc32.c crc32.h
	$(CCALL) -c crc32.c
encoder.obj: $(GLOBFILES) config2.h encoder.cpp encoder.hpp
	$(CXXALL) -c encoder.cpp
error.obj: $(GLOBFILES) config2.h error.cpp error.hpp
	$(CXXALL) -c error.cpp
gensi.obj: $(GLOBFILES) config2.h gensi.cpp gensi.hpp
	$(CXXALL) -c gensi.cpp
gensio.obj: $(GLOBFILES) config2.h gensio.cpp gensio.hpp
	$(CXXALL) -c gensio.cpp
image.obj: $(GLOBFILES) config2.h image.cpp image.hpp
	$(CXXALL) -c image.cpp
in_bmp.obj: $(GLOBFILES) config2.h image.hpp in_bmp.cpp
	$(CXXALL) -c in_bmp.cpp
in_gif.obj: $(GLOBFILES) config2.h in_gif.cpp
	$(CXXALL) -c in_gif.cpp
in_jai.obj: $(GLOBFILES) config2.h image.hpp in_jai.cpp
	$(CXXALL) -c in_jai.cpp
in_jpeg.obj: $(GLOBFILES) config2.h image.hpp in_jpeg.cpp
	$(CXXALL) -c in_jpeg.cpp
in_lbm.obj: $(GLOBFILES) config2.h image.hpp in_lbm.cpp
	$(CXXALL) -c in_lbm.cpp
in_pcx.obj: $(GLOBFILES) config2.h in_pcx.cpp
	$(CXXALL) -c in_pcx.cpp
in_png.obj: $(GLOBFILES) config2.h image.hpp in_png.cpp
	$(CXXALL) -c in_png.cpp
in_pnm.obj: $(GLOBFILES) config2.h image.hpp in_pnm.cpp
	$(CXXALL) -c in_pnm.cpp
in_ps.obj: $(GLOBFILES) config2.h image.hpp in_ps.cpp
	$(CXXALL) -c in_ps.cpp
in_tga.obj: $(GLOBFILES) config2.h image.hpp in_tga.cpp
	$(CXXALL) -c in_tga.cpp
in_tiff.obj: $(GLOBFILES) config2.h image.hpp in_tiff.cpp
	$(CXXALL) -c in_tiff.cpp
in_xpm.obj: $(GLOBFILES) config2.h image.hpp in_xpm.cpp
	$(CXXALL) -c in_xpm.cpp
jpegdump_main.obj: $(GLOBFILES) config2.h jpegdump_main.cpp
	$(CXXALL) -c jpegdump_main.cpp
mapping.obj: $(GLOBFILES) config2.h mapping.cpp mapping.hpp
	$(CXXALL) -c mapping.cpp
minips.obj: $(GLOBFILES) config2.h minips.cpp minips.hpp
	$(CXXALL) -c minips.cpp
out_gif.obj: $(GLOBFILES) config2.h image.hpp out_gif.cpp
	$(CXXALL) -c out_gif.cpp
ps_tiny.obj: $(GLOBFILES) ps_tiny.c
	$(CCALL) -c ps_tiny.c
pts_defl.obj: $(GLOBFILES) pts_defl.c pts_defl.h
	$(CCALL) -c pts_defl.c
pts_fax.obj: $(GLOBFILES) config2.h pts_fax.c pts_fax.h
	$(CCALL) -c pts_fax.c
pts_lzw.obj: $(GLOBFILES) pts_lzw.c
	$(CCALL) -c pts_lzw.c
rule.obj: $(GLOBFILES) config2.h rule.cpp rule.hpp
	$(CXXALL) -c rule.cpp
sam2p_main.obj: $(GLOBFILES) config2.h gensi.hpp sam2p_main.cpp
	$(CXXALL) -c sam2p_main.cpp
snprintf.obj: $(GLOBFILES) config2.h snprintf.c snprintf.h
	$(CCALL) -c snprintf.c
test_main.obj: $(GLOBFILES) config2.h gensi.hpp test_main.cpp
	$(CXXALL) -c test_main.cpp
testfax_main.obj: $(GLOBFILES) config2.h pts_fax.h testfax_main.c
	$(CCALL) -c testfax_main.c
vcsam2p.obj: $(GLOBFILES) config2.h vcsam2p.cpp
	$(CXXALL) -c vcsam2p.cpp
