From 6a249c6246c22f2bc2cbec90f253c7fa2a9bbff5 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Wed, 25 Nov 2020 12:15:50 -0800 Subject: [PATCH] makefile: Provide specific advice on macOS about dependent packages --- makefile | 102 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 75 insertions(+), 27 deletions(-) diff --git a/makefile b/makefile index acbc2d01..9fb7debc 100644 --- a/makefile +++ b/makefile @@ -56,16 +56,18 @@ # simh project support is provided for simulators that are built with # dependent packages provided with the or by the operating system # distribution OR for platforms where that isn't directly available -# (OS X) by packages from specific package management systems (MacPorts -# or Homebrew). Users wanting to build simulators with locally build +# (OS X/macOS) by packages from specific package management systems (MacPorts +# or Homebrew). Users wanting to build simulators with locally built # dependent packages or packages provided by an unsupported package -# management system can override where this procedure looks for include -# files and/or libraries. Overrides can be specified by define exported -# environment variables or GNU make command line arguments which specify -# INCLUDES and/or LIBRARIES. +# management system may be able to override where this procedure looks +# for include files and/or libraries. Overrides can be specified by define +# exported environment variables or GNU make command line arguments which +# specify INCLUDES and/or LIBRARIES. # Each of these, if specified, must be the complete list include directories # or library directories that should be used with each element separated by # colons. (i.e. INCLUDES=/usr/include/:/usr/local/include/:...) +# If this doesn't work for you and/or you're interested in using a different +# ToolChain, you're free to solve this problem on your own. Good Luck. # # Some environments may have the LLVM (clang) compiler installed as # an alternate to gcc. If you want to build with the clang compiler, @@ -170,6 +172,7 @@ ifneq ($(findstring Windows,${OS}),) endif endif endif + find_exe = $(abspath $(strip $(firstword $(foreach dir,$(strip $(subst :, ,${PATH})),$(wildcard $(dir)/$(1)))))) find_lib = $(abspath $(strip $(firstword $(foreach dir,$(strip ${LIBPATH}),$(wildcard $(dir)/lib$(1).${LIBEXT}))))) find_include = $(abspath $(strip $(firstword $(foreach dir,$(strip ${INCPATH}),$(wildcard $(dir)/$(1).h))))) @@ -201,6 +204,28 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin) OSTYPE = cygwin OSNAME = windows-build endif + ifeq (Darwin,$(OSTYPE)) + ifeq (,$(shell which port)$(shell which brew)) + $(info *** Info *** simh dependent packages on macOS must be provided by either the) + $(info *** Info *** MacPorts package system or by the HomeBrew package system.) + $(info *** Info *** Neither of these seem to be installed on the local system.) + $(info *** Info ***) + ifeq (,$(INCLUDES)$(LIBRARIES)) + $(info *** Info *** Users wanting to build simulators with locally built dependent) + $(info *** Info *** packages or packages provided by an unsupported package) + $(info *** Info *** management system may be able to override where this procedure) + $(info *** Info *** looks for include files and/or libraries. Overrides can be) + $(info *** Info *** specified by defining exported environment variables or GNU make) + $(info *** Info *** command line arguments which specify INCLUDES and/or LIBRARIES.) + $(info *** Info *** If this works, that's great, if it doesn't you are on your own!) + else + $(info *** Warning *** Attempting to build on macOS with:) + $(info *** Warning *** INCLUDES defined as $(INCLUDES)) + $(info *** Warning *** and) + $(info *** Warning *** LIBRARIES defined as $(LIBRARIES)) + endif + endif + endif ifeq (,$(shell ${GCC} -v /dev/null 2>&1 | grep 'clang')) GCC_VERSION = $(shell ${GCC} -v /dev/null 2>&1 | grep 'gcc version' | awk '{ print $$3 }') COMPILER_NAME = GCC Version: $(GCC_VERSION) @@ -630,19 +655,29 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin) endif ifeq (,$(findstring HAVE_LIBSDL,$(VIDEO_CCDEFS))) $(info *** Info ***) - $(info *** Info *** The simulator$(BUILD_MULTIPLE) you are building could provide more) - $(info *** Info *** functionality if video support were available on your system.) + $(info *** Info *** The simulator$(BUILD_MULTIPLE) you are building could provide more functionality) + $(info *** Info *** if video support was available on your system.) + $(info *** Info *** To gain this functionality:) ifeq (Darwin,$(OSTYPE)) - $(info *** Info *** Install the MacPorts libSDL2 package to provide this) - $(info *** Info *** functionality for your OS X system:) - $(info *** Info *** # port install libsdl2 libpng zlib) + ifeq (/opt/local/bin/port,$(shell which port)) + $(info *** Info *** Install the MacPorts libSDL2 package to provide this) + $(info *** Info *** functionality for your OS X system:) + $(info *** Info *** # port install libsdl2 libpng zlib) + endif ifeq (/usr/local/bin/brew,$(shell which brew)) - $(info *** Info ***) - $(info *** Info *** OR) - $(info *** Info ***) + ifeq (/opt/local/bin/port,$(shell which port)) + $(info *** Info ***) + $(info *** Info *** OR) + $(info *** Info ***) + endif $(info *** Info *** Install the HomeBrew libSDL2 package to provide this) $(info *** Info *** functionality for your OS X system:) $(info *** Info *** $$ brew install sdl2 libpng zlib) + else + ifeq (,$(shell which port)) + $(info *** Info *** Install MacPorts or HomeBrew and rerun this make for) + $(info *** Info *** specific advice) + endif endif else ifneq (,$(and $(findstring Linux,$(OSTYPE)),$(call find_exe,apt-get))) @@ -828,16 +863,25 @@ ifeq (${WIN32},) #*nix Environments (&& cygwin) $(info *** Info ***) $(info *** Info *** To build simulator(s) with extended networking support you) ifeq (Darwin,$(OSTYPE)) - $(info *** Info *** should install the MacPorts vde2 package to provide this) - $(info *** Info *** functionality for your OS X system:) - $(info *** Info *** # port install vde2) + ifeq (/opt/local/bin/port,$(shell which port)) + $(info *** Info *** should install the MacPorts vde2 package to provide this) + $(info *** Info *** functionality for your OS X system:) + $(info *** Info *** # port install vde2) + endif ifeq (/usr/local/bin/brew,$(shell which brew)) - $(info *** Info ***) - $(info *** Info *** OR) - $(info *** Info ***) - $(info *** Info *** Install the HomeBrew vde package to provide this) + ifeq (/opt/local/bin/port,$(shell which port)) + $(info *** Info ***) + $(info *** Info *** OR) + $(info *** Info ***) + endif + $(info *** Info *** should install the HomeBrew vde package to provide this) $(info *** Info *** functionality for your OS X system:) $(info *** Info *** $$ brew install vde) + else + ifeq (,$(shell which port)) + $(info *** Info *** should install MacPorts or HomeBrew and rerun this make for) + $(info *** Info *** specific advice) + endif endif else ifneq (,$(and $(findstring Linux,$(OSTYPE)),$(call find_exe,apt-get))) @@ -1931,13 +1975,17 @@ ifneq (,$(BESM6_BUILD)) $(info *** No SDL ttf support available. BESM-6 video panel disabled.) $(info ***) ifeq (Darwin,$(OSTYPE)) - $(info *** Info *** Install the MacPorts libSDL2-ttf development package to provide this) - $(info *** Info *** functionality for your OS X system:) - $(info *** Info *** # port install libsdl2-ttf-dev) + ifeq (/opt/local/bin/port,$(shell which port)) + $(info *** Info *** Install the MacPorts libSDL2-ttf development package to provide this) + $(info *** Info *** functionality for your OS X system:) + $(info *** Info *** # port install libsdl2-ttf-dev) + endif ifeq (/usr/local/bin/brew,$(shell which brew)) - $(info *** Info ***) - $(info *** Info *** OR) - $(info *** Info ***) + ifeq (/opt/local/bin/port,$(shell which port)) + $(info *** Info ***) + $(info *** Info *** OR) + $(info *** Info ***) + endif $(info *** Info *** Install the HomeBrew sdl2_ttf package to provide this) $(info *** Info *** functionality for your OS X system:) $(info *** Info *** $$ brew install sdl2_ttf)