| 1 |
# Common NMake Makefile module for checking the build environment is sane |
| 2 |
# for building introspection files under MSVC/NMake. |
| 3 |
# This can be copied from $(gi_srcroot)\build\win32 for GNOME items |
| 4 |
# that support MSVC builds and introspection under MSVC. |
| 5 |
|
| 6 |
# Can override with env vars as needed |
| 7 |
# You will need to have built gobject-introspection for this to work. |
| 8 |
# Change or pass in or set the following to suit your environment |
| 9 |
|
| 10 |
!if "$(PREFIX)" == "" |
| 11 |
PREFIX = ..\..\..\vs$(VSVER)\$(PLAT) |
| 12 |
!endif |
| 13 |
|
| 14 |
!if ![setlocal] && \ |
| 15 |
![set PFX=$(PREFIX)] && \ |
| 16 |
![for %P in (%PFX%) do @echo PREFIX_FULL=%~dpnfP > pfx.x] |
| 17 |
!endif |
| 18 |
!include pfx.x |
| 19 |
|
| 20 |
!if "$(PKG_CONFIG_PATH)" == "" |
| 21 |
PKG_CONFIG_PATH=$(PREFIX_FULL)\lib\pkgconfig |
| 22 |
!else |
| 23 |
PKG_CONFIG_PATH=$(PREFIX_FULL)\lib\pkgconfig;$(PKG_CONFIG_PATH) |
| 24 |
!endif |
| 25 |
|
| 26 |
!if ![del $(ERRNUL) /q/f pfx.x] |
| 27 |
!endif |
| 28 |
|
| 29 |
# Note: The PYTHON must be the Python release series that was used to build |
| 30 |
# the GObject-introspection scanner Python module! |
| 31 |
# Either having python.exe your PATH will work or passing in |
| 32 |
# PYTHON=<full path to your Python interpretor> will do |
| 33 |
|
| 34 |
# This is required, and gobject-introspection needs to be built |
| 35 |
# before this can be successfully run. |
| 36 |
!if "$(PYTHON)" == "" |
| 37 |
PYTHON=python |
| 38 |
!endif |
| 39 |
|
| 40 |
# Path to the pkg-config tool, if not already in the PATH |
| 41 |
!if "$(PKG_CONFIG)" == "" |
| 42 |
PKG_CONFIG=pkg-config |
| 43 |
!endif |
| 44 |
|
| 45 |
# Don't change anything following this line! |
| 46 |
|
| 47 |
GIR_SUBDIR = share\gir-1.0 |
| 48 |
GIR_TYPELIBDIR = lib\girepository-1.0 |
| 49 |
G_IR_SCANNER = $(PREFIX)\bin\g-ir-scanner |
| 50 |
G_IR_COMPILER = $(PREFIX)\bin\g-ir-compiler.exe |
| 51 |
G_IR_INCLUDEDIR = $(PREFIX)\$(GIR_SUBDIR) |
| 52 |
G_IR_TYPELIBDIR = $(PREFIX)\$(GIR_TYPELIBDIR) |
| 53 |
|
| 54 |
VALID_PKG_CONFIG_PATH = FALSE |
| 55 |
|
| 56 |
MSG_INVALID_PKGCONFIG = You must set or specifiy a valid PKG_CONFIG_PATH |
| 57 |
MSG_INVALID_CFG = You need to specify or set CFG to be release or debug to use this Makefile to build the Introspection Files |
| 58 |
|
| 59 |
ERROR_MSG = |
| 60 |
|
| 61 |
BUILD_INTROSPECTION = TRUE |
| 62 |
|
| 63 |
!if ![set PKG_CONFIG_PATH=$(PKG_CONFIG_PATH)] \ |
| 64 |
&& ![$(PKG_CONFIG) --print-errors --errors-to-stdout $(CHECK_PACKAGE) > pkgconfig.x] \ |
| 65 |
&& ![setlocal] \ |
| 66 |
&& ![set file="pkgconfig.x"] \ |
| 67 |
&& ![FOR %A IN (%file%) DO @echo PKG_CHECK_SIZE=%~zA > pkgconfig.chksize] \ |
| 68 |
&& ![del $(ERRNUL) /q/f pkgconfig.x] |
| 69 |
!endif |
| 70 |
|
| 71 |
!include pkgconfig.chksize |
| 72 |
!if "$(PKG_CHECK_SIZE)" == "0" |
| 73 |
VALID_PKG_CONFIG_PATH = TRUE |
| 74 |
!else |
| 75 |
VALID_PKG_CONFIG_PATH = FALSE |
| 76 |
!endif |
| 77 |
|
| 78 |
!if ![del $(ERRNUL) /q/f pkgconfig.chksize] |
| 79 |
!endif |
| 80 |
|
| 81 |
VALID_CFGSET = FALSE |
| 82 |
!if "$(CFG)" == "release" || "$(CFG)" == "debug" || "$(CFG)" == "Release" || "$(CFG)" == "Debug" |
| 83 |
VALID_CFGSET = TRUE |
| 84 |
!endif |
| 85 |
|
| 86 |
!if "$(VALID_PKG_CONFIG_PATH)" != "TRUE" |
| 87 |
BUILD_INTROSPECTION = FALSE |
| 88 |
ERROR_MSG = $(MSG_INVALID_PKGCONFIG) |
| 89 |
!endif |
| 90 |
|
| 91 |
!if "$(VALID_CFGSET)" != "TRUE" |
| 92 |
BUILD_INTROSPECTION = FALSE |
| 93 |
ERROR_MSG = $(MSG_INVALID_CFG) |
| 94 |
!endif |