## Makefile for building the GLib dlls with Microsoft C
## Use: nmake -f makefile.msc

TOP = ..\..

!INCLUDE ..\build\win32\make.msc

################################################################

INCLUDES = -FImsvc_recommended_pragmas.h -I . -I ..
DEFINES = -DHAVE_CONFIG_H -DGLIB_COMPILATION -DG_LOG_DOMAIN=\"GLib\" -DG_ENABLE_DEBUG
DEPCFLAGS = -Zm400 $(INTL_CFLAGS) $(LIBICONV_CFLAGS) $(DIRENT_CFLAGS)

all :				\
	..\config.h		\
	..\glibconfig.h	\
	gnulib\gnulib.lib	\
	libglib-2.0-@LT_CURRENT_MINUS_AGE@.dll \
	glib-@GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@s.lib \
	gspawn-win32-helper.exe	\


gnulib\gnulib.lib :
	cd gnulib
	nmake -f makefile.msc
	cd ..

glib_OBJECTS =			\
	garray.obj		\
	gasyncqueue.obj		\
	gbacktrace.obj		\
	gcache.obj		\
	gcompletion.obj		\
	gconvert.obj		\
	gdataset.obj		\
	gdate.obj		\
	gdir.obj	\
	gerror.obj		\
	gfileutils.obj		\
	ghash.obj		\
	ghook.obj		\
	giochannel.obj		\
	giowin32.obj		\
	glist.obj		\
	gmain.obj		\
	gmarkup.obj		\
	gmem.obj		\
	gmessages.obj		\
	gnode.obj		\
	gprimes.obj		\
	gqsort.obj		\
	gqueue.obj		\
	gpattern.obj	\
	gprintf.obj	\
	grand.obj		\
	grel.obj		\
	gscanner.obj		\
	gshell.obj		\
	gslist.obj		\
	gspawn-win32.obj	\
	gstrfuncs.obj		\
	gstring.obj		\
	gthread.obj		\
	gthreadpool.obj		\
	gtimer.obj		\
	gtree.obj		\
	gunibreak.obj		\
	gunicollate.obj		\
	gunidecomp.obj		\
	guniprop.obj		\
	gutf8.obj		\
	gutils.obj		\
	gwin32.obj		\
	localcharset.obj

..\glibconfig.h: ..\glibconfig.h.win32
	copy ..\glibconfig.h.win32 ..\glibconfig.h

..\config.h: ..\config.h.win32
	copy ..\config.h.win32 ..\config.h

localcharset.c : libcharset/localcharset.c
	copy libcharset\localcharset.c localcharset.c

################ glib

# create a static libary
# static library can well have the real version number in the name
glib-@GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@s.lib : $(glib_OBJECTS) gnulib\gnulib.lib
	lib /out:glib-@GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@s.lib $(glib_OBJECTS) gnulib\gnulib.lib

libglib-2.0-@LT_CURRENT_MINUS_AGE@.dll : $(glib_OBJECTS) glib.def
	$(CC) $(CFLAGS) -LD -Fe$@ $(glib_OBJECTS) $(LIBICONV_LIBS) $(INTL_LIBS) \
	gnulib\gnulib.lib $(DIRENT_LIBS) user32.lib advapi32.lib shell32.lib wsock32.lib $(LDFLAGS) /implib:glib-2.0.lib /def:glib.def

gspawn-win32-helper.exe : gspawn-win32-helper.c libglib-2.0-@LT_CURRENT_MINUS_AGE@.dll
	$(CC) $(CFLAGS) -Fe$@ -DG_LOG_DOMAIN=\"gspawn-win32-helper\" gspawn-win32-helper.c glib-2.0.lib $(LDFLAGS) /subsystem:windows user32.lib

################ other stuff

clean::
	del ..\config.h
	del ..\glibconfig.h

