From efeff732fb22b8792ac6412f9ae72b76a6145335 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Mon, 18 Sep 2023 12:07:41 +0800 Subject: [PATCH] NMake Makefiles: Split out build rules Like the previous commit, we split out the build rules so that we keep Makefile.vc as clean as possible, as we want to support building pkg-config with the bundled copy of GLib with the NMake Makefiles as well. --- nmake/Makefile.am | 1 + nmake/Makefile.vc | 26 +------------------------- nmake/build-rules-msvc.mak | 27 +++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 25 deletions(-) create mode 100644 nmake/build-rules-msvc.mak diff --git a/nmake/Makefile.am b/nmake/Makefile.am index 51d32e9..7f06202 100644 --- a/nmake/Makefile.am +++ b/nmake/Makefile.am @@ -1,4 +1,5 @@ EXTRA_DIST = \ + build-rules-msvc.mak \ create-lists-msvc.mak \ detectenv-msvc.mak \ Makefile.vc \ diff --git a/nmake/Makefile.vc b/nmake/Makefile.vc index eaf4ab1..0aa397f 100644 --- a/nmake/Makefile.vc +++ b/nmake/Makefile.vc @@ -54,33 +54,9 @@ LDFLAGS = $(LDFLAGS_BASE) /opt:ref /LTCG pkg_config_LIBS = glib-2.0.lib -{..\}.c{vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\}.obj:: - @if not exist vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\ md vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config - @if not exist vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\config.h copy config.h.win32 vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\config.h - $(CC) $(pkg_config_CFLAGS) /Fovs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\ /Fdvs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\ /c @<< -$< -<< - all: vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config.exe -vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config.exe: $(pkg_config_OBJS) - link $(LDFLAGS) $(pkg_config_LIBS) -out:$@ @<< -$(pkg_config_OBJS) -<< - @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1 - -clean: - @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.pdb - @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.exe.manifest - @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.exe - @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.ilk - @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\*.obj - @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\vc$(PDBVER).pdb - @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\config.h - @-rd vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config - @-rd vs$(VSVER)\$(CFG)\$(PLAT) - @-rd vs$(VSVER)\$(CFG) - @-rd vs$(VSVER) +!include build-rules-msvc.mak !else all: diff --git a/nmake/build-rules-msvc.mak b/nmake/build-rules-msvc.mak new file mode 100644 index 0000000..22243be --- /dev/null +++ b/nmake/build-rules-msvc.mak @@ -0,0 +1,27 @@ +# rules for building objects, libraries and executables + +{..\}.c{vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\}.obj:: + @if not exist vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\ md vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config + @if not exist vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\config.h copy config.h.win32 vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\config.h + $(CC) $(pkg_config_CFLAGS) /Fovs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\ /Fdvs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\ /c @<< +$< +<< + +vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config.exe: $(pkg_config_OBJS) + link $(LDFLAGS) $(pkg_config_LIBS) -out:$@ @<< +$(pkg_config_OBJS) +<< + @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1 + +clean: + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.pdb + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.exe.manifest + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.exe + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.ilk + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\*.obj + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\vc$(PDBVER).pdb + @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config\config.h + @-rd vs$(VSVER)\$(CFG)\$(PLAT)\pkg-config + @-rd vs$(VSVER)\$(CFG)\$(PLAT) + @-rd vs$(VSVER)\$(CFG) + @-rd vs$(VSVER)