Modify the build system to add support for macOS and honor environment
variables set by the user, including CXX, CXXFLAGS, CPPFLAGS and LDFLAGS.
--- apps/Make1.orig 2018-08-31 00:09:40.000000000 -0500
+++ apps/Make1 2019-10-03 18:25:14.000000000 -0500
#------------------------------------------------------------------------
LIBPATH = `pwd | sed 's/apps/lib/g'`
MODELGEN = `pwd | sed 's/apps/modelgen/g'`/gnucap-modelgen
+ifeq ($(shell uname -s),Darwin)
+ LD_LIBRARY_PATH_VARIABLE=DYLD_LIBRARY_PATH
+ LD_LIBRARY_PATH_VARIABLE=LD_LIBRARY_PATH
#------------------------------------------------------------------------
- (export LD_LIBRARY_PATH=$(LIBPATH); $(MODELGEN) -h $<)
+ (export $(LD_LIBRARY_PATH_VARIABLE)=$(LIBPATH); $(MODELGEN) -h $<)
#------------------------------------------------------------------------
- (export LD_LIBRARY_PATH=$(LIBPATH); $(MODELGEN) -cc $<)
+ (export $(LD_LIBRARY_PATH_VARIABLE)=$(LIBPATH); $(MODELGEN) -cc $<)
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
--- apps/configure.orig 2018-08-31 00:09:40.000000000 -0500
+++ apps/configure 2019-10-03 18:35:27.000000000 -0500
#----------------------------------------------------------------
echo "CCFLAGS = -fPIC \\" >Make.ccflags
-echo "-DUNIX -O2 -DNDEBUG -I. -I../include -I../../include -W" >>Make.ccflags
+echo "-DUNIX -DNDEBUG -I. -I../include -I../../include -W ${CXXFLAGS--O2} ${CPPFLAGS-}" >>Make.ccflags
echo "LIBS = \\" >Make.libs
#------------------------------------------------------------------------
+ifeq (\$(shell uname -s),Darwin)
+ LDFLAGS = -bundle -undefined dynamic_lookup ${LDFLAGS-}
+ LDFLAGS = -shared ${LDFLAGS-}
--- include/configure.orig 2018-08-31 00:09:40.000000000 -0500
+++ include/configure 2019-10-03 18:39:16.000000000 -0500
#----------------------------------------------------------------
echo \# created by $PWD/$0. do not edit >Make2
echo \#------------------------------------------------------------------------ >>Make2
-echo "CCC = c++" >>Make2
+echo "CCC = ${CXX-c++}" >>Make2
echo "PREFIX = " $prefix >>Make2
--- lib/configure.orig 2018-08-31 00:09:40.000000000 -0500