1 ## Makefile for building the GLib, gmodule and gthread DLLs with
2 ## gcc on mingw or cygwin.
3 ## Use: make -f makefile.cygwin install
5 # Change this to wherever you want to install the DLLs. This directory
6 # should be in your PATH.
9 # This is the location of pthreads for Win32,
10 # see http://sourceware.cygnus.com/pthreads-win32/
11 # We want the 1999-05-30 snapshot.
12 PTHREADS = ../pthreads-snap-1999-05-30
13 PTHREAD_LIB = -L$(PTHREADS) -lpthread32
14 PTHREAD_INC = -I $(PTHREADS)
18 GLIB_VER = @GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@
22 include $(TOP)/build/win32/make.mingw
24 ################################################################
26 # Nothing much configurable below
32 DEFINES = -DHAVE_CONFIG_H -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib
37 glib-$(GLIB_VER).dll \
38 gmodule/gmoduleconf.h \
39 gmodule-$(GLIB_VER).dll \
40 gthread-$(GLIB_VER).dll \
47 $(INSTALL) glib-$(GLIB_VER).dll $(BIN)
48 $(INSTALL) gmodule-$(GLIB_VER).dll $(BIN)
49 $(INSTALL) gthread-$(GLIB_VER).dll $(BIN)
84 glibconfig.h: glibconfig.h.win32
85 cp glibconfig.h.win32 glibconfig.h
87 config.h: config.h.win32
88 cp config.h.win32 config.h
92 # The *.stamp files aren't distributed. Thus, this takes care of only
93 # tml building libraries with nonzero build number.
95 ifeq ($(wildcard glib-build.stamp),glib-build.stamp)
96 # Bump the build number
98 bash -c "read number && echo $$[number+1]" <glib-build.stamp >glib-build.tmp
99 cp glib-build.tmp glib-build.stamp
101 # Use zero as build number.
103 echo 0 >glib-build.tmp
106 glib-win32res.o : glib.rc glib-build.tmp
107 m4 -DBUILDNUMBER=`cat glib-build.tmp` <glib.rc >glib-win32res.rc
108 windres --include-dir $(WIN32APIHEADERS) glib-win32res.rc glib-win32res.o
109 rm glib-build.tmp glib-win32res.rc
111 glib-$(GLIB_VER).dll : $(glib_OBJECTS) glib.def
112 ./build-dll glib $(GLIB_VER) glib.def $(glib_OBJECTS) -luser32 -lwsock32
115 ################ gmodule
121 # Unfortunately I couldn't use a pattern rule for this, so copy-paste
123 ifeq ($(wildcard glib-build.stamp),glib-build.stamp)
125 bash -c "read number && echo $$[number+1]" <gmodule-build.stamp >gmodule-build.tmp
126 cp gmodule-build.tmp gmodule-build.stamp
129 echo 0 >gmodule-build.tmp
132 gmodule-win32res.o : gmodule/gmodule.rc gmodule-build.tmp
133 m4 -DBUILDNUMBER=`cat gmodule-build.tmp` <gmodule/gmodule.rc >gmodule-win32res.rc
134 windres --include-dir $(WIN32APIHEADERS) gmodule-win32res.rc gmodule-win32res.o
135 rm gmodule-build.tmp gmodule-win32res.rc
138 gmodule-$(GLIB_VER).dll : $(gmodule_OBJECTS) gmodule/gmodule.def
139 ./build-dll gmodule $(GLIB_VER) gmodule/gmodule.def $(gmodule_OBJECTS) -L. -lglib-$(GLIB_VER) -lwsock32
141 gmodule.o : gmodule/gmodule.c gmodule/gmodule-win32.c
142 $(CC) $(CFLAGS) -Igmodule -c -DG_LOG_DOMAIN=g_log_domain_gmodule gmodule/gmodule.c
144 gmodule/gmoduleconf.h: gmodule/gmoduleconf.h.win32
145 cp gmodule/gmoduleconf.h.win32 gmodule/gmoduleconf.h
147 ################ gthread
154 ifeq ($(wildcard glib-build.stamp),glib-build.stamp)
156 bash -c "read number && echo $$[number+1]" <gthread-build.stamp >gthread-build.tmp
157 cp gthread-build.tmp gthread-build.stamp
160 echo 0 >gthread-build.tmp
163 gthread-win32res.o : gthread/gthread.rc gthread-build.tmp
164 m4 -DBUILDNUMBER=`cat gthread-build.tmp` <gthread/gthread.rc >gthread-win32res.rc
165 windres --include-dir $(WIN32APIHEADERS) gthread-win32res.rc gthread-win32res.o
166 rm gthread-build.tmp gthread-win32res.rc
169 gthread-$(GLIB_VER).dll : $(gthread_OBJECTS) glib-$(GLIB_VER).dll gthread/gthread.def
170 ./build-dll gthread $(GLIB_VER) gthread/gthread.def $(gthread_OBJECTS) -L. -lglib-$(GLIB_VER) $(PTHREAD_LIB)
172 gthread-impl.o : gthread/gthread-impl.c gthread/gthread-posix.c
173 $(CC) $(CFLAGS) $(PTHREAD_INC) -DG_LOG_DOMAIN=\"GThread\" -c gthread/gthread-impl.c
175 ################ test progs
177 testglib.exe : glib-$(GLIB_VER).dll testglib.o
178 $(CC) $(CFLAGS) -o testglib testglib.o -L. -lglib-$(GLIB_VER) $(LDFLAGS)
180 testgdate.exe : glib-$(GLIB_VER).dll testgdate.o
181 $(CC) $(CFLAGS) -o testgdate.exe testgdate.o -L. -lglib-$(GLIB_VER) $(LDFLAGS)
183 testgdate.o : testgdate.c
184 $(CC) -c $(CFLAGS) testgdate.c
186 testgdateparser.exe : glib-$(GLIB_VER).dll testgdateparser.o
187 $(CC) $(CFLAGS) -o testgdateparser.exe testgdateparser.o -L. -lglib-$(GLIB_VER) $(LDFLAGS)
189 testgdateparser.o : testgdateparser.c
190 $(CC) -c $(CFLAGS) testgdateparser.c
192 testgmodule.exe : glib-$(GLIB_VER).dll gmodule-$(GLIB_VER).dll testgmodule.o libgplugin_a.dll libgplugin_b.dll
193 # Wow, do we really have to do it like this to get some symbols
194 # exported from a .exe? Apparently yes. Does the __declspec(dllexport)
195 # actually do anything in egcs-1.1.2?
196 $(CC) $(CFLAGS) -Wl,--base-file,testgmodule.base -o testgmodule.exe testgmodule.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) $(LDFLAGS)
197 $(DLLTOOL) --base-file testgmodule.base --output-exp testgmodule.exp testgmodule.o
198 $(CC) $(CFLAGS) -Wl,--base-file,testgmodule.base,testgmodule.exp -o testgmodule.exe testgmodule.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) $(LDFLAGS)
199 $(DLLTOOL) --base-file testgmodule.base --output-exp testgmodule.exp testgmodule.o
200 $(CC) $(CFLAGS) -Wl,testgmodule.exp -o testgmodule.exe testgmodule.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) $(LDFLAGS)
202 testgmodule.o : gmodule/testgmodule.c
203 $(CC) $(CFLAGS) -Igmodule -c gmodule/testgmodule.c
205 libgplugin_a.dll : libgplugin_a.o
206 ./build-dll libgplugin_a - - libgplugin_a.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER)
208 libgplugin_a.o : gmodule/libgplugin_a.c
209 $(CC) $(CFLAGS) -Igmodule -c gmodule/libgplugin_a.c
211 libgplugin_b.dll : libgplugin_b.o
212 ./build-dll libgplugin_b - - libgplugin_b.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER)
214 libgplugin_b.o : gmodule/libgplugin_b.c
215 $(CC) $(CFLAGS) -Igmodule -c gmodule/libgplugin_b.c
217 ################ other stuff
220 -rm config.h glibconfig.h gmodule/gmoduleconf.h