Hi ports --
This thread on DaemonForums [0] make me realize a difference between
make and gmake that might be worth changing gmake to work like make.
Consider the following really simple Makefile:
```
CXXFLAGS += -std=c++11
OBJS = true.o
all: ${OBJS}
${CXX} ${LDFLAGS} -o true ${OBJS}
clean:
rm -f true ${OBJS}
```
If you run `make' you get the following output:
c++ -O2 -pipe -std=c++11 -c true.cpp
c++ -o true true.o
However, if you run `gmake' you get:
g++ -std=c++11 -c -o true.o true.cpp
cc1plus: error: unrecognized command line option "-std=c++11"
gmake: *** [<builtin>: true.o] Error 1
You instead have to run `gmake CXX=c++' in order to successfully compile
things.
The missing -O2 and -pipe aside, it seems awkward to me that gmake
defaults to CXX=g++. For one, there is no g++ binary on aarch64 (only
has eg++). For two, and the problem that manifested in the DaemonForums
thread, you end up building binaries that link libstdc++ and libc++abi
together (and the resulting binaries don't work). Having to remember the
extra CXX=c++ invocation for gmake seems less than ideal.
The attached diff changes the gmake default CXX to c++ to match make. It
also modifies the relevant documentation to reflect this.
Not sure how desirable this change is but posting it here in case it is
wanted.
~Brian
[0] http://daemonforums.org/showthread.php?t=11036
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/gmake/Makefile,v
retrieving revision 1.58
diff -u -p -r1.58 Makefile
--- Makefile 20 May 2019 22:15:04 -0000 1.58
+++ Makefile 18 Jun 2019 17:49:08 -0000
@@ -4,7 +4,7 @@ COMMENT= GNU make
DISTNAME= make-4.2.1
PKGNAME= g${DISTNAME}
-REVISION= 1
+REVISION= 2
CATEGORIES= devel
MASTER_SITES= ${MASTER_SITE_GNU:=make/}
EXTRACT_SUFX= .tar.bz2
Index: patches/patch-default_c
===================================================================
RCS file: patches/patch-default_c
diff -N patches/patch-default_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-default_c 18 Jun 2019 17:49:08 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+gmake should default to CXX=c++ instead of CXX=g++
+
+Index: default.c
+--- default.c.orig
++++ default.c
+@@ -530,7 +530,7 @@ static const char *default_variables[] =
+ "OBJC", "gcc",
+ #else
+ "CC", "cc",
+- "CXX", "g++",
++ "CXX", "c++",
+ "OBJC", "cc",
+ #endif
+
Index: patches/patch-doc_make_info-2
===================================================================
RCS file: patches/patch-doc_make_info-2
diff -N patches/patch-doc_make_info-2
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-doc_make_info-2 18 Jun 2019 17:49:08 -0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Default C++ compiler is c++
+
+Index: doc/make.info-2
+--- doc/make.info-2.orig
++++ doc/make.info-2
+@@ -406,7 +406,7 @@ programs in built-in rules:
+ Program for compiling C programs; default 'cc'.
+
+ 'CXX'
+- Program for compiling C++ programs; default 'g++'.
++ Program for compiling C++ programs; default 'c++'.
+
+ 'CPP'
+ Program for running the C preprocessor, with results to standard
Index: patches/patch-doc_make_texi
===================================================================
RCS file: /cvs/ports/devel/gmake/patches/patch-doc_make_texi,v
retrieving revision 1.5
diff -u -p -r1.5 patch-doc_make_texi
--- patches/patch-doc_make_texi 25 Jun 2016 19:47:11 -0000 1.5
+++ patches/patch-doc_make_texi 18 Jun 2019 17:49:08 -0000
@@ -1,6 +1,7 @@
$OpenBSD: patch-doc_make_texi,v 1.5 2016/06/25 19:47:11 naddy Exp $
---- doc/make.texi.orig Sat May 21 23:34:49 2016
-+++ doc/make.texi Fri Jun 24 18:19:09 2016
+Index: doc/make.texi
+--- doc/make.texi.orig
++++ doc/make.texi
@@ -52,7 +52,7 @@ developing GNU and promoting software freedom.''
@dircategory Software development
@@ -10,3 +11,12 @@ $OpenBSD: patch-doc_make_texi,v 1.5 2016
@end direntry
@iftex
+@@ -9432,7 +9432,7 @@ Program for compiling C programs; default @samp{cc}.
+
+ @item CXX
+ @vindex CXX
+-Program for compiling C++ programs; default @samp{g++}.
++Program for compiling C++ programs; default @samp{c++}.
+ @pindex g++
+
+ @item CPP