| 1 | # @file  Makefile
 | 
|---|
| 2 | # @brief Makefile
 | 
|---|
| 3 | #
 | 
|---|
| 4 | # @author Mutsuo Saito (Hiroshima University)
 | 
|---|
| 5 | # @author Makoto Matsumoto (Hiroshima University)
 | 
|---|
| 6 | #
 | 
|---|
| 7 | # Copyright (C) 2007, 2008 Mutsuo Saito, Makoto Matsumoto and
 | 
|---|
| 8 | # Hiroshima University. All rights reserved.
 | 
|---|
| 9 | #
 | 
|---|
| 10 | # The new BSD License is applied to this software.
 | 
|---|
| 11 | # see LICENSE.txt
 | 
|---|
| 12 | #
 | 
|---|
| 13 | # @note
 | 
|---|
| 14 | # We could comple test-sse2-Mxxx using gcc 3.4.4 of cygwin.
 | 
|---|
| 15 | # We could comple test-sse2-Mxxx using gcc 4.0.1 of Linux.
 | 
|---|
| 16 | # We coundn't comple test-sse2-Mxxx using gcc 3.3.2 of Linux.
 | 
|---|
| 17 | # We could comple test-alti-Mxxx using gcc 3.3 of osx.
 | 
|---|
| 18 | # We could comple test-alti-Mxxx using gcc 4.0 of osx.
 | 
|---|
| 19 | 
 | 
|---|
| 20 | WARN = -Wmissing-prototypes -Wall #-Winline 
 | 
|---|
| 21 | #WARN = -Wmissing-prototypes -Wall -W
 | 
|---|
| 22 | OPTI = -O3 -finline-functions -fomit-frame-pointer -DNDEBUG \
 | 
|---|
| 23 | -fno-strict-aliasing --param max-inline-insns-single=1800 
 | 
|---|
| 24 | #--param inline-unit-growth=500 --param large-function-growth=900 #for gcc 4
 | 
|---|
| 25 | #STD =
 | 
|---|
| 26 | #STD = -std=c89 -pedantic
 | 
|---|
| 27 | #STD = -std=c99 -pedantic
 | 
|---|
| 28 | STD = -std=c99
 | 
|---|
| 29 | CC = gcc
 | 
|---|
| 30 | CCFLAGS = $(OPTI) $(WARN) $(STD)
 | 
|---|
| 31 | ALTIFLAGS = -mabi=altivec -maltivec -DHAVE_ALTIVEC
 | 
|---|
| 32 | OSXALTIFLAGS = -faltivec -maltivec -DHAVE_ALTIVEC
 | 
|---|
| 33 | SSE2FLAGS = -msse2 -DHAVE_SSE2
 | 
|---|
| 34 | STD_TARGET = test-std-M19937
 | 
|---|
| 35 | ALL_STD_TARGET = test-std-M521 test-std-M1279 test-std-M2203 test-std-M4253 \
 | 
|---|
| 36 | test-std-M11213 test-std-M19937 test-std-M44497 test-std-M86243 \
 | 
|---|
| 37 | test-std-M132049 test-std-M216091
 | 
|---|
| 38 | ALTI_TARGET = $(STD_TARGET) test-alti-M19937
 | 
|---|
| 39 | ALL_ALTI_TARGET = test-alti-M521 test-alti-M1279 test-alti-M2203 \
 | 
|---|
| 40 | test-alti-M4253 test-alti-M11213 test-alti-M19937 test-alti-M44497 \
 | 
|---|
| 41 | test-alti-M86243 test-alti-M132049 test-alti-M216091
 | 
|---|
| 42 | SSE2_TARGET = $(STD_TARGET) test-sse2-M19937
 | 
|---|
| 43 | ALL_SSE2_TARGET = test-sse2-M521 test-sse2-M1279 test-sse2-M2203 \
 | 
|---|
| 44 | test-sse2-M4253 test-sse2-M11213 test-sse2-M19937 test-sse2-M44497 \
 | 
|---|
| 45 | test-sse2-M86243 test-sse2-M132049 test-sse2-M216091
 | 
|---|
| 46 | # ==========================================================
 | 
|---|
| 47 | # comment out or EDIT following lines to get max performance
 | 
|---|
| 48 | # ==========================================================
 | 
|---|
| 49 | # --------------------
 | 
|---|
| 50 | # for gcc 4
 | 
|---|
| 51 | # --------------------
 | 
|---|
| 52 | #CCFLAGS += --param inline-unit-growth=500 \
 | 
|---|
| 53 | #--param large-function-growth=900
 | 
|---|
| 54 | # --------------------
 | 
|---|
| 55 | # for icl
 | 
|---|
| 56 | # --------------------
 | 
|---|
| 57 | #CC = icl /Wcheck /O3 /QxB /Qprefetch
 | 
|---|
| 58 | # --------------------
 | 
|---|
| 59 | # for icc
 | 
|---|
| 60 | # --------------------
 | 
|---|
| 61 | #CC = icc 
 | 
|---|
| 62 | #OPTI = -O3 -finline-functions -fomit-frame-pointer -DNDEBUG \
 | 
|---|
| 63 | #-fno-strict-aliasing
 | 
|---|
| 64 | #CCFLAGS = $(OPTI) $(WARN) $(STD)
 | 
|---|
| 65 | # -----------------
 | 
|---|
| 66 | # for PowerPC
 | 
|---|
| 67 | # -----------------
 | 
|---|
| 68 | #CCFLAGS += -arch ppc
 | 
|---|
| 69 | # -----------------
 | 
|---|
| 70 | # for Pentium M
 | 
|---|
| 71 | # -----------------
 | 
|---|
| 72 | #CCFLAGS += -march=prescott
 | 
|---|
| 73 | # -----------------
 | 
|---|
| 74 | # for Athlon 64
 | 
|---|
| 75 | # -----------------
 | 
|---|
| 76 | #CCFLAGS += -march=athlon64
 | 
|---|
| 77 | 
 | 
|---|
| 78 | .PHONY: std-check sse2-check alti-check
 | 
|---|
| 79 | 
 | 
|---|
| 80 | std: ${STD_TARGET}
 | 
|---|
| 81 | 
 | 
|---|
| 82 | sse2: ${SSE2_TARGET}
 | 
|---|
| 83 | 
 | 
|---|
| 84 | alti: ${ALTI_TARGET}
 | 
|---|
| 85 | 
 | 
|---|
| 86 | osx-alti:
 | 
|---|
| 87 |         ${MAKE} "ALTIFLAGS=${OSXALTIFLAGS}" alti
 | 
|---|
| 88 | 
 | 
|---|
| 89 | std-check: ${ALL_STD_TARGET}
 | 
|---|
| 90 |         ./check.sh test-std
 | 
|---|
| 91 | 
 | 
|---|
| 92 | sse2-check: ${ALL_SSE2_TARGET}
 | 
|---|
| 93 |         ./check.sh test-sse2
 | 
|---|
| 94 | 
 | 
|---|
| 95 | alti-check: ${ALL_ALTI_TARGET}
 | 
|---|
| 96 |         ./check.sh test-alti
 | 
|---|
| 97 | 
 | 
|---|
| 98 | osx-alti-check: 
 | 
|---|
| 99 |         make "ALTIFLAGS=${OSXALTIFLAGS}" alti-check
 | 
|---|
| 100 | 
 | 
|---|
| 101 | test-std-M521: test.c dSFMT.c dSFMT.h
 | 
|---|
| 102 |         ${CC} ${CCFLAGS} -DDSFMT_MEXP=521 -o $@ dSFMT.c test.c
 | 
|---|
| 103 | 
 | 
|---|
| 104 | test-alti-M521: test.c dSFMT.c dSFMT.h
 | 
|---|
| 105 |         ${CC} ${CCFLAGS} ${ALTIFLAGS} -DDSFMT_MEXP=521 -o $@ dSFMT.c test.c
 | 
|---|
| 106 | 
 | 
|---|
| 107 | test-sse2-M521: test.c dSFMT.c dSFMT.h
 | 
|---|
| 108 |         ${CC} ${CCFLAGS} ${SSE2FLAGS} -DDSFMT_MEXP=521 -o $@ dSFMT.c test.c
 | 
|---|
| 109 | 
 | 
|---|
| 110 | test-std-M1279: test.c dSFMT.c dSFMT.h
 | 
|---|
| 111 |         ${CC} ${CCFLAGS} -DDSFMT_MEXP=1279 -o $@ dSFMT.c test.c
 | 
|---|
| 112 | 
 | 
|---|
| 113 | test-alti-M1279: test.c dSFMT.c dSFMT.h
 | 
|---|
| 114 |         ${CC} ${CCFLAGS} ${ALTIFLAGS} -DDSFMT_MEXP=1279 -o $@ dSFMT.c test.c
 | 
|---|
| 115 | 
 | 
|---|
| 116 | test-sse2-M1279: test.c dSFMT.c dSFMT.h
 | 
|---|
| 117 |         ${CC} ${CCFLAGS} ${SSE2FLAGS} -DDSFMT_MEXP=1279 -o $@ dSFMT.c test.c
 | 
|---|
| 118 | 
 | 
|---|
| 119 | test-std-M2203: test.c dSFMT.c dSFMT.h
 | 
|---|
| 120 |         ${CC} ${CCFLAGS} -DDSFMT_MEXP=2203 -o $@ dSFMT.c test.c
 | 
|---|
| 121 | 
 | 
|---|
| 122 | test-alti-M2203: test.c dSFMT.c dSFMT.h
 | 
|---|
| 123 |         ${CC} ${CCFLAGS} ${ALTIFLAGS} -DDSFMT_MEXP=2203 -o $@ dSFMT.c test.c
 | 
|---|
| 124 | 
 | 
|---|
| 125 | test-sse2-M2203: test.c dSFMT.c dSFMT.h
 | 
|---|
| 126 |         ${CC} ${CCFLAGS} ${SSE2FLAGS} -DDSFMT_MEXP=2203 -o $@ dSFMT.c test.c
 | 
|---|
| 127 | 
 | 
|---|
| 128 | test-std-M4253: test.c dSFMT.c dSFMT.h
 | 
|---|
| 129 |         ${CC} ${CCFLAGS} -DDSFMT_MEXP=4253 -o $@ dSFMT.c test.c
 | 
|---|
| 130 | 
 | 
|---|
| 131 | test-alti-M4253: test.c dSFMT.c dSFMT.h
 | 
|---|
| 132 |         ${CC} ${CCFLAGS} ${ALTIFLAGS} -DDSFMT_MEXP=4253 -o $@ dSFMT.c test.c
 | 
|---|
| 133 | 
 | 
|---|
| 134 | test-sse2-M4253: test.c dSFMT.c dSFMT.h
 | 
|---|
| 135 |         ${CC} ${CCFLAGS} ${SSE2FLAGS} -DDSFMT_MEXP=4253 -o $@ dSFMT.c test.c
 | 
|---|
| 136 | 
 | 
|---|
| 137 | test-std-M11213: test.c dSFMT.c dSFMT.h
 | 
|---|
| 138 |         ${CC} ${CCFLAGS} -DDSFMT_MEXP=11213 -o $@ dSFMT.c test.c
 | 
|---|
| 139 | 
 | 
|---|
| 140 | test-alti-M11213: test.c dSFMT.c dSFMT.h
 | 
|---|
| 141 |         ${CC} ${CCFLAGS} ${ALTIFLAGS} -DDSFMT_MEXP=11213 -o $@ dSFMT.c test.c
 | 
|---|
| 142 | 
 | 
|---|
| 143 | test-sse2-M11213: test.c dSFMT.c dSFMT.h
 | 
|---|
| 144 |         ${CC} ${CCFLAGS} ${SSE2FLAGS} -DDSFMT_MEXP=11213 -o $@ dSFMT.c test.c
 | 
|---|
| 145 | 
 | 
|---|
| 146 | test-std-M19937: test.c dSFMT.c dSFMT.h
 | 
|---|
| 147 |         ${CC} ${CCFLAGS} -DDSFMT_MEXP=19937 -o $@ dSFMT.c test.c
 | 
|---|
| 148 | 
 | 
|---|
| 149 | test-alti-M19937: test.c dSFMT.c dSFMT.h
 | 
|---|
| 150 |         ${CC} ${CCFLAGS} ${ALTIFLAGS} -DDSFMT_MEXP=19937 -o $@ dSFMT.c test.c
 | 
|---|
| 151 | 
 | 
|---|
| 152 | test-sse2-M19937: test.c dSFMT.c dSFMT.h
 | 
|---|
| 153 |         ${CC} ${CCFLAGS} ${SSE2FLAGS} -DDSFMT_MEXP=19937 -o $@ dSFMT.c test.c
 | 
|---|
| 154 | 
 | 
|---|
| 155 | test-std-M44497: test.c dSFMT.c dSFMT.h
 | 
|---|
| 156 |         ${CC} ${CCFLAGS} -DDSFMT_MEXP=44497 -o $@ dSFMT.c test.c
 | 
|---|
| 157 | 
 | 
|---|
| 158 | test-alti-M44497: test.c dSFMT.c dSFMT.h
 | 
|---|
| 159 |         ${CC} ${CCFLAGS} ${ALTIFLAGS} -DDSFMT_MEXP=44497 -o $@ dSFMT.c test.c
 | 
|---|
| 160 | 
 | 
|---|
| 161 | test-sse2-M44497: test.c dSFMT.c dSFMT.h
 | 
|---|
| 162 |         ${CC} ${CCFLAGS} ${SSE2FLAGS} -DDSFMT_MEXP=44497 -o $@ dSFMT.c test.c
 | 
|---|
| 163 | 
 | 
|---|
| 164 | test-std-M86243: test.c dSFMT.c dSFMT.h
 | 
|---|
| 165 |         ${CC} ${CCFLAGS} -DDSFMT_MEXP=86243 -o $@ dSFMT.c test.c
 | 
|---|
| 166 | 
 | 
|---|
| 167 | test-alti-M86243: test.c dSFMT.c dSFMT.h
 | 
|---|
| 168 |         ${CC} ${CCFLAGS} ${ALTIFLAGS} -DDSFMT_MEXP=86243 -o $@ dSFMT.c test.c
 | 
|---|
| 169 | 
 | 
|---|
| 170 | test-sse2-M86243: test.c dSFMT.c dSFMT.h
 | 
|---|
| 171 |         ${CC} ${CCFLAGS} ${SSE2FLAGS} -DDSFMT_MEXP=86243 -o $@ dSFMT.c test.c
 | 
|---|
| 172 | 
 | 
|---|
| 173 | test-std-M132049: test.c dSFMT.c dSFMT.h
 | 
|---|
| 174 |         ${CC} ${CCFLAGS} -DDSFMT_MEXP=132049 -o $@ dSFMT.c test.c
 | 
|---|
| 175 | 
 | 
|---|
| 176 | test-alti-M132049: test.c dSFMT.c dSFMT.h
 | 
|---|
| 177 |         ${CC} ${CCFLAGS} ${ALTIFLAGS} -DDSFMT_MEXP=132049 -o $@ dSFMT.c test.c
 | 
|---|
| 178 | 
 | 
|---|
| 179 | test-sse2-M132049: test.c dSFMT.c dSFMT.h
 | 
|---|
| 180 |         ${CC} ${CCFLAGS} ${SSE2FLAGS} -DDSFMT_MEXP=132049 -o $@ dSFMT.c test.c
 | 
|---|
| 181 | 
 | 
|---|
| 182 | test-std-M216091: test.c dSFMT.c dSFMT.h
 | 
|---|
| 183 |         ${CC} ${CCFLAGS} -DDSFMT_MEXP=216091 -o $@ dSFMT.c test.c
 | 
|---|
| 184 | 
 | 
|---|
| 185 | test-alti-M216091: test.c dSFMT.c dSFMT.h
 | 
|---|
| 186 |         ${CC} ${CCFLAGS} ${ALTIFLAGS} -DDSFMT_MEXP=216091 -o $@ dSFMT.c test.c
 | 
|---|
| 187 | 
 | 
|---|
| 188 | test-sse2-M216091: test.c dSFMT.c dSFMT.h
 | 
|---|
| 189 |         ${CC} ${CCFLAGS} ${SSE2FLAGS} -DDSFMT_MEXP=216091 -o $@ dSFMT.c test.c
 | 
|---|
| 190 | 
 | 
|---|
| 191 | .c.o:
 | 
|---|
| 192 |         ${CC} ${CCFLAGS} -c $<
 | 
|---|
| 193 | 
 | 
|---|
| 194 | clean:
 | 
|---|
| 195 |         rm -f *.o *~ test-*-M*
 | 
|---|