makefile.msc.in 4.5 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
!IFNDEF DEBUG
16
# Full optimization:
17 18 19
OPTIMIZE = -Ox -MD
LINKDEBUG =
!ELSE
20
# Debugging:
21 22 23
OPTIMIZE = -Zi -MDd
LINKDEBUG = /debug
!ENDIF
24

25 26 27 28
################################################################

# Nothing much configurable below

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 59 60 61

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

87 88
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
89 90 91 92

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

93 94 95
config.h: config.h.win32
	copy config.h.win32 config.h

96
.c.obj :
97
	$(CC) $(CFLAGS) -GD -c -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib $<
98 99 100 101

gmodule_OBJECTS = \
	gmodule.obj

102
gmodule-$(GLIB_VER).dll : $(gmodule_OBJECTS) gmodule\gmodule.def
103
	$(CC) $(CFLAGS) -LD -Fegmodule-$(GLIB_VER).dll $(gmodule_OBJECTS) glib-$(GLIB_VER).lib $(LDFLAGS) /def:gmodule\gmodule.def
104 105

gmodule.obj : gmodule\gmodule.c gmodule\gmodule-win32.c
106
	$(CC) $(CFLAGS) -GD -Igmodule -c -DG_LOG_DOMAIN=g_log_domain_gmodule gmodule\gmodule.c
107 108 109 110

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

111
gthread_OBJECTS = \
112
	gthread-impl.obj
113

114 115
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
116

117 118
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
119

120
testglib.exe : glib-$(GLIB_VER).dll testglib.obj
121
	$(CC) $(CFLAGS) -Fetestglib.exe testglib.obj glib-$(GLIB_VER).lib $(LDFLAGS) /subsystem:console
122 123 124 125

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

126 127 128 129 130 131 132 133 134 135 136 137
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

138
testgmodule.exe : glib-$(GLIB_VER).dll gmodule-$(GLIB_VER).dll testgmodule.obj libgplugin_a.dll libgplugin_b.dll
139
	$(CC) $(CFLAGS) testgmodule.obj glib-$(GLIB_VER).lib gmodule-$(GLIB_VER).lib $(LDFLAGS) /subsystem:console 
140 141 142 143 144

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

libgplugin_a.dll : libgplugin_a.obj
145
	$(CC) $(CFLAGS) -LD libgplugin_a.obj glib-$(GLIB_VER).lib gmodule-$(GLIB_VER).lib $(LDFLAGS)
146 147 148 149 150

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

libgplugin_b.dll : libgplugin_b.obj
151
	$(CC) $(CFLAGS) -LD libgplugin_b.obj glib-$(GLIB_VER).lib gmodule-$(GLIB_VER).lib  $(LDFLAGS)
152 153 154 155 156

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

clean:
157 158 159
	del config.h
	del glibconfig.h
	del gmodule\gmoduleconf.h
160 161 162 163 164 165 166 167 168 169 170 171
	del *.exe
	del *.obj
	del *.dll
	del *.lib
	del *.err
	del *.map
	del *.sym
	del *.exp
	del *.lk1
	del *.mk1
	del *.pdb
	del *.ilk