NMake builds: Include Visual Studio version in output dir

This avoids builds done with other Visual Studio versions being
confused with the one that is being used now.
This commit is contained in:
Chun-wei Fan 2019-10-30 17:50:48 +08:00
parent 3e92891d8c
commit 28319ed36f
6 changed files with 50 additions and 49 deletions

View File

@ -36,8 +36,9 @@ and libpsl header, into appropriate locations under PREFIX (please see
below).
This will build the libpsl DLL/LIB and the psl.exe utility in the
$(CFG)\$(ARCH) subdirectory, where ARCH is Win32 for 32-bit builds
and x64 for 64-bit (x86_64) builds.
vsX\$(CFG)\$(ARCH) subdirectory, where X is the release version
of Visual Studio, such as 9 for 2008 and 16 for 2019, and ARCH is
Win32 for 32-bit builds and x64 for 64-bit (x86_64) builds.
A number of options can be passed into the NMake command, as follows.
Enable by setting each option to 1, unless otherwise indicated:

View File

@ -14,18 +14,18 @@
# $<
# <<
{..\src\}.c{$(CFG)\$(PLAT)\libpsl\}.obj::
$(CC) $(BASE_CFLAGS) $(PSL_ADDITIONAL_CFLAGS) $(PSL_INCLUDES) /Fo$(CFG)\$(PLAT)\libpsl\ /c @<<
{..\src\}.c{vs$(VSVER)\$(CFG)\$(PLAT)\libpsl\}.obj::
$(CC) $(BASE_CFLAGS) $(PSL_ADDITIONAL_CFLAGS) $(PSL_INCLUDES) /Fovs$(VSVER)\$(CFG)\$(PLAT)\libpsl\ /c @<<
$<
<<
{..\tools\}.c{$(CFG)\$(PLAT)\psl\}.obj::
$(CC) $(BASE_CFLAGS) $(PSL_INCLUDES) /Fo$(CFG)\$(PLAT)\psl\ /c @<<
{..\tools\}.c{vs$(VSVER)\$(CFG)\$(PLAT)\psl\}.obj::
$(CC) $(BASE_CFLAGS) $(PSL_INCLUDES) /Fovs$(VSVER)\$(CFG)\$(PLAT)\psl\ /c @<<
$<
<<
# Make sure we generate suffixes_dafsa.h before trying to compile psl.c
$(CFG)\$(PLAT)\libpsl\psl.obj: $(CFG)\$(PLAT)\libpsl\suffixes_dafsa.h
vs$(VSVER)\$(CFG)\$(PLAT)\libpsl\psl.obj: vs$(VSVER)\$(CFG)\$(PLAT)\libpsl\suffixes_dafsa.h
# Inference rules for building the test programs
# Used for programs with a single source file.
@ -35,16 +35,16 @@ $(CFG)\$(PLAT)\libpsl\psl.obj: $(CFG)\$(PLAT)\libpsl\suffixes_dafsa.h
# {$(srcdir)}.$(srcext){$(destdir)}.exe::
# $(CC)|$(CXX) $(cflags) $< /Fo$*.obj /Fe$@ [/link $(linker_flags) $(dep_libs)]
{..\tests\}.c{$(CFG)\$(PLAT)\}.exe:
{..\tests\}.c{vs$(VSVER)\$(CFG)\$(PLAT)\}.exe:
@if not exist $(PSL_UTILS) $(MAKE) -f Makefile.vc $(PSL_MAKE_OPTIONS) $(PSL_UTILS)
@if not exist $(CFG)\$(PLAT)\tests $(MAKE) -f Makefile.vc $(PSL_MAKE_OPTIONS) $(CFG)\$(PLAT)\tests
$(CC) $(PSL_TEST_CFLAGS) $(PSL_INCLUDES) /Fo$(CFG)\$(PLAT)\tests\ /Fe$@ \
@if not exist vs$(VSVER)\$(CFG)\$(PLAT)\tests $(MAKE) -f Makefile.vc $(PSL_MAKE_OPTIONS) vs$(VSVER)\$(CFG)\$(PLAT)\tests
$(CC) $(PSL_TEST_CFLAGS) $(PSL_INCLUDES) /Fovs$(VSVER)\$(CFG)\$(PLAT)\tests\ /Fe$@ \
$< /link $(LDFLAGS) $(PSL_LIB) $(PSL_ADDITIONAL_LIBS)
@if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
# Rules for building .lib files
!ifdef STATIC
$(PSL_LIB): $(CFG)\$(PLAT)\libpsl ..\config.h $(libpsl_OBJS)
$(PSL_LIB): vs$(VSVER)\$(CFG)\$(PLAT)\libpsl ..\config.h $(libpsl_OBJS)
lib $(ARFLAGS) /out:$@ @<<
$(libpsl_OBJS)
<<
@ -75,7 +75,7 @@ $(libpsl_OBJS)
# <<
# @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
$(CFG)\$(PLAT)\psl.exe: $(PSL_LIB) $(CFG)\$(PLAT)\psl $(psl_OBJS)
vs$(VSVER)\$(CFG)\$(PLAT)\psl.exe: $(PSL_LIB) vs$(VSVER)\$(CFG)\$(PLAT)\psl $(psl_OBJS)
link $(LDFLAGS) $(PSL_LIB) $(PSL_ADDITIONAL_LIBS) /PDB:$(@R)-tool.pdb /out:$@ @<<
$(psl_OBJS)
<<
@ -93,18 +93,18 @@ build-info:
@if not "$(ENABLED_BUILTIN)" == "none" echo PSL File: $(PSL_FILE)
clean:
@if exist $(CFG)\$(PLAT)\psl.dafsa del $(CFG)\$(PLAT)\psl.dafsa
@if exist $(CFG)\$(PLAT)\psl_ascii.dafsa del $(CFG)\$(PLAT)\psl_ascii.dafsa
@if exist vs$(VSVER)\$(CFG)\$(PLAT)\psl.dafsa del vs$(VSVER)\$(CFG)\$(PLAT)\psl.dafsa
@if exist vs$(VSVER)\$(CFG)\$(PLAT)\psl_ascii.dafsa del vs$(VSVER)\$(CFG)\$(PLAT)\psl_ascii.dafsa
@if exist .\libpsl.pc del /f /q .\libpsl.pc
@-del /f /q $(CFG)\$(PLAT)\*.exe
@-del /f /q $(CFG)\$(PLAT)\*.lib
@-del /f /q $(CFG)\$(PLAT)\*.pdb
@-del /f /q $(CFG)\$(PLAT)\*.dll.manifest
@-del /f /q $(CFG)\$(PLAT)\*.dll
@-del /f /q $(CFG)\$(PLAT)\*.ilk
@-if exist $(CFG)\$(PLAT)\tests del /f /q $(CFG)\$(PLAT)\tests\*.obj
@-del /f /q $(CFG)\$(PLAT)\libpsl\*.obj
@-del /f /q $(CFG)\$(PLAT)\libpsl\suffixes_dafsa.h
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.exe
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.lib
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.pdb
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.dll.manifest
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.dll
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.ilk
@-if exist vs$(VSVER)\$(CFG)\$(PLAT)\tests del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\tests\*.obj
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libpsl\*.obj
@-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libpsl\suffixes_dafsa.h
@-del /f /q ..\config.h
@-del /f /q vc$(PDBVER)0.pdb
@-rmdir /s /q $(CFG)\$(PLAT)
@-rmdir /s /q vs$(VSVER)\$(CFG)\$(PLAT)

View File

@ -49,20 +49,20 @@ BASE_CFLAGS = \
/DHAVE_CONFIG_H \
/Dssize_t="$(SSIZE_T_DEF)"
PSL_INCLUDES = /I..\include /I.. /I$(CFG)\$(PLAT)\libpsl /I$(PREFIX)\include
PSL_INCLUDES = /I..\include /I.. /Ivs$(VSVER)\$(CFG)\$(PLAT)\libpsl /I$(PREFIX)\include
# We build the psl.dll or psl.lib at least, with the psl.exe utility
PSL_LIB = $(CFG)\$(PLAT)\psl.lib
PSL_UTILS = $(CFG)\$(PLAT)\psl.exe
PSL_LIB = vs$(VSVER)\$(CFG)\$(PLAT)\psl.lib
PSL_UTILS = vs$(VSVER)\$(CFG)\$(PLAT)\psl.exe
PSL_TESTS = \
$(CFG)\$(PLAT)\test-is-public.exe \
$(CFG)\$(PLAT)\test-is-public-all.exe \
$(CFG)\$(PLAT)\test-is-cookie-domain-acceptable.exe
vs$(VSVER)\$(CFG)\$(PLAT)\test-is-public.exe \
vs$(VSVER)\$(CFG)\$(PLAT)\test-is-public-all.exe \
vs$(VSVER)\$(CFG)\$(PLAT)\test-is-cookie-domain-acceptable.exe
PSL_TEST_DATA = \
$(CFG)\$(PLAT)\psl.dafsa \
$(CFG)\$(PLAT)\psl_ascii.dafsa
vs$(VSVER)\$(CFG)\$(PLAT)\psl.dafsa \
vs$(VSVER)\$(CFG)\$(PLAT)\psl_ascii.dafsa
PSL_MAKE_OPTIONS = CFG^=$(CFG)
@ -77,7 +77,7 @@ PSL_DLL_SUFFIX =
!endif
!endif
PSL_DLL = $(CFG)\$(PLAT)\$(PSL_DLL_PREFIX)psl$(PSL_DLL_SUFFIX).dll
PSL_DLL = vs$(VSVER)\$(CFG)\$(PLAT)\$(PSL_DLL_PREFIX)psl$(PSL_DLL_SUFFIX).dll
# ENABLE_RUNTIME_ICU and ENABLE_BUILTIN_ICU are currently dummy arguments to NMake
ENABLED_RUNTIME =
@ -111,8 +111,8 @@ PSL_LIBTYPE = DLL
PSL_ADDITIONAL_LIBS = $(PSL_ADDITIONAL_LIBS) $(ICUUC_LIB)
PSL_TESTS = \
$(PSL_TESTS) \
$(CFG)\$(PLAT)\test-is-public-builtin.exe \
$(CFG)\$(PLAT)\test-registrable-domain.exe
vs$(VSVER)\$(CFG)\$(PLAT)\test-is-public-builtin.exe \
vs$(VSVER)\$(CFG)\$(PLAT)\test-registrable-domain.exe
!endif
!ifdef USE_GETTEXT
@ -132,8 +132,8 @@ PSL_TEST_CFLAGS = \
$(BASE_CFLAGS) \
/DPSL_TESTFILE=\"$(PSL_TESTFILE_INPUT)\" \
/DPSL_FILE=\"$(PSL_FILE_INPUT)\" \
/DPSL_DAFSA=\"$(MAKEDIR:\=/)/$(CFG)/$(PLAT)/psl.dafsa\" \
/DPSL_ASCII_DAFSA=\"$(MAKEDIR:\=/)/$(CFG)/$(PLAT)/psl_ascii.dafsa\"
/DPSL_DAFSA=\"$(MAKEDIR:\=/)/vs$(VSVER)/$(CFG)/$(PLAT)/psl.dafsa\" \
/DPSL_ASCII_DAFSA=\"$(MAKEDIR:\=/)/vs$(VSVER)/$(CFG)/$(PLAT)/psl_ascii.dafsa\"
# Visual Studio 2013 or earlier does not have snprintf(),
# so use _snprintf() which seems to be enough for our purposes

View File

@ -40,7 +40,7 @@ NULL=
!if [call create-lists.bat header libpsl-msvc.mak libpsl_OBJS]
!endif
!if [for %c in ($(LIBPSL_SRCS)) do @if "%~xc" == ".c" @call create-lists.bat file libpsl-msvc.mak ^$(CFG)\^$(PLAT)\libpsl\%~nc.obj]
!if [for %c in ($(LIBPSL_SRCS)) do @if "%~xc" == ".c" @call create-lists.bat file libpsl-msvc.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\libpsl\%~nc.obj]
!endif
!if [call create-lists.bat footer libpsl-msvc.mak]
@ -49,7 +49,7 @@ NULL=
!if [call create-lists.bat header libpsl-msvc.mak psl_OBJS]
!endif
!if [for %c in (..\tools\*.c) do @call create-lists.bat file libpsl-msvc.mak ^$(CFG)\^$(PLAT)\psl\%~nc.obj]
!if [for %c in (..\tools\*.c) do @call create-lists.bat file libpsl-msvc.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\psl\%~nc.obj]
!endif
!if [call create-lists.bat footer libpsl-msvc.mak]

View File

@ -4,20 +4,20 @@
# one is maintaining the NMake build files.
# Create the build directories
$(CFG)\$(PLAT)\libpsl \
$(CFG)\$(PLAT)\psl \
$(CFG)\$(PLAT)\tests:
vs$(VSVER)\$(CFG)\$(PLAT)\libpsl \
vs$(VSVER)\$(CFG)\$(PLAT)\psl \
vs$(VSVER)\$(CFG)\$(PLAT)\tests:
@-md $@
$(CFG)\$(PLAT)\libpsl\suffixes_dafsa.h: $(CFG)\$(PLAT)\libpsl $(PSL_FILE) ..\src\psl-make-dafsa
vs$(VSVER)\$(CFG)\$(PLAT)\libpsl\suffixes_dafsa.h: vs$(VSVER)\$(CFG)\$(PLAT)\libpsl $(PSL_FILE) ..\src\psl-make-dafsa
@echo Generating $@
$(PYTHON) ..\src\psl-make-dafsa --output-format=cxx+ "$(PSL_FILE_INPUT)" $@
$(CFG)\$(PLAT)\psl.dafsa: $(CFG)\$(PLAT)\tests
vs$(VSVER)\$(CFG)\$(PLAT)\psl.dafsa: vs$(VSVER)\$(CFG)\$(PLAT)\tests
@echo Generating $@
$(PYTHON) ..\src\psl-make-dafsa --output-format=binary "$(PSL_FILE_INPUT)" $@
$(CFG)\$(PLAT)\psl_ascii.dafsa: $(CFG)\$(PLAT)\tests
vs$(VSVER)\$(CFG)\$(PLAT)\psl_ascii.dafsa: vs$(VSVER)\$(CFG)\$(PLAT)\tests
@echo Generating $@
$(PYTHON) ..\src\psl-make-dafsa --output-format=binary --encoding=ascii "$(PSL_FILE_INPUT)" $@

View File

@ -5,10 +5,10 @@ install: all libpsl.pc build-info
@if not exist $(PREFIX)\bin\ mkdir $(PREFIX)\bin
@if not exist $(PREFIX)\lib\pkgconfig\ mkdir $(PREFIX)\lib\pkgconfig
@if not exist $(PREFIX)\include @mkdir $(PREFIX)\include
@copy /b $(CFG)\$(PLAT)\psl.exe $(PREFIX)\bin
@copy /b $(CFG)\$(PLAT)\psl-tool.pdb $(PREFIX)\bin
@copy /b vs$(VSVER)\$(CFG)\$(PLAT)\psl.exe $(PREFIX)\bin
@copy /b vs$(VSVER)\$(CFG)\$(PLAT)\psl-tool.pdb $(PREFIX)\bin
@if "$(PSL_LIBTYPE)" == "DLL" copy /b $(PSL_DLL) $(PREFIX)\bin
@if "$(PSL_LIBTYPE)" == "DLL" copy /b $(CFG)\$(PLAT)\psl.pdb $(PREFIX)\bin
@copy /b $(CFG)\$(PLAT)\psl.lib $(PREFIX)\lib
@if "$(PSL_LIBTYPE)" == "DLL" copy /b vs$(VSVER)\$(CFG)\$(PLAT)\psl.pdb $(PREFIX)\bin
@copy /b vs$(VSVER)\$(CFG)\$(PLAT)\psl.lib $(PREFIX)\lib
@copy libpsl.pc $(PREFIX)\lib\pkgconfig
@for %h in (..\include\*.h) do @copy %h $(PREFIX)\include\%~nxh