| 1 |
# ################################################################ |
| 2 |
# xxHash benchHash Makefile |
| 3 |
# Copyright (C) 2019-2021 Yann Collet |
| 4 |
# |
| 5 |
# GPL v2 License |
| 6 |
# |
| 7 |
# This program is free software; you can redistribute it and/or modify |
| 8 |
# it under the terms of the GNU General Public License as published by |
| 9 |
# the Free Software Foundation; either version 2 of the License, or |
| 10 |
# (at your option) any later version. |
| 11 |
# |
| 12 |
# This program is distributed in the hope that it will be useful, |
| 13 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
# GNU General Public License for more details. |
| 16 |
# |
| 17 |
# You should have received a copy of the GNU General Public License along |
| 18 |
# with this program; if not, write to the Free Software Foundation, Inc., |
| 19 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 20 |
# |
| 21 |
# You can contact the author at: |
| 22 |
# - xxHash homepage: https://www.xxhash.com |
| 23 |
# - xxHash source repository: https://github.com/Cyan4973/xxHash |
| 24 |
# ################################################################ |
| 25 |
# benchHash: A generic benchmark for hash algorithms |
| 26 |
# measuring throughput, latency and bandwidth |
| 27 |
# ################################################################ |
| 28 |
|
| 29 |
|
| 30 |
CPPFLAGS += -I../.. # directory of xxHash source files |
| 31 |
CFLAGS ?= -O3 |
| 32 |
CFLAGS += -Wall -Wextra -Wstrict-aliasing=1 \ |
| 33 |
-std=c99 |
| 34 |
CFLAGS += $(MOREFLAGS) # custom way to add flags |
| 35 |
CXXFLAGS ?= -O3 |
| 36 |
LDFLAGS += $(MOREFLAGS) |
| 37 |
|
| 38 |
|
| 39 |
OBJ_LIST = main.o bhDisplay.o benchHash.o benchfn.o timefn.o |
| 40 |
|
| 41 |
|
| 42 |
default: benchHash |
| 43 |
|
| 44 |
all: benchHash |
| 45 |
|
| 46 |
benchHash32: CFLAGS += -m32 |
| 47 |
benchHash32: CXXFLAGS += -m32 |
| 48 |
|
| 49 |
benchHash_avx2: CFLAGS += -mavx2 |
| 50 |
benchHash_avx2: CXXFLAGS += -mavx2 |
| 51 |
|
| 52 |
benchHash_avx512: CFLAGS += -mavx512f |
| 53 |
benchHash_avx512: CXXFLAGS += -mavx512f |
| 54 |
|
| 55 |
benchHash_hw: CPPFLAGS += -DHARDWARE_SUPPORT |
| 56 |
benchHash_hw: CFLAGS += -mavx2 -maes |
| 57 |
benchHash_hw: CXXFLAGS += -mavx2 -mpclmul -std=c++14 |
| 58 |
|
| 59 |
benchHash benchHash32 benchHash_avx2 benchHash_avx512 benchHash_nosimd benchHash_hw: $(OBJ_LIST) |
| 60 |
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $^ $(LDFLAGS) -o $@ |
| 61 |
|
| 62 |
|
| 63 |
main.o: bhDisplay.h hashes.h |
| 64 |
|
| 65 |
bhDisplay.o: bhDisplay.h benchHash.h |
| 66 |
|
| 67 |
benchHash.o: benchHash.h |
| 68 |
|
| 69 |
|
| 70 |
clean: |
| 71 |
$(RM) *.o benchHash benchHash32 benchHash_avx2 benchHash_avx512 benchHash_hw |