1 # NMake Makefile to build The Tests for G-I
3 # Please do not change anything after this line
5 !include gi-build-common-msvc.mak
7 !if "$(CFG)" == "release"
8 !if "$(VSVER)" == "9" && "$(PLAT)" == "x64"
9 TESTS_CFLAGS_ADD = /MD /O1 /Oi
11 TESTS_CFLAGS_ADD = $(CFLAGS_ADD)
14 TESTS_CFLAGS_ADD = /MDd /Od /Zi /DG_ENABLE_DEBUG
17 BASE_GLIB_LIBS = gio-$(GLIB_APIVERSION).lib gobject-$(GLIB_APIVERSION).lib gmodule-$(GLIB_APIVERSION).lib glib-$(GLIB_APIVERSION).lib
18 CFLAGS = $(TESTS_CFLAGS_ADD) /I$(TOP_SRCDIR) /W3 /we4013 /FImsvc_recommended_pragmas.h /DHAVE_CONFIG_H
19 LDFLAGS = /link $(LDFLAGS_ARCH) $(BASE_GLIB_LIBS) /DEBUG /opt:noref
20 LDFLAGS_DLL = /link $(LDFLAGS_ARCH) /DLL /out:$@ /implib:$*-$(GI_APIVERSION).lib $(BASE_GLIB_LIBS) /DEBUG /opt:noref
22 # Special CFLAGS for Regress test
23 REGRESS_CFLAGS = /I$(PREFIX)\include\cairo /DREGRESS_PRINT_PREVIEW_COMMAND="evince --unlink-tempfile --preview --print-settings %s %f" /DREGRESS_SOME_CHAR='c'
25 # The test .gir's for G-I that are built
27 GIMarshallingTests-$(GI_APIVERSION).gir \
28 Everything-$(GI_APIVERSION).gir \
29 Offsets-$(GI_APIVERSION).gir \
30 SLetter-$(GI_APIVERSION).gir \
31 Utility-$(GI_APIVERSION).gir \
32 GtkFrob-$(GI_APIVERSION).gir \
33 GetType-$(GI_APIVERSION).gir \
34 WarnLib-$(GI_APIVERSION).gir \
35 Typedefs-$(GI_APIVERSION).gir \
36 Regress-$(GI_APIVERSION).gir \
37 Bar-$(GI_APIVERSION).gir \
38 Headeronly-$(GI_APIVERSION).gir \
39 Identfilter-$(GI_APIVERSION).gir
41 built_test_typelibs = \
42 GIMarshallingTests-$(GI_APIVERSION).typelib \
43 Everything-$(GI_APIVERSION).typelib \
44 Offsets-$(GI_APIVERSION).typelib \
45 SLetter-$(GI_APIVERSION).typelib \
46 Utility-$(GI_APIVERSION).typelib \
47 GtkFrob-$(GI_APIVERSION).typelib \
48 GetType-$(GI_APIVERSION).typelib \
49 WarnLib-$(GI_APIVERSION).typelib \
50 Typedefs-$(GI_APIVERSION).typelib \
51 Regress-$(GI_APIVERSION).typelib \
52 Bar-$(GI_APIVERSION).typelib \
53 Headeronly-$(GI_APIVERSION).typelib \
54 Identfilter-$(GI_APIVERSION).typelib
59 giteststructinfo.exe \
64 Regress-$(GI_APIVERSION)-C \
65 Regress-$(GI_APIVERSION)-Python \
66 Regress-$(GI_APIVERSION)-Gjs \
67 Regress-$(GI_APIVERSION)-sections.txt
69 !if "$(BUILD_INTROSPECTION)" == "TRUE"
70 all: setgirbuildenv $(built_test_girs) $(built_test_typelibs) $(test_programs) $(built_doc_tests) warn_tests_log.txt
72 !include gi-setenv-msvc.mak
74 # Rules for building the test DLLs
75 gimarshallingtests.dll: $(TOP_SRCDIR)\tests\gimarshallingtests.c
76 $(CC) $(CFLAGS) $(TOP_SRCDIR)\tests\gimarshallingtests.c $(LDFLAGS_DLL)
77 @-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;2
79 everything.dll: everything.c everything.h
80 $(CC) $(CFLAGS) /I$(TOP_SRCDIR)\tests everything.c $(LDFLAGS_DLL)
81 @-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;2
83 offsets.dll: $(TOP_SRCDIR)\tests\offsets\offsets.c
84 $(CC) $(CFLAGS) /I$(TOP_SRCDIR)\tests /I$(TOP_SRCDIR)\tests\offsets $(TOP_SRCDIR)\tests\offsets\offsets.c $(LDFLAGS_DLL)
85 @-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;2
87 {$(TOP_SRCDIR)\tests\scanner\}.c{}.dll:
88 $(CC) $(CFLAGS) /I$(TOP_SRCDIR)\tests $< $(LDFLAGS_DLL)
89 @-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;2
92 $(CC) $(CFLAGS) /I$(TOP_SRCDIR)\tests \
94 $(TOP_SRCDIR)\tests\scanner\regress.c \
95 $(TOP_SRCDIR)\tests\scanner\annotation.c \
96 $(TOP_SRCDIR)\tests\scanner\foo.c \
97 $(TOP_SRCDIR)\tests\scanner\drawable.c \
98 $(LDFLAGS_DLL) cairo-gobject.lib cairo.lib
99 @-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;2
101 # Rules for test programs
102 {$(TOP_SRCDIR)\tests\repository\}.c{}.exe:
103 $(CC) $(CFLAGS) /I$(TOP_SRCDIR)\girepository $< $(LDFLAGS) girepository-$(GI_APIVERSION).lib
104 @-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;1
106 {$(TOP_SRCDIR)\tests\scanner\}.c{}.exe:
107 $(CC) $(CFLAGS) /I$(TOP_SRCDIR)\girepository -I$(TOP_SRCDIR)\tests $< $(LDFLAGS) girepository-$(GI_APIVERSION).lib
108 @-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;1
110 gitestoffsets.exe: gitestoffsets.c
111 $(CC) $(CFLAGS) /I$(TOP_SRCDIR)\girepository /I$(TOP_SRCDIR)\tests\offsets /I$(TOP_SRCDIR)\tests $*.c $(LDFLAGS) girepository-$(GI_APIVERSION).lib
112 @-if exist $@.manifest @mt /manifest $@.manifest /outputresource:$@;1
113 @set GI_TYPELIB_PATH=.
114 @-$@ offsets.compiled offsets.introspected
115 @-fc offsets.compiled offsets.introspected > gitestoffsets.log
117 # Rules for building the .gir's
118 GIMarshallingTests-$(GI_APIVERSION).gir: gimarshallingtests.dll
119 $(PYTHON) $(G_IR_SCANNER_CURRENT) --warn-all --warn-error --reparse-validate \
120 --namespace=GIMarshallingTests --symbol-prefix=gi_marshalling_tests --nsversion=$(GI_APIVERSION) \
121 --no-libtool -I$(TOP_SRCDIR) \
122 --add-include-path=. --include=Gio-$(GLIB_APIVERSION) \
123 --library=$* --output=$@ \
124 --c-include="tests/gimarshallingtests.h" \
125 $(TOP_SRCDIR)\tests\gimarshallingtests.h $(TOP_SRCDIR)\tests\gimarshallingtests.c
127 Everything-$(GI_APIVERSION).gir: everything.dll
128 $(PYTHON) $(G_IR_SCANNER_CURRENT) --warn-all --warn-error --reparse-validate \
129 --namespace=Everything --nsversion=$(GI_APIVERSION) \
130 --no-libtool -I$(TOP_SRCDIR) -I$(TOP_SRCDIR)\tests \
131 --add-include-path=. --include=Gio-$(GLIB_APIVERSION) \
132 --library=$* --output=$@ \
133 everything.h everything.c
135 Offsets-$(GI_APIVERSION).gir: offsets.dll
136 $(PYTHON) $(G_IR_SCANNER_CURRENT) --warn-all --warn-error --reparse-validate \
137 --namespace=Offsets --nsversion=$(GI_APIVERSION) \
138 --no-libtool -I$(TOP_SRCDIR) -I$(TOP_SRCDIR)\tests\offsets -I$(TOP_SRCDIR)\tests \
139 --pkg=gobject-$(GLIB_APIVERSION) --add-include-path=. --include=GObject-$(GLIB_APIVERSION) \
140 --library=$* --output=$@ \
141 $(TOP_SRCDIR)\tests\offsets\offsets.h $(TOP_SRCDIR)\tests\offsets\offsets.c
143 SLetter-$(GI_APIVERSION).gir: sletter.dll
144 $(PYTHON) $(G_IR_SCANNER_CURRENT) --warn-all --reparse-validate \
145 --namespace=SLetter --nsversion=$(GI_APIVERSION) \
146 --no-libtool -I$(TOP_SRCDIR)\tests -I$(TOP_SRCDIR) \
147 --add-include-path=. --include=Gio-$(GLIB_APIVERSION) \
148 --identifier-prefix=S --c-include="sletter.h" --warn-error \
149 --library=$* --output=$@ \
150 $(TOP_SRCDIR)\tests\scanner\sletter.h $(TOP_SRCDIR)\tests\scanner\sletter.c
152 Utility-$(GI_APIVERSION).gir: utility.dll
153 $(PYTHON) $(G_IR_SCANNER_CURRENT) --warn-all --reparse-validate \
154 --namespace=Utility --nsversion=$(GI_APIVERSION) \
155 --no-libtool -I$(TOP_SRCDIR)\tests -I$(TOP_SRCDIR) --pkg=gobject-$(GLIB_APIVERSION) \
156 --add-include-path=. --include=GObject-$(GLIB_APIVERSION) \
157 --c-include="utility.h" --warn-error \
158 --library=$* --output=$@ \
159 $(TOP_SRCDIR)\tests\scanner\utility.h $(TOP_SRCDIR)\tests\scanner\utility.c
161 GtkFrob-$(GI_APIVERSION).gir: gtkfrob.dll
162 $(PYTHON) $(G_IR_SCANNER_CURRENT) --warn-all --reparse-validate \
163 --namespace=GtkFrob --nsversion=$(GI_APIVERSION) \
164 --no-libtool -I$(TOP_SRCDIR)\tests -I$(TOP_SRCDIR) --pkg=gobject-$(GLIB_APIVERSION) \
165 --add-include-path=. --include=GObject-$(GLIB_APIVERSION) \
166 --identifier-prefix=Gtk --symbol-prefix=gtk_frob --warn-error \
167 --library=$* --output=$@ \
168 $(TOP_SRCDIR)\tests\scanner\gtkfrob.h $(TOP_SRCDIR)\tests\scanner\gtkfrob.c
170 GetType-$(GI_APIVERSION).gir: gettype.dll
171 $(PYTHON) $(G_IR_SCANNER_CURRENT) --warn-all --reparse-validate \
172 --namespace=GetType --nsversion=$(GI_APIVERSION) \
173 --no-libtool -I$(TOP_SRCDIR)\tests -I$(TOP_SRCDIR) --pkg=gobject-$(GLIB_APIVERSION) \
174 --add-include-path=. --include=GObject-$(GLIB_APIVERSION) \
175 --c-include="gettype.h" --identifier-prefix=GetType --symbol-prefix=gettype \
176 --library=$* --output=$@ \
177 $(TOP_SRCDIR)\tests\scanner\gettype.h $(TOP_SRCDIR)\tests\scanner\gettype.c
179 Typedefs-$(GI_APIVERSION).gir: typedefs.dll
180 $(PYTHON) $(G_IR_SCANNER_CURRENT) --warn-all --reparse-validate \
181 --namespace=Typedefs --nsversion=$(GI_APIVERSION) \
182 --no-libtool -I$(TOP_SRCDIR)\tests -I$(TOP_SRCDIR) --pkg=gobject-$(GLIB_APIVERSION) \
183 --add-include-path=. --include=GObject-$(GLIB_APIVERSION) \
184 --c-include="typedefs.h" --identifier-prefix=Typedefs --symbol-prefix=typedefs \
185 --library=$* --output=$@ \
186 $(TOP_SRCDIR)\tests\scanner\typedefs.h $(TOP_SRCDIR)\tests\scanner\typedefs.c
188 WarnLib-$(GI_APIVERSION).gir: warnlib.dll
189 $(PYTHON) $(G_IR_SCANNER_CURRENT) --warn-all --reparse-validate \
190 --namespace=WarnLib --nsversion=$(GI_APIVERSION) \
191 --no-libtool -I$(TOP_SRCDIR)\tests -I$(TOP_SRCDIR) \
192 --add-include-path=. --include=Gio-$(GLIB_APIVERSION) \
193 --c-include="warnlib.h" --symbol-prefix=warnlib_ \
194 --library=$* --output=$@ \
195 $(TOP_SRCDIR)\tests\scanner\warnlib.h $(TOP_SRCDIR)\tests\scanner\warnlib.c
197 Regress-$(GI_APIVERSION).gir: Utility-$(GI_APIVERSION).gir regress.dll
198 $(PYTHON) $(G_IR_SCANNER_CURRENT) --warn-all \
199 --namespace=Regress --nsversion=$(GI_APIVERSION) \
200 --no-libtool -I$(TOP_SRCDIR)\tests -I$(TOP_SRCDIR) \
201 --add-include-path=. --include=Gio-$(GLIB_APIVERSION) \
202 --include=Utility-$(GI_APIVERSION) --include=cairo-$(GI_APIVERSION) \
203 --c-include="regress.h" --warn-error \
204 --library=$* --output=$@ \
206 $(TOP_SRCDIR)\tests\scanner\regress.c $(TOP_SRCDIR)\tests\scanner\regress.h \
207 $(TOP_SRCDIR)\tests\scanner\annotation.c $(TOP_SRCDIR)\tests\scanner\annotation.h \
208 $(TOP_SRCDIR)\tests\scanner\foo.c $(TOP_SRCDIR)\tests\scanner\foo.h \
209 $(TOP_SRCDIR)\tests\scanner\drawable.c $(TOP_SRCDIR)\tests\scanner\drawable.h
211 Bar-$(GI_APIVERSION).gir: Utility-$(GI_APIVERSION).gir barapp.exe
212 $(PYTHON) $(G_IR_SCANNER_CURRENT) --warn-all \
213 --namespace=Bar --nsversion=$(GI_APIVERSION) \
215 --no-libtool -I$(TOP_SRCDIR)\tests -I$(TOP_SRCDIR) --pkg=gobject-$(GLIB_APIVERSION) \
216 --add-include-path=. --include=GObject-$(GLIB_APIVERSION) \
217 --accept-unprefixed \
219 $(TOP_SRCDIR)\tests\scanner\barapp.c $(TOP_SRCDIR)\tests\scanner\barapp.h
221 Headeronly-$(GI_APIVERSION).gir:
222 $(PYTHON) $(G_IR_SCANNER_CURRENT) --warn-all \
223 --warn-error --reparse-validate --namespace=Headeronly --nsversion=$(GI_APIVERSION) \
224 --header-only --output=$@ $(TOP_SRCDIR)\tests\scanner\headeronly.h
226 Identfilter-$(GI_APIVERSION).gir:
227 $(PYTHON) $(G_IR_SCANNER_CURRENT) --warn-all --reparse-validate \
228 --namespace=Identfilter --accept-unprefixed --nsversion=1.0 --header-only \
229 --identifier-filter-cmd="$(PYTHON) $(TOP_SRCDIR)\tests\scanner\identfilter.py" \
230 --output=$@ $(TOP_SRCDIR)\tests\scanner\identfilter.h
232 # Rules for doc (Mallard) tests
233 Regress-$(GI_APIVERSION)-C: Regress-$(GI_APIVERSION).gir
234 @-if exist $@ @rmdir /s /q $@
235 $(PYTHON) $(G_IR_DOC_TOOL_CURRENT) --add-include-path=. --language C .\Regress-$(GI_APIVERSION).gir -o .\$@\
237 Regress-$(GI_APIVERSION)-Python: Regress-$(GI_APIVERSION).gir
238 @-if exist $@ @rmdir /s /q $@
239 $(PYTHON) $(G_IR_DOC_TOOL_CURRENT) --add-include-path=. --language Python .\Regress-$(GI_APIVERSION).gir -o .\$@\
241 Regress-$(GI_APIVERSION)-Gjs: Regress-$(GI_APIVERSION).gir
242 @-if exist $@ @rmdir /s /q $@
243 $(PYTHON) $(G_IR_DOC_TOOL_CURRENT) --add-include-path=. --language Gjs .\Regress-$(GI_APIVERSION).gir -o .\$@\
245 Regress-$(GI_APIVERSION)-sections.txt: Regress-$(GI_APIVERSION).gir
246 $(PYTHON) $(G_IR_DOC_TOOL_CURRENT) --add-include-path=. --write-sections-file .\Regress-$(GI_APIVERSION).gir -o $@
250 @-echo Runinng warn tests...
251 @-copy GObject-$(GLIB_APIVERSION).gir $(TOP_SRCDIR)\gir
252 @-copy GLib-$(GLIB_APIVERSION).gir $(TOP_SRCDIR)\gir
253 @-set TOP_BUILDDIR=../..
254 @-for %a in ($(TOP_SRCDIR)\tests\warn\*.h) do if not "%a" == "$(TOP_SRCDIR)\tests\warn\common.h" $(PYTHON) $(TOP_SRCDIR)\tests\warn\warningtester.py %a >> $@
255 @-del $(TOP_SRCDIR)\gir\GObject-$(GLIB_APIVERSION).gir
256 @-del $(TOP_SRCDIR)\gir\GLib-$(GLIB_APIVERSION).gir
258 # Rules for source code generation
259 everything.c everything.h:
260 $(PYTHON) $(G_IR_SCANNER_CURRENT) -I$(TOP_SRCDIR) \
261 --generate-typelib-tests=Everything,everything.h,everything.c \
262 --function-decoration=_GI_TEST_EXTERN \
263 --include-first-in-src=config.h \
264 --include-last-in-header=gitestmacros.h
266 gitestoffsets.c: Offsets-$(GI_APIVERSION).typelib
267 $(PYTHON) $(TOP_SRCDIR)\tests\offsets\gen-gitestoffsets $(TOP_SRCDIR)\tests\offsets\offsets.h > $@
269 # Generate .typelib's from generated .gir's
270 $(built_test_typelibs): $(built_test_girs)
271 @-echo Compiling $*.typelib...
272 @-$(G_IR_COMPILER_CURRENT) --includedir=. --debug --verbose $*.gir -o $@
275 all: install-introspection
277 install-introspection:
282 @-del /f/q warn_tests_log.txt
283 @-del /f/q gitestoffsets.log
284 @-del /f/q Regress-$(GI_APIVERSION)-sections.txt
285 @-rmdir /s /q Regress-$(GI_APIVERSION)-Gjs
286 @-rmdir /s /q Regress-$(GI_APIVERSION)-Python
287 @-rmdir /s /q Regress-$(GI_APIVERSION)-C
288 @-for %a in ($(built_test_typelibs)) do @del %a
289 @-for %a in ($(built_test_girs)) do @del %a
295 @-for %a in (*.manifest) do @del /f/q %a
298 @-del /f/q everything.c everything.h gitestoffsets.c
299 @-del offsets.compiled offsets.introspected