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