makefile.msc.in 4.67 KB
Newer Older
1
## Makefile for building the GLib, gmodule and gthread dlls with Microsoft C
2 3
## Use: nmake -f makefile.msc install

4 5
# Change this to wherever you want to install the DLLs. This directory
# should be in your PATH.
6 7
BIN = C:\bin

8
# This is the location of pthreads for Win32, 
9
# see http://sourceware.cygnus.com/pthreads-win32/
10 11
# We want the 1999-05-30 snapshot.
PTHREADS = ..\pthreads-snap-1999-05-30
12 13
PTHREAD_LIB = $(PTHREADS)\pthread.lib
PTHREAD_INC = -I $(PTHREADS)
14

15 16 17 18
################################################################

# Nothing much configurable below

19
!IFNDEF DEBUG
20
# Full optimization:
21 22 23
OPTIMIZE = -Ox -MD
LINKDEBUG =
!ELSE
24
# Debugging:
25 26 27
OPTIMIZE = -Zi -MDd
LINKDEBUG = /debug
!ENDIF
28 29

# cl -? describes the options
30
CC = cl -G5 -GF $(OPTIMIZE) -W3 -nologo
31

32
# No general LDFLAGS needed
33
LDFLAGS = /link $(LINKDEBUG)
34 35
INSTALL = copy

36
GLIB_VER = @GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@
37

38
CFLAGS = -I. -DHAVE_CONFIG_H
39 40 41

all : \
	glibconfig.h	\
42
	config.h	\
43 44 45
	glib-$(GLIB_VER).dll	\
	gmodule\gmoduleconf.h \
	gmodule-$(GLIB_VER).dll	\
46
	gthread-$(GLIB_VER).dll \
47
	testglib.exe	\
48 49
	testgmodule.exe	\
	testgdate.exe	\
50
	testgdateparser.exe
51 52 53 54

install : all
	$(INSTALL) glib-$(GLIB_VER).dll $(BIN)
	$(INSTALL) gmodule-$(GLIB_VER).dll $(BIN)
55
	$(INSTALL) gthread-$(GLIB_VER).dll $(BIN)
56 57 58

glib_OBJECTS = \
	garray.obj	\
59
	gasyncqueue.obj	\
60 61 62
	gcache.obj	\
	gcompletion.obj	\
	gdataset.obj	\
63
	gdate.obj	\
64 65
	gerror.obj	\
	ghash.obj	\
66
	ghook.obj	\
67 68
	giochannel.obj	\
	giowin32.obj	\
69
	glist.obj	\
70
	gmain.obj	\
71 72 73 74
	gmem.obj	\
	gmessages.obj	\
	gnode.obj	\
	gprimes.obj	\
Tor Lillqvist's avatar
Tor Lillqvist committed
75
	gqueue.obj	\
Tor Lillqvist's avatar
Tor Lillqvist committed
76
	grand.obj	\
77 78
	grel.obj	\
	gscanner.obj	\
79
	gslist.obj	\
80 81
	gstrfuncs.obj	\
	gstring.obj	\
82
	gthread.obj	\
83
	gthreadpool.obj	\
84 85
	gtimer.obj	\
	gtree.obj	\
Tor Lillqvist's avatar
Tor Lillqvist committed
86 87 88
	gunidecomp.obj	\
	guniprop.obj	\
	gutf8.obj	\
89 90
	gutils.obj	\
	gwin32.obj
91

92 93
glib-$(GLIB_VER).dll : $(glib_OBJECTS) glib.def
	$(CC) $(CFLAGS) -LD -Feglib-$(GLIB_VER).dll $(glib_OBJECTS) user32.lib advapi32.lib wsock32.lib $(LDFLAGS) /def:glib.def
94 95 96 97

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

98 99 100
config.h: config.h.win32
	copy config.h.win32 config.h

101
.c.obj :
102
	$(CC) $(CFLAGS) -GD -c -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib $<
103

104 105 106
.c.i :
	$(CC) $(CFLAGS) -GD -E -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib $< >$@

107 108 109
gmodule_OBJECTS = \
	gmodule.obj

110
gmodule-$(GLIB_VER).dll : $(gmodule_OBJECTS) gmodule\gmodule.def
111
	$(CC) $(CFLAGS) -LD -Fegmodule-$(GLIB_VER).dll $(gmodule_OBJECTS) glib-$(GLIB_VER).lib $(LDFLAGS) /def:gmodule\gmodule.def
112 113

gmodule.obj : gmodule\gmodule.c gmodule\gmodule-win32.c
114
	$(CC) $(CFLAGS) -GD -Igmodule -c -DG_LOG_DOMAIN=g_log_domain_gmodule gmodule\gmodule.c
115 116 117 118

gmodule\gmoduleconf.h: gmodule\gmoduleconf.h.win32
	copy gmodule\gmoduleconf.h.win32 gmodule\gmoduleconf.h

119
gthread_OBJECTS = \
120
	gthread-impl.obj
121

122 123
gthread-$(GLIB_VER).dll : $(gthread_OBJECTS) gthread\gthread.def
	$(CC) $(CFLAGS) -LD -Fegthread-$(GLIB_VER).dll $(gthread_OBJECTS) glib-$(GLIB_VER).lib $(PTHREAD_LIB) $(LDFLAGS) /def:gthread\gthread.def
124

125 126
gthread-impl.obj : gthread\gthread-impl.c gthread\gthread-posix.c
	$(CC) $(CFLAGS) -GD $(PTHREAD_INC) -DG_LOG_DOMAIN=\"GThread\" -c gthread\gthread-impl.c
127

128
testglib.exe : glib-$(GLIB_VER).dll testglib.obj
129
	$(CC) $(CFLAGS) -Fetestglib.exe testglib.obj glib-$(GLIB_VER).lib $(LDFLAGS) /subsystem:console
130 131 132 133

testglib.obj : testglib.c
	$(CC) -c $(CFLAGS) testglib.c

134 135 136 137 138 139 140 141 142 143 144 145
testgdate.exe : glib-$(GLIB_VER).dll testgdate.obj
	$(CC) $(CFLAGS) -Fetestgdate.exe testgdate.obj glib-$(GLIB_VER).lib $(LDFLAGS) /subsystem:console

testgdate.obj : testgdate.c
	$(CC) -c $(CFLAGS) testgdate.c

testgdateparser.exe : glib-$(GLIB_VER).dll testgdateparser.obj
	$(CC) $(CFLAGS) -Fetestgdateparser.exe testgdateparser.obj glib-$(GLIB_VER).lib $(LDFLAGS) /subsystem:console

testgdateparser.obj : testgdateparser.c
	$(CC) -c $(CFLAGS) testgdateparser.c

146
testgmodule.exe : glib-$(GLIB_VER).dll gmodule-$(GLIB_VER).dll testgmodule.obj libgplugin_a.dll libgplugin_b.dll
147
	$(CC) $(CFLAGS) testgmodule.obj glib-$(GLIB_VER).lib gmodule-$(GLIB_VER).lib $(LDFLAGS) /subsystem:console 
148 149 150 151 152

testgmodule.obj : gmodule\testgmodule.c
	$(CC) $(CFLAGS) -Igmodule -c gmodule\testgmodule.c

libgplugin_a.dll : libgplugin_a.obj
153
	$(CC) $(CFLAGS) -LD libgplugin_a.obj glib-$(GLIB_VER).lib gmodule-$(GLIB_VER).lib $(LDFLAGS)
154 155 156 157 158

libgplugin_a.obj : gmodule\libgplugin_a.c
	$(CC) $(CFLAGS) -Igmodule -c gmodule\libgplugin_a.c

libgplugin_b.dll : libgplugin_b.obj
159
	$(CC) $(CFLAGS) -LD libgplugin_b.obj glib-$(GLIB_VER).lib gmodule-$(GLIB_VER).lib  $(LDFLAGS)
160 161 162 163 164

libgplugin_b.obj : gmodule\libgplugin_b.c
	$(CC) $(CFLAGS) -Igmodule -c gmodule\libgplugin_b.c

clean:
165 166 167
	del config.h
	del glibconfig.h
	del gmodule\gmoduleconf.h
168 169 170 171 172 173 174 175 176 177 178 179
	del *.exe
	del *.obj
	del *.dll
	del *.lib
	del *.err
	del *.map
	del *.sym
	del *.exp
	del *.lk1
	del *.mk1
	del *.pdb
	del *.ilk