1# @file  Makefile
2# @brief Makefile
3#
4# @author Mutsuo Saito (Hiroshima University)
5# @author Makoto Matsumoto (Hiroshima University)
6#
7# Copyright (C) 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
8# 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
20WARN = -Wmissing-prototypes -Wall #-Winline
21#WARN = -Wmissing-prototypes -Wall -W
22OPTI = -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
28STD = -std=c99
29CC = gcc
30CCFLAGS = $(OPTI) $(WARN) $(STD)
31ALTIFLAGS = -mabi=altivec -maltivec -DHAVE_ALTIVEC
32OSXALTIFLAGS = -faltivec -maltivec -DHAVE_ALTIVEC
33SSE2FLAGS = -msse2 -DHAVE_SSE2
34STD_TARGET = test-std-M19937
35BIG_TARGET = test-big64-M19937
36ALL_STD_TARGET = test-std-M607 test-std-M1279 test-std-M2281 test-std-M4253 \
37test-std-M11213 test-std-M19937 test-std-M44497 test-std-M86243 \
38test-std-M132049 test-std-M216091
39ALL_BIG_TARGET = test-big64-M607 test-big64-M1279 test-big64-M2281 \
40test-big64-M4253 test-big64-M11213 test-big64-M19937 test-big64-M44497 \
41test-big64-M86243 test-big64-M132049 test-big64-M216091
42ALTI_TARGET = test-alti-M19937
43ALL_ALTI_TARGET = test-alti-M607 test-alti-M1279 test-alti-M2281 \
44test-alti-M4253 test-alti-M11213 test-alti-M19937 test-alti-M44497 \
45test-alti-M86243 test-alti-M132049 test-alti-M216091
46ALL_ALTIBIG_TARGET = test-alti64-M607 test-alti64-M1279 test-alti64-M2281 \
47test-alti64-M4253 test-alti64-M11213 test-alti64-M19937 test-alti64-M44497 \
48test-alti64-M86243 test-alti64-M132049 test-alti64-M216091
49SSE2_TARGET = test-sse2-M19937
50ALL_SSE2_TARGET = test-sse2-M607 test-sse2-M1279 test-sse2-M2281 \
51test-sse2-M4253 test-sse2-M11213 test-sse2-M19937 test-sse2-M44497 \
52test-sse2-M86243 test-sse2-M132049 test-sse2-M216091
53# ==========================================================
54# comment out or EDIT following lines to get max performance
55# ==========================================================
56# --------------------
57# for gcc 4
58# --------------------
59CCFLAGS += --param inline-unit-growth=500 --param large-function-growth=900
60# --------------------
61# for icl
62# --------------------
63#CC = icl /Wcheck /O3 /QxB /Qprefetch
64# -----------------
65# for PowerPC
66# -----------------
67#CCFLAGS += -arch ppc
68# -----------------
69# for Pentium M
70# -----------------
71#CCFLAGS += -march=prescott
72# -----------------
73# for Athlon 64
74# -----------------
75#CCFLAGS += -march=athlon64
76
77.PHONY: std-check sse2-check alti-check
78
79std: ${STD_TARGET}
80
81sse2:${SSE2_TARGET}
82
83alti:${ALTI_TARGET}
84
85osx-alti:
86	make "ALTIFLAGS=${OSXALTIFLAGS}" alti
87
88big:${BIG_TARGET}
89
90std-check: ${ALL_STD_TARGET}
91	./check.sh 32 test-std
92
93sse2-check: ${ALL_SSE2_TARGET}
94	./check.sh 32 test-sse2
95
96alti-check: ${ALL_ALTI_TARGET}
97	./check.sh 32 test-alti
98
99osx-alti-check:
100	make "ALTIFLAGS=${OSXALTIFLAGS}" alti-check
101
102big-check: ${ALL_BIG_TARGET} ${ALL_STD_TARGET}
103	./check.sh 64 test-big64
104
105altibig-check: ${ALL_ALTIBIG_TARGET} ${ALL_STD_TARGET}
106	./check.sh 64 test-alti64
107
108osx-altibig-check:
109	make "ALTIFLAGS=${OSXALTIFLAGS}" altibig-check
110
111test-std-M607: test.c SFMT.c SFMT.h SFMT-params607.h
112	${CC} ${CCFLAGS} -DMEXP=607 -o $@ test.c
113
114test-alti-M607: test.c SFMT.c SFMT.h SFMT-alti.h SFMT-params607.h
115	${CC} ${CCFLAGS} ${ALTIFLAGS} -DMEXP=607 -o $@ test.c
116
117test-sse2-M607: test.c SFMT.c SFMT.h SFMT-sse2.h SFMT-params607.h
118	${CC} ${CCFLAGS} ${SSE2FLAGS} -DMEXP=607 -o $@ test.c
119
120test-std-M1279: test.c SFMT.c SFMT.h SFMT-params1279.h
121	${CC} ${CCFLAGS} -DMEXP=1279 -o $@ test.c
122
123test-alti-M1279: test.c SFMT.c SFMT.h SFMT-alti.h SFMT-params1279.h
124	${CC} ${CCFLAGS} ${ALTIFLAGS} -DMEXP=1279 -o $@ test.c
125
126test-sse2-M1279: test.c SFMT.c SFMT.h SFMT-sse2.h SFMT-params1279.h
127	${CC} ${CCFLAGS} ${SSE2FLAGS} -DMEXP=1279 -o $@ test.c
128
129test-std-M2281: test.c SFMT.c SFMT.h SFMT-params2281.h
130	${CC} ${CCFLAGS} -DMEXP=2281 -o $@ test.c
131
132test-alti-M2281: test.c SFMT.c SFMT.h SFMT-alti.h SFMT-params2281.h
133	${CC} ${CCFLAGS} ${ALTIFLAGS} -DMEXP=2281 -o $@ test.c
134
135test-sse2-M2281: test.c SFMT.c SFMT.h SFMT-sse2.h SFMT-params2281.h
136	${CC} ${CCFLAGS} ${SSE2FLAGS} -DMEXP=2281 -o $@ test.c
137
138test-std-M4253: test.c SFMT.c SFMT.h SFMT-params4253.h
139	${CC} ${CCFLAGS} -DMEXP=4253 -o $@ test.c
140
141test-alti-M4253: test.c SFMT.c SFMT.h SFMT-alti.h SFMT-params4253.h
142	${CC} ${CCFLAGS} ${ALTIFLAGS} -DMEXP=4253 -o $@ test.c
143
144test-sse2-M4253: test.c SFMT.c SFMT.h SFMT-sse2.h SFMT-params4253.h
145	${CC} ${CCFLAGS} ${SSE2FLAGS} -DMEXP=4253 -o $@ test.c
146
147test-std-M11213: test.c SFMT.c SFMT.h SFMT-params11213.h
148	${CC} ${CCFLAGS} -DMEXP=11213 -o $@ test.c
149
150test-alti-M11213: test.c SFMT.c SFMT.h SFMT-alti.h \
151	SFMT-params11213.h
152	${CC} ${CCFLAGS} ${ALTIFLAGS} -DMEXP=11213 -o $@ test.c
153
154test-sse2-M11213: test.c SFMT.c SFMT.h SFMT-sse2.h \
155	SFMT-params11213.h
156	${CC} ${CCFLAGS} ${SSE2FLAGS} -DMEXP=11213 -o $@ test.c
157
158test-std-M19937: test.c SFMT.c SFMT.h SFMT-params19937.h
159	${CC} ${CCFLAGS} -DMEXP=19937 -o $@ test.c
160
161test-alti-M19937: test.c SFMT.c SFMT.h SFMT-alti.h \
162	SFMT-params19937.h
163	${CC} ${CCFLAGS} ${ALTIFLAGS} -DMEXP=19937 -o $@ test.c
164
165test-sse2-M19937: test.c SFMT.c SFMT.h SFMT-sse2.h \
166	SFMT-params19937.h
167	${CC} ${CCFLAGS} ${SSE2FLAGS} -DMEXP=19937 -o $@ test.c
168
169test-std-M44497: test.c SFMT.c SFMT.h SFMT-params44497.h
170	${CC} ${CCFLAGS} -DMEXP=44497 -o $@ test.c
171
172test-alti-M44497: test.c SFMT.c SFMT.h SFMT-alti.h \
173	SFMT-params44497.h
174	${CC} ${CCFLAGS} ${ALTIFLAGS} -DMEXP=44497 -o $@ test.c
175
176test-sse2-M44497: test.c SFMT.c SFMT.h SFMT-sse2.h \
177	SFMT-params44497.h
178	${CC} ${CCFLAGS} ${SSE2FLAGS} -DMEXP=44497 -o $@ test.c
179
180test-std-M86243: test.c SFMT.c SFMT.h SFMT-params86243.h
181	${CC} ${CCFLAGS} -DMEXP=86243 -o $@ test.c
182
183test-alti-M86243: test.c SFMT.c SFMT.h SFMT-alti.h \
184	SFMT-params86243.h
185	${CC} ${CCFLAGS} ${ALTIFLAGS} -DMEXP=86243 -o $@ test.c
186
187test-sse2-M86243: test.c SFMT.c SFMT.h SFMT-sse2.h \
188	SFMT-params86243.h
189	${CC} ${CCFLAGS} ${SSE2FLAGS} -DMEXP=86243 -o $@ test.c
190
191test-std-M132049: test.c SFMT.c SFMT.h SFMT-params132049.h
192	${CC} ${CCFLAGS} -DMEXP=132049 -o $@ test.c
193
194test-alti-M132049: test.c SFMT.c SFMT.h SFMT-alti.h \
195	SFMT-params132049.h
196	${CC} ${CCFLAGS} ${ALTIFLAGS} -DMEXP=132049 -o $@ test.c
197
198test-sse2-M132049: test.c SFMT.c SFMT.h SFMT-sse2.h \
199	SFMT-params132049.h
200	${CC} ${CCFLAGS} ${SSE2FLAGS} -DMEXP=132049 -o $@ test.c
201
202test-std-M216091: test.c SFMT.c SFMT.h SFMT-params216091.h
203	${CC} ${CCFLAGS} -DMEXP=216091 -o $@ test.c
204
205test-alti-M216091: test.c SFMT.c SFMT.h SFMT-alti.h \
206	SFMT-params216091.h
207	${CC} ${CCFLAGS} ${ALTIFLAGS} -DMEXP=216091 -o $@ test.c
208
209test-sse2-M216091: test.c SFMT.c SFMT.h SFMT-sse2.h \
210	SFMT-params216091.h
211	${CC} ${CCFLAGS} ${SSE2FLAGS} -DMEXP=216091 -o $@ test.c
212
213test-big64-M607: test.c SFMT.c SFMT.h SFMT-params607.h
214	${CC} ${CCFLAGS} -DONLY64 -DMEXP=607 -o $@ test.c
215
216test-alti64-M607: test.c SFMT.c SFMT.h SFMT-alti.h \
217		  SFMT-params607.h
218	${CC} ${CCFLAGS} ${ALTIFLAGS} -DONLY64 -DMEXP=607 -o $@ test.c
219
220test-big64-M1279: test.c SFMT.c SFMT.h SFMT-params1279.h
221	${CC} ${CCFLAGS} -DONLY64 -DMEXP=1279 -o $@ test.c
222
223test-alti64-M1279: test.c SFMT.c SFMT.h SFMT-alti.h \
224		  SFMT-params1279.h
225	${CC} ${CCFLAGS} ${ALTIFLAGS} -DONLY64 -DMEXP=1279 -o $@ test.c
226
227test-big64-M2281: test.c SFMT.c SFMT.h SFMT-params2281.h
228	${CC} ${CCFLAGS} -DONLY64 -DMEXP=2281 -o $@ test.c
229
230test-alti64-M2281: test.c SFMT.c SFMT.h SFMT-alti.h \
231		  SFMT-params2281.h
232	${CC} ${CCFLAGS} ${ALTIFLAGS} -DONLY64 -DMEXP=2281 -o $@ test.c
233
234test-big64-M4253: test.c SFMT.c SFMT.h SFMT-params4253.h
235	${CC} ${CCFLAGS} -DONLY64 -DMEXP=4253 -o $@ test.c
236
237test-alti64-M4253: test.c SFMT.c SFMT.h SFMT-alti.h \
238		  SFMT-params4253.h
239	${CC} ${CCFLAGS} ${ALTIFLAGS} -DONLY64 -DMEXP=4253 -o $@ test.c
240
241test-big64-M11213: test.c SFMT.c SFMT.h SFMT-params11213.h
242	${CC} ${CCFLAGS} -DONLY64 -DMEXP=11213 -o $@ test.c
243
244test-alti64-M11213: test.c SFMT.c SFMT.h SFMT-alti.h \
245		  SFMT-params11213.h
246	${CC} ${CCFLAGS} ${ALTIFLAGS} -DONLY64 -DMEXP=11213 -o $@ test.c
247
248test-big64-M19937: test.c SFMT.c SFMT.h SFMT-params19937.h
249	${CC} ${CCFLAGS} -DONLY64 -DMEXP=19937 -o $@ test.c
250
251test-alti64-M19937: test.c SFMT.c SFMT.h SFMT-alti.h \
252		  SFMT-params19937.h
253	${CC} ${CCFLAGS} ${ALTIFLAGS} -DONLY64 -DMEXP=19937 -o $@ test.c
254
255test-big64-M44497: test.c SFMT.c SFMT.h SFMT-params44497.h
256	${CC} ${CCFLAGS} -DONLY64 -DMEXP=44497 -o $@ test.c
257
258test-alti64-M44497: test.c SFMT.c SFMT.h SFMT-alti.h \
259		  SFMT-params44497.h
260	${CC} ${CCFLAGS} ${ALTIFLAGS} -DONLY64 -DMEXP=44497 -o $@ test.c
261
262test-big64-M86243: test.c SFMT.c SFMT.h SFMT-params86243.h
263	${CC} ${CCFLAGS} -DONLY64 -DMEXP=86243 -o $@ test.c
264
265test-alti64-M86243: test.c SFMT.c SFMT.h SFMT-alti.h \
266		  SFMT-params86243.h
267	${CC} ${CCFLAGS} ${ALTIFLAGS} -DONLY64 -DMEXP=86243 -o $@ test.c
268
269test-big64-M132049: test.c SFMT.c SFMT.h SFMT-params132049.h
270	${CC} ${CCFLAGS} -DONLY64 -DMEXP=132049 -o $@ test.c
271
272test-alti64-M132049: test.c SFMT.c SFMT.h SFMT-alti.h \
273		  SFMT-params132049.h
274	${CC} ${CCFLAGS} ${ALTIFLAGS} -DONLY64 -DMEXP=132049 -o $@ test.c
275
276test-big64-M216091: test.c SFMT.c SFMT.h SFMT-params216091.h
277	${CC} ${CCFLAGS} -DONLY64 -DMEXP=216091 -o $@ test.c
278
279test-alti64-M216091: test.c SFMT.c SFMT.h SFMT-alti.h \
280		  SFMT-params216091.h
281	${CC} ${CCFLAGS} ${ALTIFLAGS} -DONLY64 -DMEXP=216091 -o $@ test.c
282
283clean:
284	rm -f *.o *~
285