1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
--- a/Makefile
+++ b/Makefile
@@ -18,10 +18,8 @@
# gcc with basic optimization (-march flag could
# get overridden by architecture-specific builds)
-CC = gcc
-WARN_FLAGS = -Wall -W
-OPT_FLAGS = -O3 -fomit-frame-pointer -march=native \
- -D_FILE_OFFSET_BITS=64 -DNDEBUG -D_LARGEFILE64_SOURCE
+CFLAGS += -Wall -W
+CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
# use := instead of = so we only run the following once
SVN_VERSION := $(shell svnversion .)
@@ -29,15 +27,14 @@
SVN_VERSION := unknown
endif
-CFLAGS = $(OPT_FLAGS) $(MACHINE_FLAGS) $(WARN_FLAGS) \
- -DMSIEVE_SVN_VERSION="\"$(SVN_VERSION)\"" \
- -I. -Iaprcl -Iinclude -Ignfs -Ignfs/poly -Ignfs/poly/stage1
+CPPFLAGS += -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
- LIBS += -lecm
+ CPPFLAGS += -DHAVE_GMP_ECM
+ LIBS += -lecm -lgomp
endif
ifeq ($(WIN),1)
@@ -61,22 +58,21 @@
CUDA_ROOT = $(shell dirname $(NVCC))/../
CUDA_LIBS = -lcuda
endif
- CFLAGS += -I"$(CUDA_ROOT)/include" -Icub -DHAVE_CUDA
+ CPPFLAGS += -I"$(CUDA_ROOT)/include" -Icub -DHAVE_CUDA
LIBS += $(CUDA_LIBS)
endif
ifeq ($(MPI),1)
- CC = mpicc
- CFLAGS += -DHAVE_MPI
+ CPPFLAGS += -DHAVE_MPI
endif
ifeq ($(BOINC),1)
# fill in as appropriate
BOINC_INC_DIR = .
BOINC_LIB_DIR = .
- CFLAGS += -I$(BOINC_INC_DIR) -DHAVE_BOINC
+ CPPFLAGS += -I$(BOINC_INC_DIR) -DHAVE_BOINC
LIBS += -L$(BOINC_LIB_DIR) -lboinc_api -lboinc
endif
ifeq ($(NO_ZLIB),1)
- CFLAGS += -DNO_ZLIB
+ CPPFLAGS += -DNO_ZLIB
else
LIBS += -lz
endif
@@ -272,9 +268,9 @@
all: $(COMMON_OBJS) $(QS_OBJS) $(NFS_OBJS) $(GPU_OBJS)
rm -f libmsieve.a
- ar r libmsieve.a $(COMMON_OBJS) $(QS_OBJS) $(NFS_OBJS)
- ranlib libmsieve.a
- $(CC) $(CFLAGS) demo.c -o msieve $(LDFLAGS) \
+ $(AR) r libmsieve.a $(COMMON_OBJS) $(QS_OBJS) $(NFS_OBJS)
+ $(RANLIB) libmsieve.a
+ $(CC) $(LDFLAGS) $(CFLAGS) $(CPPFLAGS) demo.c -o msieve \
libmsieve.a $(LIBS)
clean:
@@ -287,27 +283,27 @@
# common file build rules
%.o: %.c $(COMMON_HDR)
- $(CC) $(CFLAGS) -c -o $@ $<
+ $(CC) $(CFLAGS) $(CPPFLAGS) -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) $(CFLAGS) $(CPPFLAGS) -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) $(CFLAGS) $(CPPFLAGS) -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) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
# NFS build rules
%.no: %.c $(COMMON_HDR) $(NFS_HDR)
- $(CC) $(CFLAGS) -Ignfs -c -o $@ $<
+ $(CC) $(CFLAGS) $(CPPFLAGS) -Ignfs -c -o $@ $<
# GPU build rules
|