From 6ff19081c5c8677904669bc49d211ccf3f39769f Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 3 May 2023 12:13:40 +0800 Subject: [PATCH] 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. --- Makefile.vc | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Makefile.vc b/Makefile.vc index b8d5316..597c5f3 100644 --- a/Makefile.vc +++ b/Makefile.vc @@ -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"