in case we have to abort the program, debugging is enabled and we are not
[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-05-30 snapshot.
12 PTHREADS = ../pthreads-snap-1999-05-30
13 PTHREAD_LIB = -L$(PTHREADS) -lpthread32
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 -fnative-struct
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         config.h        \
35         glibconfig.h    \
36         glib-$(GLIB_VER).dll \
37         gmodule/gmoduleconf.h \
38         gmodule-$(GLIB_VER).dll \
39         gthread-$(GLIB_VER).dll \
40         testglib.exe    \
41         testgmodule.exe \
42         testgdate.exe   \
43         testgdateparser.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         gnode.o         \
66         gprimes.o       \
67         gqueue.o        \
68         grand.o         \
69         gslist.o        \
70         gthread.o       \
71         gtimer.o        \
72         gtree.o         \
73         grel.o          \
74         gstring.o       \
75         gstrfuncs.o     \
76         gscanner.o      \
77         gutils.o
78
79 glib-$(GLIB_VER).dll : $(glib_OBJECTS) glib.def
80         ./build-dll glib $(GLIB_VER) glib.def $(glib_OBJECTS) -luser32 -lwsock32
81
82 glibconfig.h: glibconfig.h.win32
83         $(CP) glibconfig.h.win32 glibconfig.h
84
85 config.h: config.h.win32
86         $(CP) config.h.win32 config.h
87
88 .c.o :
89         $(CC) $(CFLAGS) -c -DGLIB_COMPILATION -DG_LOG_DOMAIN=g_log_domain_glib $<
90
91 gmodule_OBJECTS = \
92         gmodule.o
93
94 gmodule-$(GLIB_VER).dll : $(gmodule_OBJECTS) gmodule/gmodule.def
95         ./build-dll gmodule $(GLIB_VER) gmodule/gmodule.def $(gmodule_OBJECTS) -L. -lglib-$(GLIB_VER) -lwsock32
96
97 gmodule.o : gmodule/gmodule.c gmodule/gmodule-win32.c
98         $(CC) $(CFLAGS) -Igmodule -c -DG_LOG_DOMAIN=g_log_domain_gmodule gmodule/gmodule.c
99
100 gmodule/gmoduleconf.h: gmodule/gmoduleconf.h.win32
101         $(CP) gmodule/gmoduleconf.h.win32 gmodule/gmoduleconf.h
102
103 gthread_OBJECTS = \
104         gthread-impl.o
105
106 gthread-$(GLIB_VER).dll : $(gthread_OBJECTS) glib-$(GLIB_VER).dll gthread/gthread.def
107         ./build-dll gthread $(GLIB_VER) gthread/gthread.def $(gthread_OBJECTS)  -L. -lglib-$(GLIB_VER) $(PTHREAD_LIB)
108
109 gthread-impl.o : gthread/gthread-impl.c gthread/gthread-posix.c
110         $(CC) $(CFLAGS) $(PTHREAD_INC) -DG_LOG_DOMAIN=\"GThread\" -c gthread/gthread-impl.c
111
112 testglib.exe : glib-$(GLIB_VER).dll testglib.o
113         $(CC) $(CFLAGS) -o testglib testglib.o -L. -lglib-$(GLIB_VER) $(LDFLAGS)
114
115 testglib.o : testglib.c
116         $(CC) -c $(CFLAGS) testglib.c
117
118 testgdate.exe : glib-$(GLIB_VER).dll testgdate.o
119         $(CC) $(CFLAGS) -o testgdate.exe testgdate.o -L. -lglib-$(GLIB_VER) $(LDFLAGS)
120
121 testgdate.o : testgdate.c
122         $(CC) -c $(CFLAGS) testgdate.c
123
124 testgdateparser.exe : glib-$(GLIB_VER).dll testgdateparser.o
125         $(CC) $(CFLAGS) -o testgdateparser.exe testgdateparser.o -L. -lglib-$(GLIB_VER) $(LDFLAGS)
126
127 testgdateparser.o : testgdateparser.c
128         $(CC) -c $(CFLAGS) testgdateparser.c
129
130 testgmodule.exe : glib-$(GLIB_VER).dll gmodule-$(GLIB_VER).dll testgmodule.o libgplugin_a.dll libgplugin_b.dll
131 # Wow, do we really have to do it like this to get some symbols
132 # exported from a .exe? Apparently yes. Does the __declspec(dllexport) 
133 # actually do anything in egcs-1.1.2?
134         $(CC) $(CFLAGS) -Wl,--base-file,testgmodule.base -o testgmodule.exe testgmodule.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) $(LDFLAGS)
135         $(DLLTOOL) --base-file testgmodule.base --output-exp testgmodule.exp testgmodule.o
136         $(CC) $(CFLAGS) -Wl,--base-file,testgmodule.base,testgmodule.exp -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,testgmodule.exp -o testgmodule.exe testgmodule.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER) $(LDFLAGS)
139
140 testgmodule.o : gmodule/testgmodule.c
141         $(CC) $(CFLAGS) -Igmodule -c gmodule/testgmodule.c
142
143 libgplugin_a.dll : libgplugin_a.o
144         ./build-dll libgplugin_a - - libgplugin_a.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER)
145
146 libgplugin_a.o : gmodule/libgplugin_a.c
147         $(CC) $(CFLAGS) -Igmodule -c gmodule/libgplugin_a.c
148
149 libgplugin_b.dll : libgplugin_b.o
150         ./build-dll libgplugin_b - - libgplugin_b.o -L. -lglib-$(GLIB_VER) -lgmodule-$(GLIB_VER)
151
152 libgplugin_b.o : gmodule/libgplugin_b.c
153         $(CC) $(CFLAGS) -Igmodule -c gmodule/libgplugin_b.c
154
155 clean:
156         -rm config.h glibconfig.h gmodule/gmoduleconf.h
157         -rm *.exe *.o *.dll *.a *.base *.exp