1 # NMake Makefile to build Introspection Files for G-I
3 # Change or pass in as a variable/env var if needed
4 # The main DLLs that are used to build introspection files that are "installed"
5 CAIROGOBJECT_DLLNAME= cairo-gobject-vs$(VSVER)
7 # Please do not change anything after this line
9 !include detectenv_msvc.mak
14 CHECK_PACKAGE = gio-$(GLIB_APIVERSION)
16 !include introspection-msvc.mak
18 BINDIR = ..\build\win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin
19 G_IR_SCANNER_CURRENT = ..\tools\g-ir-scanner
20 G_IR_COMPILER_CURRENT = $(BINDIR)\g-ir-compiler.exe
22 !if "$(PLAT)" == "x64"
23 TIME_T_DEFINE = -Dtime_t=long long
25 TIME_T_DEFINE = -Dtime_t=long
28 # The .gir's that are in $(srcroot)/gir, applicable to Windows
29 # cairo-1.0.gir is not listed as it needs to be processed first
37 # The .typelib's that are build from the .gir's bundled with the
38 # G-I package, applicable to Windows
41 fontconfig-2.0.typelib \
42 freetype2-2.0.typelib \
47 # The .gir's for GLib/G-I that are built and "installed"
48 built_install_girs = \
49 GLib-$(GLIB_APIVERSION).gir \
50 GModule-$(GLIB_APIVERSION).gir \
51 GObject-$(GLIB_APIVERSION).gir \
52 Gio-$(GLIB_APIVERSION).gir \
53 GIRepository-$(GLIB_APIVERSION).gir
55 # The .typelib's for GLib/G-I that are built and "installed"
56 built_install_typelibs = \
57 GLib-$(GLIB_APIVERSION).typelib \
58 GModule-$(GLIB_APIVERSION).typelib \
59 GObject-$(GLIB_APIVERSION).typelib \
60 Gio-$(GLIB_APIVERSION).typelib \
61 GIRepository-$(GLIB_APIVERSION).typelib
63 !include introspection-msvc.mak
65 !if "$(BUILD_INTROSPECTION)" == "TRUE"
66 all: setgirbuildnev $(built_install_girs) $(built_install_typelibs) $(bundled_girs) $(bundled_typelibs)
70 @set PYTHONPATH=..;$(BINDIR)
71 @set PATH=$(BINDIR);$(BASEDIR)\bin;$(PATH);$(MINGWDIR)\bin
72 @set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)
73 @set LIB=win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin;$(BASEDIR)\lib;$(LIB)
74 @set UNINSTALLED_INTROSPECTION_SRCDIR=..
77 @-echo Generating file list for GLib...
78 @-echo $(BASEDIR)\lib\glib-2.0\include\glibconfig.h> $@
79 @-for /f %%a in ('dir /b $(BASEDIR)\include\glib-2.0\glib\*.h') do @echo $(BASEDIR)\include\glib-2.0\glib\%%a>> $@
80 @-echo $(BASEDIR)\include\glib-2.0\gobject\glib-types.h>> $@
81 @-echo ..\gir\glib-2.0.c>> $@
84 @-echo Generating file list for GObject...
86 @-for /f %%a in ('dir /b $(BASEDIR)\include\glib-2.0\gobject\*.h') do @if not %%a == glib-types.h @echo $(BASEDIR)\include\glib-2.0\gobject\%%a>> $@
87 @-echo ..\gir\gobject-2.0.c>> $@
90 @-echo Generating file list for GIO...
92 @-for /f %%a in ('dir /b $(BASEDIR)\include\gio-win32-2.0\gio\*.h') do @echo $(BASEDIR)\include\gio-win32-2.0\gio\%%a>> $@
93 @-for /f %%a in ('dir /b $(BASEDIR)\include\glib-2.0\gio\*.h') do @if not %%a == gsettingsbackend.h @echo $(BASEDIR)\include\glib-2.0\gio\%%a>> $@
94 @-echo ..\gir\gio-2.0.c>> $@
97 @-echo Generating file list for girepository...
98 @-echo ..\girepository\girepository.h > $@
99 @-echo ..\girepository\girepository.c >> $@
100 @-for /f %%a in ('dir /b ..\girepository\gi*info.c') do @echo ..\girepository\%%a >> $@
101 @-for /f %%a in ('dir /b ..\girepository\gi*info.h') do @echo ..\girepository\%%a >> $@
102 @-echo ..\girepository\gitypelib.h >> $@
103 @-echo ..\girepository\gitypes.h >> $@
105 # Make a copy of girepository-1.0.lib to girepository-2.0.lib for use
106 # during the linking stage of the dump binary, in the generation
107 # of GIRepository-2.0.gir (the resulting binary will still be
108 # linked and referring to the original girepository DLL)
109 win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\girepository-$(GLIB_APIVERSION).lib: win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\girepository-$(GI_APIVERSION).lib
110 @-copy /b win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\girepository-$(GI_APIVERSION).lib $@
112 # Generated .gir files for GLib/GModule/GObject/Gio/GIRepository
113 GLib-$(GLIB_APIVERSION).gir: glib_list
114 @-echo Generating $@...
115 $(PYTHON2) $(G_IR_SCANNER_CURRENT) --verbose -I.. --add-include-path=.. \
116 --add-include-path=..\gir --add-include-path=. --namespace=GLib --nsversion=$(GLIB_APIVERSION) \
117 --no-libtool --pkg=glib-$(GLIB_APIVERSION) --include=win32-$(GI_APIVERSION) --library=glib-2.0 --library=gobject-2.0 \
118 --external-library --reparse-validate --identifier-prefix=G --symbol-prefix=g \
119 --symbol-prefix=glib --c-include="glib.h" -I$(BASEDIR)\include\glib-$(GLIB_APIVERSION) \
120 -I$(BASEDIR)\lib\glib-2.0\include -I$(BASEDIR)\include -DGETTEXT_PACKAGE=Dummy \
121 -DGLIB_COMPILATION -D__G_I18N_LIB_H__ --filelist=glib_list -o $@
123 GModule-$(GLIB_APIVERSION).gir: GLib-$(GLIB_APIVERSION).gir
124 @-echo Generating $@...
125 $(PYTHON2) $(G_IR_SCANNER_CURRENT) --verbose -I.. --add-include-path=.. \
126 --add-include-path=..\gir --add-include-path=. --namespace=GModule --nsversion=2.0 \
127 --no-libtool --include=GLib-$(GLIB_APIVERSION) --pkg=gmodule-$(GLIB_APIVERSION) --library=gmodule-2.0 \
128 --external-library --reparse-validate --identifier-prefix=G --c-include="gmodule.h" \
129 -I$(BASEDIR)\include\glib-2.0 -I$(BASEDIR)\lib\glib-2.0\include -I$(BASEDIR)\include \
130 $(BASEDIR)\include\glib-2.0\gmodule.h ..\gir\gmodule-2.0.c -o $@
132 GObject-$(GLIB_APIVERSION).gir: gobject_list GModule-$(GLIB_APIVERSION).gir
133 @-echo Generating $@...
134 $(PYTHON2) $(G_IR_SCANNER_CURRENT) --verbose -I.. --add-include-path=.. \
135 --add-include-path=..\gir --add-include-path=. --namespace=GObject --nsversion=$(GLIB_APIVERSION) \
136 --no-libtool --include=GLib-$(GLIB_APIVERSION) --pkg=gobject-$(GLIB_APIVERSION) --library=gobject-2.0 \
137 --external-library --reparse-validate --identifier-prefix=G --c-include="glib-gobject.h" \
138 -I$(BASEDIR)/include/glib-2.0 -I$(BASEDIR)/lib/glib-2.0/include -I$(BASEDIR)/include \
139 -DGOBJECT_COMPILATION --filelist=gobject_list -o $@
141 Gio-$(GLIB_APIVERSION).gir: gio_list GObject-$(GLIB_APIVERSION).gir
142 @-echo Generating $@...
143 $(PYTHON2) $(G_IR_SCANNER_CURRENT) --verbose -I.. --add-include-path=.. \
144 --add-include-path=..\gir --add-include-path=. --namespace=Gio --nsversion=$(GLIB_APIVERSION) \
145 --no-libtool --pkg=gio-$(GLIB_APIVERSION) --pkg=gio-windows-$(GLIB_APIVERSION) --include=GObject-$(GLIB_APIVERSION) \
146 --library=gio-2.0 --external-library --reparse-validate --warn-all \
147 --identifier-prefix=G --include=GLib-$(GLIB_APIVERSION) --c-include="gio/gio.h" -DGIO_COMPILATION \
148 -I$(BASEDIR)\include\glib-2.0 -I$(BASEDIR)\lib\glib-2.0\include \
149 -I$(BASEDIR)\include --filelist=gio_list -o $@
151 GIRepository-$(GLIB_APIVERSION).gir: gi_list GObject-$(GLIB_APIVERSION).gir win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\girepository-$(GLIB_APIVERSION).lib
152 @-echo Generating $@...
153 $(PYTHON2) $(G_IR_SCANNER_CURRENT) --verbose --warn-all \
154 --add-include-path=..\gir --add-include-path=. --namespace=GIRepository --nsversion=$(GLIB_APIVERSION) \
155 --identifier-prefix=GI --symbol-prefix=g --c-include="girepository.h" --add-include-path=. \
156 --no-libtool --pkg=gobject-$(GLIB_APIVERSION) --include=GObject-$(GLIB_APIVERSION) \
157 --library=girepository-1.0 -I..\girepository -I.. -I%BASEDIR%\include \
158 -I%BASEDIR%\include\glib-2.0 -I%BASEDIR%\lib\glib-2.0\include --filelist=gi_list \
159 -DGI_COMPILATION -o $@
161 # Bundled cairo-1.0.gir.in processing
162 cairo-1.0.gir: ..\gir\cairo-1.0.gir.in
163 @-echo Generating and copying $@ from $*.gir.in...
164 @-if not exist ..\gir\$*.gir $(PYTHON2) gen-cairo-gir.py --dllname=$(CAIROGOBJECT_DLLNAME).dll
165 @-copy ..\gir\$*.gir $@
167 # Copy the .gir's bundled with G-I to this folder
168 $(bundled_girs): ..\gir\win32-1.0.gir ..\gir\fontconfig-2.0.gir ..\gir\freetype2-2.0.gir ..\gir\GL-1.0.gir ..\gir\libxml2-2.0.gir
169 @-echo Copying the bundled $*.gir that came with the GobjectIntrospection package...
170 @-copy ..\gir\$*.gir $@
172 # Generate .typelib's from generated .gir's
173 $(built_install_typelibs): $(built_install_girs)
174 @-echo Compiling $*.typelib...
175 @-$(G_IR_COMPILER_CURRENT) --includedir=. --debug --verbose $*.gir -o $@
177 # Generate .typelib's from bundled .gir's
178 $(bundled_typelibs): cairo-1.0.gir $(bundled_girs)
179 @-echo Compiling the bundled $*.gir that came with the GobjectIntrospection package...
180 @-$(G_IR_COMPILER_CURRENT) --includedir=. --debug --verbose $*.gir -o $@
182 install-introspection: setgirbuildnev $(built_install_girs) $(built_install_typelibs) $(bundled_girs) cairo-1.0.gir $(bundled_typelibs)
183 @-copy cairo-1.0.gir $(G_IR_INCLUDEDIR)
184 @-for %a in ($(built_install_girs)) do @copy %a $(G_IR_INCLUDEDIR)
185 @-for %b in ($(built_install_typelibs)) do @copy %b $(G_IR_TYPELIBDIR)
186 @-for %c in ($(bundled_girs)) do @copy %c $(G_IR_INCLUDEDIR)
187 @-for %d in ($(bundled_typelibs)) do @copy %d $(G_IR_TYPELIBDIR)
190 all: install-introspection
192 install-introspection:
197 @-del /f/q ..\gir\cairo-$(GI_APIVERSION).gir
200 @-del /f/q win32\vs$(VSVER)\$(CFG)\$(PLAT)\bin\girepository-$(GLIB_APIVERSION).lib
203 @-del /f/q gobject_list