From 1361dd399993846b75f451b0dfe121a89d0b2ed0 Mon Sep 17 00:00:00 2001 From: katjav Date: Wed, 24 Jan 2018 13:56:36 +0100 Subject: [PATCH 1/7] Remove unuseful variable 'PD_PATH' The variable was introduced in commit 41e9743 for compatibility with centralized build system as inherited from Pd-extended by Pd-L2ork and Purr Data. But it doesn't work in that context because $(PD_PATH)/bin is absent. Therefore better remove 'PD_PATH' and focus on making variables 'PDDIR' & Co. work as expected. --- Makefile.pdlibbuilder | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index 1db3f8c..e7b04a8 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -213,10 +213,6 @@ version = 0.5.0 # INSTALL # Definition of install program. # -# PD_PATH: -# Equivalent to PDDIR. Supported for compatibility with pd-extended central -# makefile, but deprecated otherwise. -# # objectsdir: # Root directory for installation of Pd library directories, like PDLIBDIR but # not overridable by environment. Supported for compatibility with pd-extended @@ -634,10 +630,9 @@ endif # Platform-dependent default paths are specified above, but overridable. # Path variables in upper case can be defined as make command argument or in the -# environment. 'PD_PATH' and 'objectsdir' are supported for compatibility with +# environment. Variable 'objectsdir' is supported for compatibility with # the build system that pd-l2ork has inherited from pd-extended. -PDDIR ?= $(PD_PATH) PDINCLUDEDIR ?= $(pdincludepath) PDBINDIR ?= $(pdbinpath) PDLIBDIR ?= $(firstword $(objectsdir) $(pkglibdir)) From 77401282570da724d399b14f80329f8f0a6c2250 Mon Sep 17 00:00:00 2001 From: katjav Date: Wed, 24 Jan 2018 22:50:20 +0100 Subject: [PATCH 2/7] Fix priority for user path variables 'PDDIR' & Co. The order of variable expansion prevented this for the path to binary 'pd.dll'. --- Makefile.pdlibbuilder | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index e7b04a8..cb9add5 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -591,12 +591,9 @@ endif # paths for 32-bit executables on 64-bit Windows aren't yet defined here (TODO) ifeq ($(system), Windows) pkglibdir := $(APPDATA)/Pd - ifndef pdbinpath - pdbinpath := $(shell ls -d "$(PROGRAMFILES)/pd/bin") - endif - ifndef pdincludepath - pdincludepath := $(shell ls -d "$(PROGRAMFILES)/pd/src") - endif + pdbinpath := $(shell ls -d "$(PROGRAMFILES)/pd/bin") + pdincludepath := $(shell ls -d "$(PROGRAMFILES)/pd/src") + PDBINDIR ?= $(pdbinpath) endif # TODO: decide whether -mms-bitfields should be specified. @@ -613,14 +610,14 @@ ifeq ($(system), Windows) extension = dll c.flags := c.ldflags = -static-libgcc -shared \ - -Wl,--enable-auto-import "$(pdbinpath)/pd.dll" + -Wl,--enable-auto-import "$(PDBINDIR)/pd.dll" c.ldlibs := cxx.flags := -fcheck-new cxx.ldflags = -static-libstdc++ -shared \ - -Wl,--enable-auto-import "$(pdbinpath)/pd.dll" + -Wl,--enable-auto-import "$(PDBINDIR)/pd.dll" cxx.ldlibs := shared.extension = dll - shared.ldflags = -static-libgcc -shared "$(pdbinpath)/pd.dll" + shared.ldflags = -static-libgcc -shared "$(PDBINDIR)/pd.dll" stripflags = --strip-unneeded -R .note -R .comment endif @@ -634,7 +631,6 @@ endif # the build system that pd-l2ork has inherited from pd-extended. PDINCLUDEDIR ?= $(pdincludepath) -PDBINDIR ?= $(pdbinpath) PDLIBDIR ?= $(firstword $(objectsdir) $(pkglibdir)) ifneq ($(PDDIR),) From 1bcf78f86eac9348e8422365b2c39f8c55f69801 Mon Sep 17 00:00:00 2001 From: katjav Date: Sat, 27 Jan 2018 00:07:21 +0100 Subject: [PATCH 3/7] Define default paths for 32 bit build on 64 bit Windows --- Makefile.pdlibbuilder | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index cb9add5..fe72833 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -588,11 +588,16 @@ endif # variables are assembled or re-expanded later, great care must be taken to put # quotes at appropriate points throughout the makefile. Thanks, Bill. -# paths for 32-bit executables on 64-bit Windows aren't yet defined here (TODO) +# default paths in Mingw environments ifeq ($(system), Windows) pkglibdir := $(APPDATA)/Pd - pdbinpath := $(shell ls -d "$(PROGRAMFILES)/pd/bin") - pdincludepath := $(shell ls -d "$(PROGRAMFILES)/pd/src") + ifeq ($(MINGW_CHOST), i686-w64-mingw32) + programfiles := ${ProgramFiles(x86)} + else + programfiles := $(PROGRAMFILES) + endif + pdbinpath := $(shell ls -d "$(programfiles)/Pd/bin") + pdincludepath := $(shell ls -d "$(programfiles)/Pd/src") PDBINDIR ?= $(pdbinpath) endif From f3887bbe7d7514e2bdf4b9ee80b4044aadcc7d79 Mon Sep 17 00:00:00 2001 From: katjav Date: Sat, 27 Jan 2018 12:40:46 +0100 Subject: [PATCH 4/7] Update Windows search path documentation in makefile --- Makefile.pdlibbuilder | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index fe72833..273d07a 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -238,7 +238,13 @@ version = 0.5.0 # # OSX: /Applications/Pd*.app/Contents/Resources/src # -# Windows: %PROGRAMFILES%/pd/src +# Windows: %PROGRAMFILES%/Pd/src +# %PROGRAMFILES(X86)%/Pd/src (32 bit builds on 64 bit Windows) +# +# Default search path for binary pd.dll (Windows), overridable by PDBINDIR +# +# %PROGRAMFILES%/Pd/bin +# %PROGRAMFILES(X86)%/Pd/bin (32 bit builds on 64 bit Windows) # # Default location to install pd libraries is platform dependent, and # overridable by PDLIBDIR: From 9240b64eba92aaee1e253b38bff728c69a25949f Mon Sep 17 00:00:00 2001 From: katjav Date: Sat, 27 Jan 2018 14:10:12 +0100 Subject: [PATCH 5/7] Evaluate 'PDBINDIR' before ld flags So ld flags can be evaluated as immediate variables. Otherwise it was too confusing, hard to understand why it worked at all. --- Makefile.pdlibbuilder | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index 273d07a..1a306db 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -604,6 +604,16 @@ ifeq ($(system), Windows) endif pdbinpath := $(shell ls -d "$(programfiles)/Pd/bin") pdincludepath := $(shell ls -d "$(programfiles)/Pd/src") +endif + +# Store default path to pd.dll in PDBINDIR if the latter is not user-defined. +# For include path this is done in the platform-independent paths section below, +# but for PDBINDIR it is done here so ld flags can be evaluated as immediate +# variables. +ifeq ($(system), Windows) + ifdef PDDIR + PDBINDIR := $(PDDIR)/bin + endif PDBINDIR ?= $(pdbinpath) endif @@ -620,15 +630,15 @@ ifeq ($(system), Windows) endif extension = dll c.flags := - c.ldflags = -static-libgcc -shared \ + c.ldflags := -static-libgcc -shared \ -Wl,--enable-auto-import "$(PDBINDIR)/pd.dll" c.ldlibs := cxx.flags := -fcheck-new - cxx.ldflags = -static-libstdc++ -shared \ + cxx.ldflags := -static-libstdc++ -shared \ -Wl,--enable-auto-import "$(PDBINDIR)/pd.dll" cxx.ldlibs := shared.extension = dll - shared.ldflags = -static-libgcc -shared "$(PDBINDIR)/pd.dll" + shared.ldflags := -static-libgcc -shared "$(PDBINDIR)/pd.dll" stripflags = --strip-unneeded -R .note -R .comment endif @@ -644,9 +654,8 @@ endif PDINCLUDEDIR ?= $(pdincludepath) PDLIBDIR ?= $(firstword $(objectsdir) $(pkglibdir)) -ifneq ($(PDDIR),) +ifdef PDDIR PDINCLUDEDIR := $(wildcard $(PDDIR)/src) - PDBINDIR := $(wildcard $(PDDIR)/bin) endif # base path where all components of the lib will be installed by default From fe45bcb376ec301dda21adf8f9bf348a485dae70 Mon Sep 17 00:00:00 2001 From: katjav Date: Sun, 28 Jan 2018 20:58:12 +0100 Subject: [PATCH 6/7] Avoid ls errors when default paths for Pd on Windows do not exist Such error messages are confusing if you do not intend to use default paths. Therefore the probes with ls are removed. Paths to m_pd.h and pd.dll are probed later in the process when they are possibly overriden by user definitions. --- Makefile.pdlibbuilder | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index 1a306db..d1af670 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -602,8 +602,8 @@ ifeq ($(system), Windows) else programfiles := $(PROGRAMFILES) endif - pdbinpath := $(shell ls -d "$(programfiles)/Pd/bin") - pdincludepath := $(shell ls -d "$(programfiles)/Pd/src") + pdbinpath := $(programfiles)/Pd/bin + pdincludepath := $(programfiles)/Pd/src endif # Store default path to pd.dll in PDBINDIR if the latter is not user-defined. @@ -747,6 +747,11 @@ ifdef PDINCLUDEDIR mpdh := $(shell ls "$(PDINCLUDEDIR)/m_pd.h") endif +# store path to pd.dll; if not found, ls will give a useful error +ifeq ($(system), Windows) + pddll := $(shell ls "$(PDBINDIR)/pd.dll") +endif + # print Makefile.pdlibbuilder version $(info ++++ info: using Makefile.pdlibbuilder version $(version)) From 3e974fdf2149a971c78c7be1a4efcbe2d7c51f80 Mon Sep 17 00:00:00 2001 From: katjav Date: Wed, 31 Jan 2018 12:41:26 +0100 Subject: [PATCH 7/7] Update makefile comments related to paths --- Makefile.pdlibbuilder | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Makefile.pdlibbuilder b/Makefile.pdlibbuilder index d1af670..fbcb713 100644 --- a/Makefile.pdlibbuilder +++ b/Makefile.pdlibbuilder @@ -100,7 +100,6 @@ version = 0.5.0 # # Deprecated path variables: # -# - PD_PATH # - pdincludepath # - pdbinpath # - objectsdir @@ -323,7 +322,6 @@ version = 0.5.0 # - decide whether to use -static-libgcc or shared dll in MinGW # - cygwin support # - android support -# - Windows 64 bit support # - figure out how to handle '$' in filenames # - add makefile template targets dpkg-source dist libdir distclean tags? # @@ -589,12 +587,13 @@ endif # Standard paths on Windows contain spaces, and GNU make functions treat such # paths as lists, with unintended effects. Therefore we must use shell function -# ls instead of make's wildcard, and probe for each standard path individually. -# Using double quotes around paths with spaces is obligatory. Since some path -# variables are assembled or re-expanded later, great care must be taken to put -# quotes at appropriate points throughout the makefile. Thanks, Bill. +# ls instead of make's wildcard when probing for a path, and use double quotes +# when specifying a path in a command argument. -# default paths in Mingw environments +# Default paths in Mingw / Mingw-w64 environments. 'PROGRAMFILES' is standard +# location for builds with native architecture, 'ProgramFiles(x86)' for i686 +# builds on x86_64 Windows (detection method by Lucas Cordiviola). Curly braces +# required because of parentheses in variable name. ifeq ($(system), Windows) pkglibdir := $(APPDATA)/Pd ifeq ($(MINGW_CHOST), i686-w64-mingw32)