view src/of-nan-1-cross-fixes.patch @ 4099:6c7d570cd9ff

of-nan: update to 3.0.1 * src/of-nan.mk: update version, checksum * src/of-nan-1-cross-fixes.patch: update patch * build_packages.m: update nan version
author John Donoghue
date Mon, 07 Mar 2016 10:23:59 -0500
parents 9f7e9b053041
children be6b10b6faf5
line wrap: on
line source

diff -ur NaN.orig/src/Makefile NaN/src/Makefile
--- NaN.orig/src/Makefile	2016-03-07 08:15:08.086338754 -0500
+++ NaN/src/Makefile	2016-03-07 10:23:34.609405159 -0500
@@ -31,8 +31,9 @@
 # Instead of building "mex shortpath.c" and "mex uigetpath.c", I used empty m-functions within argout=argin; 
 ####################################################
 MKOCTFILE ?= mkoctfile$(OCTAVE_VERSION)
-CC      ?= gcc
-CXX     ?= g++
+OCTAVE_CONFIG ?= octave-config
+CC      ?= $(shell $(MKOCTFILE) -p CC)
+CXX     ?= $(shell $(MKOCTFILE) -p CXX)
 CFLAGS += -fopenmp -Wall -Wextra -Wconversion -O2
 OCTMEX	= $(MKOCTFILE) --mex -lgomp
 RM      = rm
@@ -41,8 +42,11 @@
 # https://wiki.debian.org/HardeningWalkthrough#Handling_dpkg-buildflags_in_your_upstream_build_system
 CFLAGS += $(CPPFLAGS)
 
-ifneq ($(OS),Windows_NT)
+HOSTTYPE := $(shell $(OCTAVE_CONFIG) -p CANONICAL_HOST_TYPE)
+ifeq (,$(findstring mingw,$(HOSTTYPE)))
 CFLAGS      += -fPIC
+else
+OCTMEX	= $(MKOCTFILE) --mex
 endif
 
 ifneq (Darwin,$(shell uname))