4820eaafa33bcc49911bcd4b39bc0bf42efaac8a
[platform/upstream/glib.git] / makefile.cygwin
1 ## Makefile for building the GLib, gmodule and gthread DLLs with
2 ## egcs on cygwin.
3 ## Use: make -f makefile.cygwin install
4
5 # Change this to wherever you want to install the DLLs. This directory
6 # should be in your PATH.
7 BIN = /bin
8
9 # This is the location of pthreads for Win32, 
10 # see http://sourceware.cygnus.com/pthreads-win32/
11 PTHREADS = ../pthreads-snap-1999-04-07
12 PTHREAD_LIB = -L$(PTHREADS) -lpthread
13 PTHREAD_INC = -I $(PTHREADS)
14
15 OPTIMIZE = -g -O
16
17 ################################################################
18
19 # Nothing much configurable below
20
21 CC = gcc -mno-cygwin -mpentium
22
23 CP = cp
24 LD = ld
25 DLLTOOL = dlltool
26 INSTALL = install
27
28 GLIB_VER = 1.3
29
30 CFLAGS = $(OPTIMIZE) -I. -DHAVE_CONFIG_H
31
32 all : \
33         glibconfig.h    \
34         config.h        \
35         glib-$(GLIB_VER).dll    \
36         gthread-$(GLIB_VER).dll \
37         gmodule/gmoduleconf.h \
38         gmodule-$(GLIB_VER).dll \
39         testglib.exe    \
40         testgmodule.exe \
41         testgdate.exe   \
42         testgdateparser.exe \
43         testgthread.exe
44
45 install : all
46         $(INSTALL) glib-$(GLIB_VER).dll $(BIN)
47         $(INSTALL) gmodule-$(GLIB_VER).dll $(BIN)
48         $(INSTALL) gthread-$(GLIB_VER).dll $(BIN)
49
50 glib_OBJECTS = \
51         garray.o        \
52         gcache.o        \
53         gcompletion.o   \
54         gdataset.o      \
55         gdate.o         \
56         gerror.o        \
57         ghook.o         \
58         ghash.o         \
59         giochannel.o    \
60         giowin32.o      \
61         glist.o         \
62         gmain.o         \
63         gmem.o          \
64         gmessages.o     \
65         gmutex.o        \
66         gnode.o         \
67         gprimes.o       \
68         gqueue.o        \
69         grand.o         \
70         gslist.o        \
71         gstack.o        \
72         gtimer.o        \
73         gtree.o         \
74         grel.o          \
75         gstring.o       \
76         gstrfuncs.o     \
77         gscanner.o      \
78         gutils.o
79
80 glib-$(GLIB_VER).dll : $(glib_OBJECTS) glib.def
81         ./build-dll glib $(GLIB_VER) glib.def $(glib_OBJECTS) -luser32 -lwsock32
82
83 glibconfig.h: glibconfig.h.win32
84         $(CP) glibconfig.h.win32 glibconfig.h
85
86 config.h: config.h.win32
87         $(CP) config.h.win32 config.h
88
89 .c.o :
90         $(CC) $(CFLAGS) -c -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib $<
91
92 gmodule_OBJECTS = \
93         gmodule.o
94
95 gmodule-$(GLIB_VER).dll : $(gmodule_OBJECTS) gmodule/gmodule.def
96         ./build-dll gmodule $(GLIB_VER) gmodule/gmodule.def $(gmodule_OBJECTS) -L. -lglib-$(GLIB_VER) -lwsock32
97
98 gmodule.o : gmodule/gmodule.c gmodule/gmodule-win32.c
99         $(CC) $(CFLAGS) -Igmodule -c -DG_LOG_DOMAIN=g_log_domain_gmodule gmodule/gmodule.c
100
101 gmodule/gmoduleconf.h: gmodule/gmoduleconf.h.win32
102         $(CP) gmodule/gmoduleconf.h.win32 gmodule/gmoduleconf.h
103
104 gthread_OBJECTS = \
105         gthread.o
106
107 gthread-$(GLIB_VER).dll : $(gthread_OBJECTS) glib-$(GLIB_VER).dll gthread/gthread.def
108         ./build-dll gthread $(GLIB_VER) gthread/gthread.def $(gthread_OBJECTS)  -L. -lglib-$(GLIB_VER) $(PTHREAD_LIB) -lwsock32
109
110 gthread.o : gthread/gthread.c gthread/gthread-posix.c
111         $(CC) $(CFLAGS) $(PTHREAD_INC) -DG_LOG_DOMAIN=\"GThread\" -c gthread/gthread.c
112
113 testglib.exe : glib-$(GLIB_VER).dll testglib.o
114         $(CC) $(CFLAGS) -o testglib testglib.o -L. -lglib-$(GLIB_VER) $(LDFLAGS)
115
116 testglib.o : testglib.c
117         $(CC) -c $(CFLAGS) testglib.c
118
119 testgdate.exe : glib-$(GLIB_VER).dll testgdate.o
120         $(CC) $(CFLAGS) -o testgdate.exe testgdate.o -L. -lglib-$(GLIB_VER) $(LDFLAGS)
121
122 testgdate.o : testgdate.c
123         $(CC) -c $(CFLAGS) testgdate.c
124
125 testgdateparser.exe : glib-$(GLIB_VER).dll testgdateparser.o
126         $(CC) $(CFLAGS) -o testgdateparser.exe testgdateparser.o -L. -lglib-$(GLIB_VER) $(LDFLAGS)
127
128 testgdateparser.o : testgdateparser.c
129         $(CC) -c $(CFLAGS) testgdateparser.c
130
131 testgmodule.exe : glib-$(GLIB_VER).dll gmodule-$(GLIB_VER).dll testgmodule.o libgplugin_a.dll libgplugin_b.dll
132 # Wow, do we really have to do it like this to get some symbols
133 # exported from a .exe? Apparently yes. Does the __declspec(dllexport) 
134 # actually do anything in egcs-1.1.2?
135         $(CC) $(CFLAGS) -Wl,--base-file,testgmodule.base -o testgmodule.exe testgmodule.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) $(LDFLAGS)
136         $(DLLTOOL) --base-file testgmodule.base --output-exp testgmodule.exp testgmodule.o
137         $(CC) $(CFLAGS) -Wl,--base-file,testgmodule.base,testgmodule.exp -o testgmodule.exe testgmodule.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) $(LDFLAGS)
138         $(DLLTOOL) --base-file testgmodule.base --output-exp testgmodule.exp testgmodule.o
139         $(CC) $(CFLAGS) -Wl,testgmodule.exp -o testgmodule.exe testgmodule.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) $(LDFLAGS)
140
141 testgmodule.o : gmodule/testgmodule.c
142         $(CC) $(CFLAGS) -Igmodule -c gmodule/testgmodule.c
143
144 libgplugin_a.dll : libgplugin_a.o
145         ./build-dll libgplugin_a - - libgplugin_a.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER)
146
147 libgplugin_a.o : gmodule/libgplugin_a.c
148         $(CC) $(CFLAGS) -Igmodule -c gmodule/libgplugin_a.c
149
150 libgplugin_b.dll : libgplugin_b.o
151         ./build-dll libgplugin_b - - libgplugin_b.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER)
152
153 libgplugin_b.o : gmodule/libgplugin_b.c
154         $(CC) $(CFLAGS) -Igmodule -c gmodule/libgplugin_b.c
155
156 testgthread.exe : glib-$(GLIB_VER).dll gthread-$(GLIB_VER).dll testgthread.o
157         $(CC) $(CFLAGS) -o testgthread.exe testgthread.o -L. -lglib-$(GLIB_VER) -lgthread-$(GLIB_VER) $(PTHREAD_LIB) $(LDFLAGS)
158
159 testgthread.o : gthread/testgthread.c
160         $(CC) $(CFLAGS) $(PTHREAD_INC) -c gthread/testgthread.c
161
162 clean:
163         -rm config.h glibconfig.h gmodule/gmoduleconf.h
164         -rm *.exe *.o *.dll *.a *.base *.exp