1999-04-24 15:52:51 +02:00
|
|
|
## Makefile for building the GLib, gmodule and gthread DLLs with
|
2000-02-04 14:57:46 +01:00
|
|
|
## gcc on cygwin or mingw32.
|
1999-04-24 15:52:51 +02:00
|
|
|
## Use: make -f makefile.cygwin install
|
|
|
|
|
|
|
|
# Change this to wherever you want to install the DLLs. This directory
|
|
|
|
# should be in your PATH.
|
|
|
|
BIN = /bin
|
|
|
|
|
|
|
|
# This is the location of pthreads for Win32,
|
|
|
|
# see http://sourceware.cygnus.com/pthreads-win32/
|
1999-06-21 00:20:43 +02:00
|
|
|
# We want the 1999-05-30 snapshot.
|
|
|
|
PTHREADS = ../pthreads-snap-1999-05-30
|
|
|
|
PTHREAD_LIB = -L$(PTHREADS) -lpthread32
|
1999-04-24 15:52:51 +02:00
|
|
|
PTHREAD_INC = -I $(PTHREADS)
|
|
|
|
|
1999-04-25 22:52:42 +02:00
|
|
|
OPTIMIZE = -g -O
|
|
|
|
|
1999-04-24 15:52:51 +02:00
|
|
|
################################################################
|
|
|
|
|
|
|
|
# Nothing much configurable below
|
|
|
|
|
1999-07-21 21:18:03 +02:00
|
|
|
CC = gcc -mno-cygwin -mpentium -fnative-struct
|
1999-04-24 15:52:51 +02:00
|
|
|
|
|
|
|
DLLTOOL = dlltool
|
|
|
|
INSTALL = install
|
|
|
|
|
1999-05-06 19:33:15 +02:00
|
|
|
GLIB_VER = @GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@
|
1999-04-24 15:52:51 +02:00
|
|
|
|
1999-04-25 22:52:42 +02:00
|
|
|
CFLAGS = $(OPTIMIZE) -I. -DHAVE_CONFIG_H
|
1999-04-24 15:52:51 +02:00
|
|
|
|
2000-03-26 22:56:07 +02:00
|
|
|
# Kludge to get the path to the win32 headers. Should work for both
|
|
|
|
# gcc running on cygwin, and bare mingw gcc, even if the make is
|
|
|
|
# running on cygwin (whew).
|
|
|
|
WIN32APIHEADERS = $(shell echo "\#include <winver.h>" | $(CC) -M -E - | tail -1 | sed -e 's![\\/]winver.h!!' | tr -d '\015')
|
2000-02-07 22:22:30 +01:00
|
|
|
|
1999-04-24 15:52:51 +02:00
|
|
|
all : \
|
|
|
|
config.h \
|
1999-07-13 01:11:27 +02:00
|
|
|
glibconfig.h \
|
1999-07-21 21:18:03 +02:00
|
|
|
glib-$(GLIB_VER).dll \
|
1999-04-24 15:52:51 +02:00
|
|
|
gmodule/gmoduleconf.h \
|
1999-07-21 21:18:03 +02:00
|
|
|
gmodule-$(GLIB_VER).dll \
|
|
|
|
gthread-$(GLIB_VER).dll \
|
1999-04-24 15:52:51 +02:00
|
|
|
testglib.exe \
|
|
|
|
testgmodule.exe \
|
|
|
|
testgdate.exe \
|
1999-06-21 00:20:43 +02:00
|
|
|
testgdateparser.exe
|
1999-04-24 15:52:51 +02:00
|
|
|
|
|
|
|
install : all
|
1999-07-21 21:18:03 +02:00
|
|
|
$(INSTALL) glib-$(GLIB_VER).dll $(BIN)
|
|
|
|
$(INSTALL) gmodule-$(GLIB_VER).dll $(BIN)
|
|
|
|
$(INSTALL) gthread-$(GLIB_VER).dll $(BIN)
|
1999-04-24 15:52:51 +02:00
|
|
|
|
|
|
|
glib_OBJECTS = \
|
|
|
|
garray.o \
|
|
|
|
gcache.o \
|
|
|
|
gcompletion.o \
|
|
|
|
gdataset.o \
|
|
|
|
gdate.o \
|
|
|
|
gerror.o \
|
|
|
|
ghook.o \
|
|
|
|
ghash.o \
|
|
|
|
giochannel.o \
|
|
|
|
giowin32.o \
|
|
|
|
glist.o \
|
|
|
|
gmain.o \
|
|
|
|
gmem.o \
|
|
|
|
gmessages.o \
|
|
|
|
gnode.o \
|
|
|
|
gprimes.o \
|
|
|
|
gqueue.o \
|
|
|
|
grand.o \
|
|
|
|
gslist.o \
|
1999-06-21 00:20:43 +02:00
|
|
|
gthread.o \
|
1999-04-24 15:52:51 +02:00
|
|
|
gtimer.o \
|
|
|
|
gtree.o \
|
|
|
|
grel.o \
|
|
|
|
gstring.o \
|
|
|
|
gstrfuncs.o \
|
|
|
|
gscanner.o \
|
1999-11-04 23:49:19 +01:00
|
|
|
gutils.o \
|
2000-02-04 14:57:46 +01:00
|
|
|
gwin32.o \
|
|
|
|
glib-win32res.o
|
1999-04-24 15:52:51 +02:00
|
|
|
|
2000-02-07 22:22:30 +01:00
|
|
|
glibconfig.h: glibconfig.h.win32
|
|
|
|
cp glibconfig.h.win32 glibconfig.h
|
1999-04-24 15:52:51 +02:00
|
|
|
|
2000-02-07 22:22:30 +01:00
|
|
|
config.h: config.h.win32
|
|
|
|
cp config.h.win32 config.h
|
|
|
|
|
|
|
|
################ glib
|
2000-02-04 14:57:46 +01:00
|
|
|
|
|
|
|
# The *.stamp files aren't distributed. Thus, this takes care of only
|
|
|
|
# tml building libraries with nonzero build number.
|
|
|
|
|
|
|
|
ifeq ($(wildcard glib-build.stamp),glib-build.stamp)
|
|
|
|
# Bump the build number
|
|
|
|
glib-build.tmp :
|
|
|
|
bash -c "read number && echo $$[number+1]" <glib-build.stamp >glib-build.tmp
|
|
|
|
cp glib-build.tmp glib-build.stamp
|
|
|
|
else
|
|
|
|
# Use zero as build number.
|
|
|
|
glib-build.tmp :
|
|
|
|
echo 0 >glib-build.tmp
|
|
|
|
endif
|
|
|
|
|
2000-02-07 22:22:30 +01:00
|
|
|
glib-win32res.o : glib.rc glib-build.tmp
|
|
|
|
m4 -DBUILDNUMBER=`cat glib-build.tmp` <glib.rc >glib-win32res.rc
|
|
|
|
windres --include-dir $(WIN32APIHEADERS) glib-win32res.rc glib-win32res.o
|
|
|
|
rm glib-build.tmp glib-win32res.rc
|
2000-02-04 14:57:46 +01:00
|
|
|
|
2000-02-07 22:22:30 +01:00
|
|
|
glib-$(GLIB_VER).dll : $(glib_OBJECTS) glib.def
|
|
|
|
./build-dll glib $(GLIB_VER) glib.def $(glib_OBJECTS) -luser32 -lwsock32
|
1999-04-24 15:52:51 +02:00
|
|
|
|
|
|
|
|
2000-02-07 22:22:30 +01:00
|
|
|
################ gmodule
|
1999-11-04 23:49:19 +01:00
|
|
|
|
1999-04-24 15:52:51 +02:00
|
|
|
gmodule_OBJECTS = \
|
2000-02-04 14:57:46 +01:00
|
|
|
gmodule.o \
|
|
|
|
gmodule-win32res.o
|
|
|
|
|
|
|
|
# Unfortunately I couldn't use a pattern rule for this, so copy-paste
|
|
|
|
# from above.
|
|
|
|
ifeq ($(wildcard glib-build.stamp),glib-build.stamp)
|
|
|
|
gmodule-build.tmp :
|
|
|
|
bash -c "read number && echo $$[number+1]" <gmodule-build.stamp >gmodule-build.tmp
|
|
|
|
cp gmodule-build.tmp gmodule-build.stamp
|
|
|
|
else
|
|
|
|
gmodule-build.tmp :
|
|
|
|
echo 0 >gmodule-build.tmp
|
|
|
|
endif
|
1999-04-24 15:52:51 +02:00
|
|
|
|
2000-02-07 22:22:30 +01:00
|
|
|
gmodule-win32res.o : gmodule/gmodule.rc gmodule-build.tmp
|
|
|
|
m4 -DBUILDNUMBER=`cat gmodule-build.tmp` <gmodule/gmodule.rc >gmodule-win32res.rc
|
|
|
|
windres --include-dir $(WIN32APIHEADERS) gmodule-win32res.rc gmodule-win32res.o
|
|
|
|
rm gmodule-build.tmp gmodule-win32res.rc
|
|
|
|
|
|
|
|
|
1999-07-21 21:18:03 +02:00
|
|
|
gmodule-$(GLIB_VER).dll : $(gmodule_OBJECTS) gmodule/gmodule.def
|
|
|
|
./build-dll gmodule $(GLIB_VER) gmodule/gmodule.def $(gmodule_OBJECTS) -L. -lglib-$(GLIB_VER) -lwsock32
|
1999-04-24 15:52:51 +02:00
|
|
|
|
|
|
|
gmodule.o : gmodule/gmodule.c gmodule/gmodule-win32.c
|
|
|
|
$(CC) $(CFLAGS) -Igmodule -c -DG_LOG_DOMAIN=g_log_domain_gmodule gmodule/gmodule.c
|
|
|
|
|
|
|
|
gmodule/gmoduleconf.h: gmodule/gmoduleconf.h.win32
|
2000-02-04 14:57:46 +01:00
|
|
|
cp gmodule/gmoduleconf.h.win32 gmodule/gmoduleconf.h
|
1999-04-24 15:52:51 +02:00
|
|
|
|
2000-02-07 22:22:30 +01:00
|
|
|
################ gthread
|
|
|
|
|
1999-04-24 15:52:51 +02:00
|
|
|
gthread_OBJECTS = \
|
2000-02-04 14:57:46 +01:00
|
|
|
gthread-impl.o \
|
|
|
|
gthread-win32res.o
|
|
|
|
|
|
|
|
# Ditto copy-pasting
|
|
|
|
ifeq ($(wildcard glib-build.stamp),glib-build.stamp)
|
|
|
|
gthread-build.tmp :
|
|
|
|
bash -c "read number && echo $$[number+1]" <gthread-build.stamp >gthread-build.tmp
|
|
|
|
cp gthread-build.tmp gthread-build.stamp
|
|
|
|
else
|
|
|
|
gthread-build.tmp :
|
|
|
|
echo 0 >gthread-build.tmp
|
|
|
|
endif
|
1999-04-24 15:52:51 +02:00
|
|
|
|
2000-02-07 22:22:30 +01:00
|
|
|
gthread-win32res.o : gthread/gthread.rc gthread-build.tmp
|
|
|
|
m4 -DBUILDNUMBER=`cat gthread-build.tmp` <gthread/gthread.rc >gthread-win32res.rc
|
|
|
|
windres --include-dir $(WIN32APIHEADERS) gthread-win32res.rc gthread-win32res.o
|
|
|
|
rm gthread-build.tmp gthread-win32res.rc
|
|
|
|
|
|
|
|
|
1999-07-21 21:18:03 +02:00
|
|
|
gthread-$(GLIB_VER).dll : $(gthread_OBJECTS) glib-$(GLIB_VER).dll gthread/gthread.def
|
|
|
|
./build-dll gthread $(GLIB_VER) gthread/gthread.def $(gthread_OBJECTS) -L. -lglib-$(GLIB_VER) $(PTHREAD_LIB)
|
1999-04-24 15:52:51 +02:00
|
|
|
|
1999-06-21 00:20:43 +02:00
|
|
|
gthread-impl.o : gthread/gthread-impl.c gthread/gthread-posix.c
|
|
|
|
$(CC) $(CFLAGS) $(PTHREAD_INC) -DG_LOG_DOMAIN=\"GThread\" -c gthread/gthread-impl.c
|
1999-04-24 15:52:51 +02:00
|
|
|
|
2000-02-07 22:22:30 +01:00
|
|
|
################ test progs
|
|
|
|
|
1999-07-21 21:18:03 +02:00
|
|
|
testglib.exe : glib-$(GLIB_VER).dll testglib.o
|
|
|
|
$(CC) $(CFLAGS) -o testglib testglib.o -L. -lglib-$(GLIB_VER) $(LDFLAGS)
|
1999-04-24 15:52:51 +02:00
|
|
|
|
|
|
|
testglib.o : testglib.c
|
|
|
|
$(CC) -c $(CFLAGS) testglib.c
|
|
|
|
|
1999-07-21 21:18:03 +02:00
|
|
|
testgdate.exe : glib-$(GLIB_VER).dll testgdate.o
|
|
|
|
$(CC) $(CFLAGS) -o testgdate.exe testgdate.o -L. -lglib-$(GLIB_VER) $(LDFLAGS)
|
1999-04-24 15:52:51 +02:00
|
|
|
|
|
|
|
testgdate.o : testgdate.c
|
|
|
|
$(CC) -c $(CFLAGS) testgdate.c
|
|
|
|
|
1999-07-21 21:18:03 +02:00
|
|
|
testgdateparser.exe : glib-$(GLIB_VER).dll testgdateparser.o
|
|
|
|
$(CC) $(CFLAGS) -o testgdateparser.exe testgdateparser.o -L. -lglib-$(GLIB_VER) $(LDFLAGS)
|
1999-04-24 15:52:51 +02:00
|
|
|
|
|
|
|
testgdateparser.o : testgdateparser.c
|
|
|
|
$(CC) -c $(CFLAGS) testgdateparser.c
|
|
|
|
|
1999-07-21 21:18:03 +02:00
|
|
|
testgmodule.exe : glib-$(GLIB_VER).dll gmodule-$(GLIB_VER).dll testgmodule.o libgplugin_a.dll libgplugin_b.dll
|
1999-04-24 15:52:51 +02:00
|
|
|
# Wow, do we really have to do it like this to get some symbols
|
|
|
|
# exported from a .exe? Apparently yes. Does the __declspec(dllexport)
|
|
|
|
# actually do anything in egcs-1.1.2?
|
1999-07-21 21:18:03 +02:00
|
|
|
$(CC) $(CFLAGS) -Wl,--base-file,testgmodule.base -o testgmodule.exe testgmodule.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) $(LDFLAGS)
|
1999-04-24 15:52:51 +02:00
|
|
|
$(DLLTOOL) --base-file testgmodule.base --output-exp testgmodule.exp testgmodule.o
|
1999-07-21 21:18:03 +02:00
|
|
|
$(CC) $(CFLAGS) -Wl,--base-file,testgmodule.base,testgmodule.exp -o testgmodule.exe testgmodule.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) $(LDFLAGS)
|
1999-04-24 15:52:51 +02:00
|
|
|
$(DLLTOOL) --base-file testgmodule.base --output-exp testgmodule.exp testgmodule.o
|
1999-07-21 21:18:03 +02:00
|
|
|
$(CC) $(CFLAGS) -Wl,testgmodule.exp -o testgmodule.exe testgmodule.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) $(LDFLAGS)
|
1999-04-24 15:52:51 +02:00
|
|
|
|
|
|
|
testgmodule.o : gmodule/testgmodule.c
|
|
|
|
$(CC) $(CFLAGS) -Igmodule -c gmodule/testgmodule.c
|
|
|
|
|
|
|
|
libgplugin_a.dll : libgplugin_a.o
|
1999-07-21 21:18:03 +02:00
|
|
|
./build-dll libgplugin_a - - libgplugin_a.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER)
|
1999-04-24 15:52:51 +02:00
|
|
|
|
|
|
|
libgplugin_a.o : gmodule/libgplugin_a.c
|
|
|
|
$(CC) $(CFLAGS) -Igmodule -c gmodule/libgplugin_a.c
|
|
|
|
|
|
|
|
libgplugin_b.dll : libgplugin_b.o
|
1999-07-21 21:18:03 +02:00
|
|
|
./build-dll libgplugin_b - - libgplugin_b.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER)
|
1999-04-24 15:52:51 +02:00
|
|
|
|
|
|
|
libgplugin_b.o : gmodule/libgplugin_b.c
|
|
|
|
$(CC) $(CFLAGS) -Igmodule -c gmodule/libgplugin_b.c
|
|
|
|
|
2000-02-07 22:22:30 +01:00
|
|
|
################ other stuff
|
|
|
|
|
1999-04-24 15:52:51 +02:00
|
|
|
clean:
|
1999-04-25 22:52:42 +02:00
|
|
|
-rm config.h glibconfig.h gmodule/gmoduleconf.h
|
|
|
|
-rm *.exe *.o *.dll *.a *.base *.exp
|
2000-02-07 22:22:30 +01:00
|
|
|
|
|
|
|
.SUFFIXES: .c .o .i
|
|
|
|
|
|
|
|
.c.o :
|
|
|
|
$(CC) $(CFLAGS) -c -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib $<
|
|
|
|
|
|
|
|
.c.i :
|
|
|
|
$(CC) $(CFLAGS) -E -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib $< >$@
|
|
|
|
|