!IFNDEF TOP
TOP=.
!ENDIF
LINK=link
!ifndef MT
MT=mt
!endif
!ifndef HHC
HHC=hhc
!endif

CLFLAGS=/c /D_MBCS /DNDEBUG /DWIN32 /D_WINDOWS /D_WIN32_WINNT=0x0500 /DWINVER=0x0500 /D_CRT_SECURE_NO_DEPRECATE /Fo$@ /MD /nologo /O2
LNFLAGS=/INCREMENTAL:NO /MACHINE:IX86 /NOLOGO /OUT:$@ /RELEASE /SUBSYSTEM:WINDOWS
RCFLAGS=/c1252 /d_MBCS /dNDEBUG /dWIN32 /d_WINDOWS /d_WIN32_WINNT=0x0500 /dWINVER=0x0500 /fo$@ /l0
INCLUDES=/Imisc /Isrc

all: src\gshot.exe doc\gshot.chm

src\gshot.exe: $*.obj $*.res misc\argument.obj misc\dialog.obj misc\fndir.obj misc\license.obj misc\memapi.obj misc\other.obj misc\valstr.obj src\callback.obj src\capavi.obj src\capdbg.obj src\capgsr.obj src\capstd.obj src\capture.obj src\drive.obj src\env.obj src\error.obj src\general.obj src\live.obj src\prop.obj src\save.obj src\timer.obj src\version.obj src\wndmain.obj
	$(LINK) $(LNFLAGS) advapi32.lib comctl32.lib comdlg32.lib gdi32.lib htmlhelp.lib msacm32.lib ole32.lib shell32.lib user32.lib vfw32.lib winmm.lib $**
	if exist $@.manifest $(MT) -manifest $@.manifest -outputresource:$@

src\gshot.res: $*.rc $*.ico
	rc $(RCFLAGS) $*.rc

misc\argument.obj: $*.c $*.h misc\memapi.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

misc\fndir.obj: $*.c $*.h misc\memapi.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

misc\dialog.obj: $*.c $*.h misc\memapi.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

misc\license.obj: $*.c $*.h misc\dialog.h misc\memapi.h misc\other.h src\resource.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

misc\memapi.obj: $*.c $*.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

misc\other.obj: $*.c $*.h misc\fndir.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

misc\valstr.obj: $*.c $*.h misc\memapi.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\callback.obj: $*.c $*.h misc\fndir.h src\general.h src\gshot.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\capavi.obj: $*.c $*.h misc\fndir.h misc\memapi.h misc\other.h src\bmmacro.h src\general.h src\gshot.h src\resource.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\capdbg.obj: $*.c $*.h misc\fndir.h misc\other.h src\general.h src\gshot.h src\resource.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\capgsr.obj: $*.c $*.h misc\fndir.h misc\memapi.h misc\other.h src\bmmacro.h src\general.h src\gshot.h src\resource.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\capstd.obj: $*.c $*.h misc\fndir.h src\general.h src\gshot.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\capture.obj: $*.c $*.h misc\dialog.h misc\fndir.h misc\memapi.h misc\other.h src\capgsr.h src\capavi.h src\capdbg.h src\capstd.h src\error.h src\gshot.h src\resource.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\drive.obj: $*.c $*.h misc\dialog.h misc\fndir.h src\gshot.h src\resource.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\env.obj: $*.c $*.h misc\dialog.h misc\fndir.h src\gshot.h src\resource.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\error.obj: $*.c $*.h misc\dialog.h misc\fndir.h src\gshot.h src\resource.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\general.obj: $*.c $*.h misc\fndir.h misc\memapi.h misc\other.h src\bmmacro.h src\gshot.h src\resource.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\gshot.obj: $*.c $*.h misc\argument.h misc\dialog.h misc\fndir.h misc\license.h misc\memapi.h misc\other.h misc\valstr.h src\resource.h src\wndmain.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\live.obj: $*.c $*.h misc\dialog.h misc\fndir.h misc\memapi.h misc\valstr.h src\gshot.h src\resource.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\prop.obj: $*.c $*.h misc\dialog.h misc\fndir.h misc\memapi.h misc\valstr.h src\bmmacro.h src\gshot.h src\resource.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\save.obj: $*.c $*.h misc\dialog.h misc\fndir.h misc\memapi.h misc\other.h src\gshot.h src\resource.h src\save.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\timer.obj: $*.c $*.h misc\dialog.h misc\fndir.h misc\memapi.h misc\other.h misc\valstr.h src\bmmacro.h src\error.h src\gshot.h src\prop.h src\save.h src\resource.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\version.obj: $*.c $*.h misc\dialog.h misc\fndir.h misc\license.h src\gshot.h src\resource.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

src\wndmain.obj: $*.c $*.h misc\dialog.h misc\fndir.h misc\memapi.h misc\other.h src\callback.h src\drive.h src\env.h src\gshot.h src\live.h src\prop.h src\resource.h src\save.h src\timer.h src\version.h
	$(CC) $(CLFLAGS) $(INCLUDES) $*.c

doc\gshot.chm: $*.hhc $*.hhk $*.hhp doc\address.htm doc\command.htm doc\edit.htm doc\env.htm doc\env.png doc\faq.htm doc\file.htm doc\file.png doc\index.htm doc\install.htm doc\intro.htm doc\live.htm doc\live.png doc\other.htm doc\property.htm doc\property.png doc\timer.htm doc\timer.png doc\view.htm
	-$(HHC) $*.hhp

clean:
	if exist src\gshot.exe del /q src\gshot.exe
	if exist doc\gshot.chm del /q doc\gshot.chm
	if exist misc\argument.obj del /q misc\argument.obj
	if exist misc\dialog.obj del /q misc\dialog.obj
	if exist misc\fndir.obj del /q misc\fndir.obj
	if exist misc\license.obj del /q misc\license.obj
	if exist misc\memapi.obj del /q misc\memapi.obj
	if exist misc\other.obj del /q misc\other.obj
	if exist misc\valstr.obj del /q misc\valstr.obj
	if exist src\callback.obj del /q src\callback.obj
	if exist src\capavi.obj del /q src\capavi.obj
	if exist src\capdbg.obj del /q src\capdbg.obj
	if exist src\capgsr.obj del /q src\capgsr.obj
	if exist src\capstd.obj del /q src\capstd.obj
	if exist src\capture.obj del /q src\capture.obj
	if exist src\drive.obj del /q src\drive.obj
	if exist src\env.obj del /q src\env.obj
	if exist src\error.obj del /q src\error.obj
	if exist src\general.obj del /q src\general.obj
	if exist src\gshot.obj del /q src\gshot.obj
	if exist src\gshot.res del /q src\gshot.res
	if exist src\live.obj del /q src\live.obj
	if exist src\prop.obj del /q src\prop.obj
	if exist src\save.obj del /q src\save.obj
	if exist src\timer.obj del /q src\timer.obj
	if exist src\version.obj del /q src\version.obj
	if exist src\wndmain.obj del /q src\wndmain.obj

dist: src\gshot.exe doc\gshot.chm
	mkdir gshot
	mkdir gshot\doc
	mkdir gshot\misc
	mkdir gshot\src
	copy /y ChangeLog gshot
	copy /y COPYING gshot
	copy /y Makefile gshot
	copy /y README gshot
	copy /y doc\address.htm gshot\doc
	copy /y doc\command.htm gshot\doc
	copy /y doc\edit.htm gshot\doc
	copy /y doc\env.htm gshot\doc
	copy /y doc\env.png gshot\doc
	copy /y doc\faq.htm gshot\doc
	copy /y doc\file.htm gshot\doc
	copy /y doc\file.png gshot\doc
	copy /y doc\gshot.hhc gshot\doc
	copy /y doc\gshot.hhk gshot\doc
	copy /y doc\gshot.hhp gshot\doc
	copy /y doc\index.htm gshot\doc
	copy /y doc\install.htm gshot\doc
	copy /y doc\intro.htm gshot\doc
	copy /y doc\live.htm gshot\doc
	copy /y doc\live.png gshot\doc
	copy /y doc\other.htm gshot\doc
	copy /y doc\property.htm gshot\doc
	copy /y doc\property.png gshot\doc
	copy /y doc\timer.htm gshot\doc
	copy /y doc\timer.png gshot\doc
	copy /y doc\view.htm gshot\doc
	copy /y misc\argument.c gshot\misc
	copy /y misc\argument.h gshot\misc
	copy /y misc\dialog.c gshot\misc
	copy /y misc\dialog.h gshot\misc
	copy /y misc\fndir.c gshot\misc
	copy /y misc\fndir.h gshot\misc
	copy /y misc\license.c gshot\misc
	copy /y misc\license.h gshot\misc
	copy /y misc\memapi.c gshot\misc
	copy /y misc\memapi.h gshot\misc
	copy /y misc\other.c gshot\misc
	copy /y misc\other.h gshot\misc
	copy /y misc\valstr.c gshot\misc
	copy /y misc\valstr.h gshot\misc
	copy /y src\bmmacro.h gshot\src
	copy /y src\callback.c gshot\src
	copy /y src\callback.h gshot\src
	copy /y src\capavi.c gshot\src
	copy /y src\capavi.h gshot\src
	copy /y src\capdbg.c gshot\src
	copy /y src\capdbg.h gshot\src
	copy /y src\capgsr.c gshot\src
	copy /y src\capgsr.h gshot\src
	copy /y src\capstd.c gshot\src
	copy /y src\capstd.h gshot\src
	copy /y src\capture.c gshot\src
	copy /y src\capture.h gshot\src
	copy /y src\drive.c gshot\src
	copy /y src\drive.h gshot\src
	copy /y src\env.c gshot\src
	copy /y src\env.h gshot\src
	copy /y src\error.c gshot\src
	copy /y src\error.h gshot\src
	copy /y src\general.c gshot\src
	copy /y src\general.h gshot\src
	copy /y src\gshot.c gshot\src
	copy /y src\gshot.h gshot\src
	copy /y src\gshot.ico gshot\src
	copy /y src\gshot.rc gshot\src
	copy /y src\live.c gshot\src
	copy /y src\live.h gshot\src
	copy /y src\prop.c gshot\src
	copy /y src\prop.h gshot\src
	copy /y src\resource.h gshot\src
	copy /y src\save.c gshot\src
	copy /y src\save.h gshot\src
	copy /y src\timer.c gshot\src
	copy /y src\timer.h gshot\src
	copy /y src\version.c gshot\src
	copy /y src\version.h gshot\src
	copy /y src\wndmain.c gshot\src
	copy /y src\wndmain.h gshot\src
	zip -9 -r gshot.zip gshot
	rmdir /q /s gshot
	mkdir gshot292
	copy /y ChangeLog gshot292
	copy /y COPYING gshot292
	copy /y README gshot292
	copy /y src\gshot.exe gshot292
	copy /y doc\gshot.chm gshot292
	copy /y gshot.zip gshot292
	zip -9 -r gshot292.zip gshot292
	del /q gshot.zip
	rmdir /q /s gshot292
