NMake Makefiles: Make dependency paths configurable

One can pass in GLIB_PREFIX, INCLUDEDIR and/or LIBDIR to help find the GLib
headers and libraries needed for the build.
This commit is contained in:
Chun-wei Fan 2023-05-03 12:13:40 +08:00
parent d97db4fae4
commit 6ff19081c5

View file

@ -2,13 +2,23 @@
# Visual Studio builds of GLib does not need an existing pkg-config
# installation, so build GLib first before using this.
# Change these if necessary. If building from GLib's included
# Set these if necessary. If building from GLib's included
# Visual Studio projects, this should be able to locate the GLib build
# out-of-the-box if they were not moved. GLib's headers will be found
# in $(GLIB_PREFIX)\include\glib-2.0 and $(GLIB_PREFIX)\lib\glib-2.0\include
# and its import library will be found in $(GLIB_PREFIX)\lib.
# in $(INCLUDEDIR)\glib-2.0 and $(LIBDIR)\glib-2.0\include
# and its import library will be found in $(LIBDIR).
!ifndef GLIB_PREFIX
GLIB_PREFIX = ..\vs$(VSVER)\$(PLAT)
!endif
!ifndef INCLUDEDIR
INCLUDEDIR = $(GLIB_PREFIX)\include
!endif
!ifndef LIBDIR
LIBDIR = $(GLIB_PREFIX)\lib
!endif
# The items below this line should not be changed, unless one is maintaining
# the NMake Makefiles.
@ -17,8 +27,8 @@ GLIB_PREFIX = ..\vs$(VSVER)\$(PLAT)
!if "$(VALID_CFGSET)" == "TRUE"
CFLAGS = $(CFLAGS_ADD) /W3 /Zi /FImsvc_recommended_pragmas.h /I. \
/I$(GLIB_PREFIX)\include\glib-2.0 \
/I$(GLIB_PREFIX)\lib\glib-2.0\include
/I$(INCLUDEDIR)\glib-2.0 \
/I$(LIBDIR)\glib-2.0\include
# PKG_CONFIG_SYSTEM_INCLUDE_PATH and PKG_CONFIG_SYSTEM_LIBRARY_PATH only
# work for GCC builds for now, so just set this to nothing for now
@ -29,7 +39,7 @@ pkg_config_CFLAGS = \
/DPKG_CONFIG_SYSTEM_INCLUDE_PATH="\"\"" \
/DPKG_CONFIG_SYSTEM_LIBRARY_PATH="\"\""
LDFLAGS_BASE = $(LDFLAGS_ARCH) /libpath:$(GLIB_PREFIX)\lib /DEBUG
LDFLAGS_BASE = $(LDFLAGS_ARCH) /libpath:$(LIBDIR) /DEBUG
NULL=
!if "$(CFG)" == "debug"