$NetBSD: patch-Makefile,v 1.4 2023/05/20 14:42:11 bacon Exp $ # Portability --- Makefile.orig 2021-08-04 00:21:51.000000000 +0000 +++ Makefile @@ -418,12 +418,12 @@ endif ifeq ($(origin CXXFLAGS), undefined) ifeq ($(BUILDOPTIMIZED), 1) else - CXXFLAGS += -g3 + CXXFLAGS += endif ifeq ($(BUILDDEBUG), 1) else - CXXFLAGS += -O4 -funroll-loops -fexpensive-optimizations -finline-functions -fomit-frame-pointer + CXXFLAGS += -fomit-frame-pointer endif ifeq ($(BUILDJEMALLOC), 1) @@ -497,27 +497,8 @@ endef ifeq (${OSTYPE}, Darwin) $(foreach suffix,mp-9 9 mp-8 8 mp-7 7,$(eval $(call TEST_COMPILER,${suffix}))) - ifneq ($(shell echo `$(CXX) --version 2>&1 | grep -c clang`), 0) - CPATH := $(shell echo `which $(CXX)`) - CLANG := $(shell echo `$(CXX) --version 2>&1 | grep clang`) - space := - - $(warning ) - ifeq ($(CXX), $(CPATH)) - $(warning Compiler '$(CXX)' reports version '$(CLANG)'.) - else - $(warning Compiler '$(CXX)' at '$(CPATH)' reports version '$(CLANG)'.) - endif - $(warning ) - $(warning Canu cannot be compiled with this compiler. Please install GCC and/or) - $(warning specify a non-Clang compiler on the command line, e.g.,) # Quite the evil trick to get - $(warning $(space) make CC=/path/to/gcc CXX=/path/to/g++); # this line indented! - $(warning ) - $(error unsupported compiler) - endif - - CXXFLAGS += -fopenmp -pthread -fPIC -m64 -Wno-format - LDFLAGS += -fopenmp -pthread -lm + CXXFLAGS += -std=c++11 -Xpreprocessor -fopenmp -pthread -fPIC -m64 -Wno-format + LDFLAGS += -L${PREFIX}/lib -lomp -pthread -lm endif @@ -559,11 +540,45 @@ else #LDFLAGS += -lprofiler # callgrind - #CXXFLAGS += -g3 -Wa,--gstabs -save-temps + #CXXFLAGS += -Wa,--gstabs -save-temps endif endif +ifeq (${OSTYPE}, NetBSD) + CC ?= gcc + CXX ?= g++ + + # GCC + CXXFLAGS += -pthread -fopenmp -fPIC + LDFLAGS += -pthread -fopenmp -lm -lexecinfo + + #CXXFLAGS += -Wall -Wextra -Wformat -Wno-unused -Wno-parentheses + CXXFLAGS += -Wall -Wextra -Wformat -Wno-unused-function -Wno-unused-parameter -Wno-unused-variable -Wno-char-subscripts -Wno-write-strings -Wno-sign-compare -Wno-format-truncation + + # Google Performance Tools malloc and heapchecker (HEAPCHECK=normal) + #CXXFLAGS += + #LDFLAGS += -ltcmalloc + + # Google Performance Tools cpu profiler (CPUPROFILE=/path) + #CXXFLAGS += + #LDFLAGS += -lprofiler + + # callgrind + #CXXFLAGS += -Wa,--gstabs -save-temps + + ifeq ($(BUILDOPTIMIZED), 1) + else + CXXFLAGS += + endif + + ifeq ($(BUILDDEBUG), 1) + else + CXXFLAGS += -fomit-frame-pointer + endif +endif + + ifneq (,$(findstring CYGWIN, ${OSTYPE})) CC ?= gcc CXX ?= g++