Revamp to be like makefile.mingw.in, make the MSVC build actually work
[platform/upstream/glib.git] / gmodule / makefile.mingw.in
1 ## Makefile for building the gmodule DLL with gcc for mingw. The build
2 ## uses tools running on cygwin, however.
3
4 ## Use: make -f makefile.mingw
5
6 TOP = ../..
7
8 include ../build/win32/make.mingw
9
10 # Possibly override GLib version in build\win32\module.defs
11 GLIB_VER = @GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@
12
13 ################################################################
14
15 # Nothing much configurable below
16
17 INCLUDES = -I .. -I .
18 DEFINES = -DHAVE_CONFIG_H -DG_LOG_DOMAIN=g_log_domain_gmodule
19
20 BUILD_DLL = ../build-dll
21
22 all : \
23         gmoduleconf.h \
24         gmodule-$(GLIB_VER).dll \
25         testgmodule.exe
26
27 makefile.mingw: makefile.mingw.in
28         sed -e 's,@GLIB[_]MAJOR_VERSION@,@GLIB_MAJOR_VERSION@,' \
29             -e 's,@GLIB[_]MINOR_VERSION@,@GLIB_MINOR_VERSION@,' <$< >$@
30
31 gmodule_OBJECTS = \
32         gmodule.o
33
34 gmoduleconf.h: gmoduleconf.h.win32
35         cp $< $@
36
37 gmodule-$(GLIB_VER).dll : $(gmodule_OBJECTS) gmodule.def
38         $(BUILD_DLL) gmodule $(GLIB_VER) gmodule.def $(gmodule_OBJECTS) -L .. -lglib-$(GLIB_VER)
39
40 ################ test prog
41
42 testgmodule.exe : gmodule-$(GLIB_VER).dll testgmodule.o libgplugin_a.dll libgplugin_b.dll
43 # Wow, do we really have to do it like this to get some symbols
44 # exported from a .exe? Apparently yes. Does the __declspec(dllexport) 
45 # actually do anything in gcc?
46         $(CC) $(CFLAGS) -Wl,--base-file,testgmodule.base -o testgmodule.exe testgmodule.o -L .. -lglib-$(GLIB_VER) -L . -lgmodule-$(GLIB_VER) $(LDFLAGS)
47         $(DLLTOOL) --base-file testgmodule.base --output-exp testgmodule.exp testgmodule.o
48         $(CC) $(CFLAGS) -Wl,--base-file,testgmodule.base,testgmodule.exp -o testgmodule.exe testgmodule.o -L .. -lglib-$(GLIB_VER) -L . -lgmodule-$(GLIB_VER) $(LDFLAGS)
49         $(DLLTOOL) --base-file testgmodule.base --output-exp testgmodule.exp testgmodule.o
50         $(CC) $(CFLAGS) -Wl,testgmodule.exp -o testgmodule.exe testgmodule.o -L .. -lglib-$(GLIB_VER) -L . -lgmodule-$(GLIB_VER) $(LDFLAGS)
51
52 libgplugin_a.dll : libgplugin_a.o
53         $(BUILD_DLL) libgplugin_a - - libgplugin_a.o -L .. -lglib-$(GLIB_VER) -L . -lgmodule-$(GLIB_VER)
54
55 libgplugin_b.dll : libgplugin_b.o
56         $(BUILD_DLL) libgplugin_b - - libgplugin_b.o -L .. -lglib-$(GLIB_VER) -L . -lgmodule-$(GLIB_VER)