!IFNDEF TOP
TOP=.
!ENDIF
CC=cl
RC=rc
LINK=link
LFLAGS=/INCREMENTAL:NO /MACHINE:IX86 /NOLOGO /OUT:$@ /SUBSYSTEM:WINDOWS
CFLAGS=/c /DWIN32 /DNDEBUG /D_WINDOWS /DMBCS /DWINVER=0x0400 /Fo$@ /Fp$*.pch /MD /nologo /O2 /QI0f /QIfdiv /YX
RFLAGS=/fo$@
LIBS=gdk_pixbuf-2.0.lib gdk-win32-2.0.lib glib-2.0.lib gobject-2.0.lib gthread-2.0.lib gtk-win32-2.0.lib intl.lib
INCLUDES=/I$(TOP)

all: avicore misc src vmaid.exe

avicore:
	mkdir avicore

misc:
	mkdir misc

src:
	mkdir src

vmaid.exe: $*.res misc\argument.obj misc\fileio.obj misc\license.obj misc\misc.obj misc\profile.obj avicore\avicore.obj avicore\aviedit.obj avicore\avifilesel.obj avicore\aviframe.obj avicore\aviopen.obj avicore\avisave.obj avicore\avitext.obj avicore\bitmap.obj avicore\chunk.obj avicore\icm.obj src\command.obj src\conf.obj src\file.obj src\general.obj src\jump.obj src\prop.obj src\sigfile.obj src\sigmain.obj src\size.obj src\thread.obj src\toolbar.obj src\version.obj src\vmaid.obj src\winmain.obj
	$(LINK) $(LFLAGS) $(LIBS) shell32.lib user32.lib $**

misc\argument.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\misc\misc.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

misc\fileio.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

misc\license.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\misc\fileio.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

misc\misc.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\misc\fileio.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

misc\profile.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\misc\fileio.h $(TOP)\misc\misc.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

avicore\avicore.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avifmt.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\misc\misc.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

avicore\aviedit.obj: $(TOP)\$*.c $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avibase.h $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

avicore\avifilesel.obj: $(TOP)\$*.c $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avibase.h $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

avicore\aviframe.obj: $(TOP)\$*.c $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avibase.h $(TOP)\avicore\avicore.h $(TOP)\avicore\avifmt.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

avicore\aviopen.obj: $(TOP)\$*.c $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avibase.h $(TOP)\avicore\avicore.h $(TOP)\avicore\avifmt.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

avicore\avisave.obj: $(TOP)\$*.c $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avibase.h $(TOP)\avicore\avicore.h $(TOP)\avicore\avifmt.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

avicore\avitext.obj: $(TOP)\$*.c $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avibase.h $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\misc\misc.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

avicore\bitmap.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\misc\fileio.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

avicore\chunk.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\misc\fileio.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

avicore\icm.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avifmt.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\misc\fileio.h $(TOP)\misc\misc.h $(TOP)\misc\profile.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

src\command.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avicore.h $(TOP)\avicore\avifilesel.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\misc\misc.h $(TOP)\src\file.h $(TOP)\src\general.h $(TOP)\src\jump.h $(TOP)\src\prop.h $(TOP)\src\sigfile.h $(TOP)\src\size.h $(TOP)\src\thread.h $(TOP)\src\vmaid.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

src\conf.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\src\vmaid.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

src\file.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\misc\misc.h $(TOP)\src\sigfile.h $(TOP)\src\sigmain.h $(TOP)\src\size.h $(TOP)\src\thread.h $(TOP)\src\vmaid.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

src\general.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\misc\misc.h $(TOP)\src\command.h $(TOP)\src\sigfile.h $(TOP)\src\toolbar.h $(TOP)\src\vmaid.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

src\jump.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\misc\misc.h $(TOP)\src\vmaid.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

src\prop.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\misc\misc.h $(TOP)\src\vmaid.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

src\sigfile.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\misc\misc.h $(TOP)\src\command.h $(TOP)\src\file.h $(TOP)\src\general.h $(TOP)\src\vmaid.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

src\sigmain.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\misc\misc.h $(TOP)\misc\argument.h $(TOP)\src\command.h $(TOP)\src\file.h $(TOP)\src\general.h $(TOP)\src\sigfile.h $(TOP)\src\thread.h $(TOP)\src\vmaid.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

src\size.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\src\vmaid.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

src\thread.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\src\vmaid.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

src\toolbar.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\src\command.h $(TOP)\src\vmaid.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

src\version.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\misc\license.h $(TOP)\src\vmaid.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

src\vmaid.obj: $(TOP)\$*.c $(TOP)\$*.h $(TOP)\common.h $(TOP)\config.h.msc $(TOP)\avicore\avicore.h $(TOP)\avicore\bitmap.h $(TOP)\avicore\chunk.h $(TOP)\avicore\icm.h $(TOP)\avicore\wave.h $(TOP)\misc\fileio.h $(TOP)\misc\license.h $(TOP)\misc\profile.h $(TOP)\misc\argument.h $(TOP)\src\command.h $(TOP)\src\conf.h $(TOP)\src\file.h $(TOP)\src\general.h $(TOP)\src\sigfile.h $(TOP)\src\sigmain.h $(TOP)\src\thread.h $(TOP)\src\toolbar.h $(TOP)\src\version.h
	$(CC) $(CFLAGS) $(INCLUDES) $(TOP)\$*.c

src\winmain.obj: $(TOP)\$*.c
	$(CC) $(CFLAGS) $(INCLUDES) $**

vmaid.res: $(TOP)\$*.rc $(TOP)\$*.ico
	$(RC) $(RFLAGS) $(TOP)\$*.rc

clean:
	if exist vmaid.exe del /q vmaid.exe
	if exist vmaid.res del /q vmaid.res
	del /q avicore\*.obj
	del /q avicore\*.pch
	del /q misc\*.obj
	del /q misc\*.pch
	del /q src\*.obj
	del /q src\*.pch
