Refactor win64.mak to allow passing options in local file.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 2 Jun 2014 17:16:49 +0000 (20:16 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 2 Jun 2014 17:16:49 +0000 (20:16 +0300)
Move all the default values for external library paths to
windows-defaults.mak. Add an include for file called windows-local.mak,
this allows you to put local config options in that file, which is much
easier than passing them on the command line every time.

.gitignore
win64.mak
windows-defaults.mak [new file with mode: 0644]

index 584517dfd2c036b5e4507ee4156a8e209e13c7cc..f863c63e7cfd36f88554b991519f02c0a57b6d82 100644 (file)
@@ -26,8 +26,9 @@ win32ver.rc
 lib*dll.def
 lib*.pc
 
-#
+# Build configuration files
 winbuild/configuration.xml
+windows-local.mak
 
 # Files generated during compilation
 /Makefile
index 47dbea4b710cc82c55922005a8ebda2b6236b4c5..9de9e6c68a2f94afbd8197b41bb81a2015d465de 100755 (executable)
--- a/win64.mak
+++ b/win64.mak
 # Comments:        Created by Hiroshi Inoue, 2006-10-31
 #
 
+# Include default configuration options, followed by any local overrides
+!INCLUDE windows-defaults.mak
+!IF EXISTS(windows-local.mak)
+!INCLUDE windows-local.mak
+!ENDIF
+
 !IF "$(ANSI_VERSION)" == "yes"
 !MESSAGE Building the PostgreSQL ANSI 3.0 Driver for $(TARGET_CPU)...
 !ELSE
@@ -55,36 +61,16 @@ CUSTOMCLOPT=/nologo /MD /W3 /wd4018 /EHsc
 #
 CUSTOMLINKLIBS=
 
-!IF "$(TARGET_CPU)" == "x64"
-ADD_DEFINES=/D _WIN64
-!ENDIF
-#
-#  Include libraries as well as import libraries
-#  may be different from those of 32bit ones.
-#  Please set PG_INC, PG_LIB, SSL_INC or PG_LIB
-#  variables to appropriate ones.
-#
-!IFNDEF PG_INC
-PG_INC=$(PROGRAMFILES)\PostgreSQL\9.3\include
-!MESSAGE Using default PostgreSQL Include directory: $(PG_INC)
-!ENDIF
-
-!IFNDEF PG_LIB
-PG_LIB=C:\develop\lib\$(TARGET_CPU)
-!MESSAGE Using default PostgreSQL Library directory: $(PG_LIB)
-!ENDIF
+# Print the paths that will be used in the build
+!MESSAGE Using PostgreSQL Include directory: $(PG_INC)
+!MESSAGE Using PostgreSQL Library directory: $(PG_LIB)
 
 !IF "$(USE_LIBPQ)" != "no"
-!IFNDEF SSL_INC
-SSL_INC=C:\OpenSSL\include
-!MESSAGE Using default OpenSSL Include directory: $(SSL_INC)
-!ENDIF
-
-!IFNDEF SSL_LIB
-SSL_LIB=C:\develop\lib\$(CPU)
-!MESSAGE Using default OpenSSL Library directory: $(SSL_LIB)
+!MESSAGE Using OpenSSL Include directory: $(SSL_INC)
+!MESSAGE Using OpenSSL Library directory: $(SSL_LIB)
 !ENDIF
 
+!IF "$(USE_LIBPQ)" != "no"
 SSL_DLL = "SSLEAY32.dll"
 RESET_CRYPTO = yes
 ADD_DEFINES = $(ADD_DEFINES) /D USE_LIBPQ /D "SSL_DLL=\"$(SSL_DLL)\"" /D USE_SSL
@@ -104,6 +90,10 @@ DTCLIB = pgenlist
 !ENDIF
 DTCDLL = $(DTCLIB).dll
 
+!IF "$(TARGET_CPU)" == "x64"
+ADD_DEFINES=$(ADD_DEFINES) /D _WIN64
+!ENDIF
+
 !IF "$(USE_LIBPQ)" != "no"
 VC07_DELAY_LOAD=/DelayLoad:libpq.dll /DelayLoad:$(SSL_DLL)
 !IF "$(RESET_CRYPTO)" == "yes"
@@ -165,28 +155,25 @@ MAINDLL = $(MAINLIB).dll
 XALIB = pgxalib
 XADLL = $(XALIB).dll
 
-!IF  "$(CFG)" == "Release"
-!IF  "$(ANSI_VERSION)" == "yes"
-OUTDIR=.\$(TARGET_CPU)ANSI
-OUTDIRBIN=.\$(TARGET_CPU)ANSI
-INTDIR=.\$(TARGET_CPU)ANSI
-!ELSE
+# Construct output directory name. The base name is the target architecture,
+# i.e. ".\x86" or ".\x64". For the ANSI version, "ANSI" is appended to the
+# base name. Finally, for Debug-enabled version, "Debug" is appended.
+#
+# For example,the output directory debug-enabled 32-bit ANSI-version is:
+#
+# .\X86ANSIDebug
+#
 OUTDIR=.\$(TARGET_CPU)
-OUTDIRBIN=.\$(TARGET_CPU)
-INTDIR=.\$(TARGET_CPU)
-!ENDIF
-!ELSEIF  "$(CFG)" == "Debug"
 !IF  "$(ANSI_VERSION)" == "yes"
-OUTDIR=.\$(TARGET_CPU)ANSIDebug
-OUTDIRBIN=.\$(TARGET_CPU)ANSIDebug
-INTDIR=.\$(TARGET_CPU)ANSIDebug
-!ELSE
-OUTDIR=.\$(TARGET_CPU)Debug
-OUTDIRBIN=.\$(TARGET_CPU)Debug
-INTDIR=.\$(TARGET_CPU)Debug
+OUTDIR=$(OUTDIR)ANSI
 !ENDIF
+!IF  "$(CFG)" == "Debug"
+OUTDIR=$(OUTDIR)Debug
 !ENDIF
 
+# Location for intermediary build targets (e.g. *.obj files).
+INTDIR=$(OUTDIR)
+
 ALLDLL  = "$(INTDIR)"
 !IF "$(OUTDIR)" != "$(INTDIR)"
 ALLDLL  = $(ALLDLL) "$(INTDIR)"
diff --git a/windows-defaults.mak b/windows-defaults.mak
new file mode 100644 (file)
index 0000000..2a24a96
--- /dev/null
@@ -0,0 +1,29 @@
+#
+# This file includes default configuration options used to build the driver
+# on Windows using "nmake /f win64.mak". You can override these by creating a
+# file in the same directory called "windows-local.mak". It will be processed
+#after these defaults. (You can copy this file as a template, and modify)
+#
+!IF "$(TARGET_CPU)" == "x86"
+PG_INC=C:\Program Files (x86)\PostgreSQL\9.3\include
+PG_LIB=C:\Program Files (x86)\PostgreSQL\9.3\lib
+!ELSE
+PG_INC=$(PROGRAMFILES)\PostgreSQL\9.3\include
+PG_LIB=$(PROGRAMFILES)\PostgreSQL\9.3\lib
+!ENDIF
+
+# these will only used if building with USE_LIBPQ (which is the default)
+!IF "$(TARGET_CPU)" == "x86"
+SSL_INC=C:\OpenSSL-Win32\include
+SSL_LIB=C:\OpenSSL-Win32\lib
+!ELSE
+SSL_INC=C:\OpenSSL-Win64\include
+SSL_LIB=C:\OpenSSL-Win64\lib
+!ENDIF
+
+# Enable/disable features
+
+USE_LIBPQ = yes
+USE_SSPI = no
+USE_GSS = no
+MSDTC = yes