Files
macports-ports/math/msieve/files/patch-Makefile.diff

141 lines
3.7 KiB
Diff

--- Makefile.orig 2016-11-12 00:40:27.000000000 +0900
+++ Makefile 2016-11-14 22:04:27.000000000 +0900
@@ -12,13 +12,15 @@
# $Id: Makefile 989 2016-01-04 15:03:27Z jasonp_sf $
# --------------------------------------------------------------------
+VER = @VER@
+
# override from command line
WIN = 0
WIN64 = 0
# gcc with basic optimization (-march flag could
# get overridden by architecture-specific builds)
-CC = gcc
+CC = @CC@
WARN_FLAGS = -Wall -W
OPT_FLAGS = -O3 -fomit-frame-pointer -march=native \
-D_FILE_OFFSET_BITS=64 -DNDEBUG -D_LARGEFILE64_SOURCE
@@ -29,14 +31,14 @@
SVN_VERSION := unknown
endif
-CFLAGS = $(OPT_FLAGS) $(MACHINE_FLAGS) $(WARN_FLAGS) \
+L_CFLAGS = $(CFLAGS) $(OPT_FLAGS) $(MACHINE_FLAGS) $(WARN_FLAGS) \
-DMSIEVE_SVN_VERSION="\"$(SVN_VERSION)\"" \
-I. -Iaprcl -Iinclude -Ignfs -Ignfs/poly -Ignfs/poly/stage1
# tweak the compile flags
ifeq ($(ECM),1)
- CFLAGS += -DHAVE_GMP_ECM
+ L_CFLAGS += -DHAVE_GMP_ECM
LIBS += -lecm
endif
ifeq ($(WIN),1)
@@ -61,22 +63,22 @@
CUDA_ROOT = $(shell dirname $(NVCC))/../
CUDA_LIBS = -lcuda
endif
- CFLAGS += -I"$(CUDA_ROOT)/include" -Icub -DHAVE_CUDA
+ L_CFLAGS += -I"$(CUDA_ROOT)/include" -Icub -DHAVE_CUDA
LIBS += $(CUDA_LIBS)
endif
ifeq ($(MPI),1)
CC = mpicc
- CFLAGS += -DHAVE_MPI
+ L_CFLAGS += -DHAVE_MPI
endif
ifeq ($(BOINC),1)
# fill in as appropriate
BOINC_INC_DIR = .
BOINC_LIB_DIR = .
- CFLAGS += -I$(BOINC_INC_DIR) -DHAVE_BOINC
+ L_CFLAGS += -I$(BOINC_INC_DIR) -DHAVE_BOINC
LIBS += -L$(BOINC_LIB_DIR) -lboinc_api -lboinc
endif
ifeq ($(NO_ZLIB),1)
- CFLAGS += -DNO_ZLIB
+ L_CFLAGS += -DNO_ZLIB
else
LIBS += -lz
endif
@@ -234,29 +236,23 @@
gnfs/gnfs.c \
gnfs/relation.c
-NFS_OBJS = $(NFS_SRCS:.c=.no)
-
NFS_GPU_SRCS = \
gnfs/poly/stage1/stage1_sieve_gpu.c
-NFS_GPU_OBJS = $(NFS_GPU_SRCS:.c=.no)
-
NFS_NOGPU_SRCS = \
gnfs/poly/stage1/stage1_sieve_cpu.c
-NFS_NOGPU_OBJS = $(NFS_NOGPU_SRCS:.c=.no)
-
ifeq ($(CUDA),1)
NFS_HDR += $(NFS_GPU_HDR)
NFS_SRCS += $(NFS_GPU_SRCS)
- NFS_OBJS += $(NFS_GPU_OBJS)
else
NFS_HDR += $(NFS_NOGPU_HDR)
NFS_SRCS += $(NFS_NOGPU_SRCS)
- NFS_OBJS += $(NFS_NOGPU_OBJS)
GPU_OBJS =
endif
+NFS_OBJS = $(NFS_SRCS:.c=.no)
+
#---------------------------------- make targets -------------------------
help:
@@ -274,8 +270,10 @@
rm -f libmsieve.a
ar r libmsieve.a $(COMMON_OBJS) $(QS_OBJS) $(NFS_OBJS)
ranlib libmsieve.a
- $(CC) $(CFLAGS) demo.c -o msieve $(LDFLAGS) \
+ $(CC) $(L_CFLAGS) demo.c -o msieve $(LDFLAGS) \
libmsieve.a $(LIBS)
+ rm -f libmsieve.$(VER).dylib
+ $(CC) -dynamiclib -Wl,-undefined -Wl,dynamic_lookup -install_name @PREFIX@/lib/libmsieve.$(VER).dylib -Wl,-single_module $(LDFLAGS) -compatibility_version $(VER) -current_version $(VER) -o libmsieve.$(VER).dylib $(COMMON_OBJS) $(QS_OBJS) $(NFS_OBJS) $(LIBS)
clean:
cd cub && make clean WIN=$(WIN) WIN64=$(WIN64) && cd ..
@@ -287,27 +285,27 @@
# common file build rules
%.o: %.c $(COMMON_HDR)
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(L_CFLAGS) -c -o $@ $<
# QS build rules
mpqs/sieve_core_generic_32k.qo: mpqs/sieve_core.c $(COMMON_HDR) $(QS_HDR)
- $(CC) $(CFLAGS) -DBLOCK_KB=32 -DHAS_SSE2 \
+ $(CC) $(L_CFLAGS) -DBLOCK_KB=32 -DHAS_SSE2 \
-DROUTINE_NAME=qs_core_sieve_generic_32k \
-c -o $@ mpqs/sieve_core.c
mpqs/sieve_core_generic_64k.qo: mpqs/sieve_core.c $(COMMON_HDR) $(QS_HDR)
- $(CC) $(CFLAGS) -DBLOCK_KB=64 -DHAS_SSE2 \
+ $(CC) $(L_CFLAGS) -DBLOCK_KB=64 -DHAS_SSE2 \
-DROUTINE_NAME=qs_core_sieve_generic_64k \
-c -o $@ mpqs/sieve_core.c
%.qo: %.c $(COMMON_HDR) $(QS_HDR)
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(L_CFLAGS) -c -o $@ $<
# NFS build rules
%.no: %.c $(COMMON_HDR) $(NFS_HDR)
- $(CC) $(CFLAGS) -Ignfs -c -o $@ $<
+ $(CC) $(L_CFLAGS) -Ignfs -c -o $@ $<
# GPU build rules