2015-10-22 23:54:34 +02:00
|
|
|
########################################################################
|
2018-09-26 00:34:28 +02:00
|
|
|
# Copyright(c) 2011-2018 Intel Corporation All rights reserved.
|
2015-10-22 23:54:34 +02:00
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
2017-05-31 03:28:57 +02:00
|
|
|
# modification, are permitted provided that the following conditions
|
2015-10-22 23:54:34 +02:00
|
|
|
# are met:
|
|
|
|
# * Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# * Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in
|
|
|
|
# the documentation and/or other materials provided with the
|
|
|
|
# distribution.
|
|
|
|
# * Neither the name of Intel Corporation nor the names of its
|
|
|
|
# contributors may be used to endorse or promote products derived
|
|
|
|
# from this software without specific prior written permission.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
########################################################################
|
|
|
|
|
|
|
|
|
|
|
|
# Makefile include for optimized libraries
|
|
|
|
# make targets:
|
|
|
|
# lib - build library of optimized functions
|
|
|
|
# slib - build shared library
|
|
|
|
# test - run unit tests of functions
|
|
|
|
# perf - run performance tests
|
|
|
|
# install - install headers and libs to system location
|
|
|
|
# sim - run on simulator
|
|
|
|
# trace - get simulator trace
|
|
|
|
# clean - remove object files
|
|
|
|
|
2024-01-09 16:02:18 +01:00
|
|
|
version ?= 2.31.0
|
2017-03-02 23:23:22 +01:00
|
|
|
host_cpu ?= $(shell uname -m | sed -e 's/amd/x86_/')
|
|
|
|
arch ?= $(shell uname | grep -v -e Linux -e BSD )
|
2015-10-22 23:54:34 +02:00
|
|
|
|
2019-05-13 12:41:06 +02:00
|
|
|
# aarch64 cpu arch = aarch64
|
|
|
|
ifeq ($(host_cpu)_$(arch),aarch64_)
|
|
|
|
arch = aarch64
|
|
|
|
endif
|
|
|
|
|
2015-10-22 23:54:34 +02:00
|
|
|
CC = gcc
|
2019-07-17 00:47:20 +02:00
|
|
|
AS = nasm
|
2016-08-31 19:57:09 +02:00
|
|
|
AWK = awk
|
2015-10-22 23:54:34 +02:00
|
|
|
|
|
|
|
DEBUG = -g
|
|
|
|
DEBUG_yasm = -g dwarf2
|
|
|
|
DEBUG_nasm = -g
|
|
|
|
|
|
|
|
# Default arch= build options
|
2023-12-14 15:17:16 +01:00
|
|
|
CFLAGS_ = -Wall -Wchar-subscripts -Wformat-security -Wnested-externs -Wpointer-arith -Wshadow -Wstrict-prototypes -Wtype-limits -fstack-protector -D_FORTIFY_SOURCE=2
|
2015-10-22 23:54:34 +02:00
|
|
|
ASFLAGS_ = -f elf64
|
|
|
|
ARFLAGS_ = cr $@
|
|
|
|
STRIP_gcc = strip -d -R .comment $@
|
|
|
|
|
|
|
|
# arch=32 build options
|
|
|
|
ASFLAGS_32 = -f elf32
|
|
|
|
CFLAGS_32 = -m32
|
|
|
|
ARFLAGS_32 = cr $@
|
|
|
|
|
|
|
|
# arch=win64 build options
|
|
|
|
ASFLAGS_win64 = -f win64
|
|
|
|
CFLAGS_icl = -Qstd=c99
|
|
|
|
ARFLAGS_win64 = -out:$@
|
|
|
|
|
|
|
|
# arch=mingw build options
|
|
|
|
ASFLAGS_mingw = -f win64
|
|
|
|
ARFLAGS_mingw = cr $@
|
|
|
|
|
2023-12-14 15:17:16 +01:00
|
|
|
LDFLAGS_so = -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -Wl,-soname,$(soname)
|
|
|
|
|
|
|
|
ifeq ($(shell uname),Linux)
|
|
|
|
ifeq ($(host_cpu),x86_64)
|
2024-01-09 20:34:41 +01:00
|
|
|
CFLAGS_ += -fcf-protection=full
|
|
|
|
ASFLAGS_ += -DINTEL_CET_ENABLED
|
2023-12-14 15:17:16 +01:00
|
|
|
LDFLAGS += -Wl,-z,ibt -Wl,-z,shstk -Wl,-z,cet-report=error
|
|
|
|
endif
|
|
|
|
endif
|
2016-09-02 02:53:28 +02:00
|
|
|
|
2015-10-22 23:54:34 +02:00
|
|
|
ifeq ($(arch),mingw)
|
|
|
|
CC=x86_64-w64-mingw32-gcc
|
|
|
|
AR=x86_64-w64-mingw32-ar
|
2018-11-16 01:08:14 +01:00
|
|
|
LDFLAGS += -Wl,--force-exe-suffix
|
|
|
|
SIM=wine
|
2018-11-14 21:05:32 +01:00
|
|
|
EXT=.exe
|
|
|
|
CLEANFILES+=*.exe
|
2015-10-22 23:54:34 +02:00
|
|
|
endif
|
|
|
|
|
2017-03-21 21:46:30 +01:00
|
|
|
# arch=noarch build options
|
|
|
|
ARFLAGS_noarch = cr $@
|
|
|
|
ifeq ($(arch),noarch)
|
|
|
|
host_cpu=base_aliases
|
|
|
|
endif
|
|
|
|
|
2019-05-13 12:41:06 +02:00
|
|
|
# arch=aarch64 build options
|
2019-12-16 06:31:45 +01:00
|
|
|
ifeq ($(lib_debug),1)
|
|
|
|
ASFLAGS_aarch64 = -g -c
|
|
|
|
else
|
|
|
|
ASFLAGS_aarch64 = -c
|
|
|
|
endif
|
|
|
|
|
2019-05-13 12:41:06 +02:00
|
|
|
ARFLAGS_aarch64 = cr $@
|
|
|
|
ifeq ($(arch),aarch64)
|
|
|
|
AS=$(CC) -D__ASSEMBLY__
|
|
|
|
SIM=
|
|
|
|
endif
|
|
|
|
|
2017-03-02 23:23:22 +01:00
|
|
|
ASFLAGS_Darwin = -f macho64 --prefix=_
|
|
|
|
ARFLAGS_Darwin = -r $@
|
2017-11-29 23:54:32 +01:00
|
|
|
ifeq ($(shell uname),Darwin)
|
2016-09-02 02:53:28 +02:00
|
|
|
LDFLAGS_so =
|
|
|
|
STRIP_gcc =
|
|
|
|
endif
|
2015-10-22 23:54:34 +02:00
|
|
|
|
2021-09-15 04:14:18 +02:00
|
|
|
D :=
|
2015-11-18 23:52:20 +01:00
|
|
|
INCLUDE = $(patsubst %,-I%/,$(subst :, ,$(VPATH)))
|
2024-01-02 11:34:43 +01:00
|
|
|
CFLAGS = $(CFLAGS_$(arch)) $(CFLAGS_$(CC)) $(DEBUG) -O2 $(DEFINES) $(INCLUDE) -D$(host_cpu)
|
2015-10-22 23:54:34 +02:00
|
|
|
ASFLAGS = $(ASFLAGS_$(arch)) $(ASFLAGS_$(CC)) $(DEBUG_$(AS)) $(DEFINES) $(INCLUDE)
|
|
|
|
ARFLAGS = $(ARFLAGS_$(arch))
|
|
|
|
DEFINES += $(addprefix -D , $D)
|
2018-11-14 21:05:32 +01:00
|
|
|
CLEANFILES += $(O) *.o *.a $(all_tests) $(bin_PROGRAMS) $(lib_name) $(so_lib_name) $(all_llvm_fuzz_tests)
|
2015-10-22 23:54:34 +02:00
|
|
|
|
2019-08-08 06:56:45 +02:00
|
|
|
# set host_cpu=base_aliases for unsupported CPUs
|
|
|
|
ifeq ($(filter aarch64 x86_%,$(host_cpu)),)
|
|
|
|
host_cpu=base_aliases
|
|
|
|
endif
|
|
|
|
|
2019-03-13 03:43:23 +01:00
|
|
|
other_tests += $(other_tests_$(host_cpu))
|
|
|
|
|
2017-03-02 23:23:22 +01:00
|
|
|
lsrc += $(lsrc_$(host_cpu))
|
2015-10-22 23:54:34 +02:00
|
|
|
O = bin
|
2018-12-19 04:23:25 +01:00
|
|
|
lobj += $(patsubst %.c,%.o,$(patsubst %.S,%.o,$(patsubst %.asm,%.o,$(lsrc) $(lsrc_intrinsic))))
|
2015-10-22 23:54:34 +02:00
|
|
|
objs = $(addprefix $(O)/,$(notdir $(lobj)))
|
|
|
|
|
|
|
|
|
|
|
|
lib_name ?= isa-l.a
|
2018-07-10 02:56:26 +02:00
|
|
|
default: lib slib progs
|
2015-10-22 23:54:34 +02:00
|
|
|
|
|
|
|
# Defaults for windows build
|
|
|
|
ifeq ($(arch),win64)
|
|
|
|
AR=lib
|
|
|
|
CC=cl
|
|
|
|
OUTPUT_OPTION = -Fo$@
|
|
|
|
DEBUG=
|
|
|
|
lib_name := $(basename $(lib_name)).lib
|
|
|
|
endif
|
|
|
|
lsrcwin64 = $(lsrc)
|
|
|
|
unit_testswin64 = $(unit_tests)
|
|
|
|
exampleswin64 = $(examples)
|
|
|
|
perf_testswin64 = $(perf_tests)
|
|
|
|
|
2018-07-10 02:56:26 +02:00
|
|
|
|
2015-10-22 23:54:34 +02:00
|
|
|
# Build and run unit tests, performance tests, etc.
|
2017-03-02 23:23:22 +01:00
|
|
|
all_tests = $(notdir $(sort $(perf_tests) $(check_tests) $(unit_tests) $(examples) $(other_tests)))
|
|
|
|
all_unit_tests = $(notdir $(sort $(check_tests) $(unit_tests)))
|
|
|
|
all_perf_tests = $(notdir $(sort $(perf_tests)))
|
|
|
|
all_check_tests = $(notdir $(sort $(check_tests)))
|
2017-10-07 03:48:38 +02:00
|
|
|
all_llvm_fuzz_tests = $(notdir $(sort $(llvm_fuzz_tests)))
|
2015-10-22 23:54:34 +02:00
|
|
|
|
|
|
|
$(all_unit_tests): % : %.c $(lib_name)
|
2015-11-18 23:52:20 +01:00
|
|
|
$(all_perf_tests): % : %.c $(lib_name)
|
2017-03-02 23:23:22 +01:00
|
|
|
$(sort $(notdir $(examples))): % : %.c $(lib_name)
|
2015-11-18 23:52:20 +01:00
|
|
|
$(sort $(notdir $(other_tests))): % : %.c $(lib_name)
|
2015-10-22 23:54:34 +02:00
|
|
|
|
2020-12-04 22:49:51 +01:00
|
|
|
fuzz_args = -fsanitize=fuzzer,address
|
|
|
|
$(all_llvm_fuzz_tests): FUZZLINK = $(fuzz_args)
|
|
|
|
$(all_llvm_fuzz_tests): CFLAGS += $(fuzz_args)
|
|
|
|
$(all_llvm_fuzz_tests): CXXFLAGS += $(fuzz_args)
|
2017-10-07 03:48:38 +02:00
|
|
|
$(all_llvm_fuzz_tests): % : %.o $(lib_name)
|
2018-03-30 09:25:08 +02:00
|
|
|
$(CXX) $(CXXFLAGS) $^ $(LDLIBS) $(FUZZLINK) -o $@
|
2017-10-07 03:48:38 +02:00
|
|
|
|
2019-08-30 06:17:32 +02:00
|
|
|
|
2019-07-17 00:47:20 +02:00
|
|
|
# Check for modern as
|
2019-08-30 06:17:32 +02:00
|
|
|
test-as = $(shell hash printf && printf $(3) > $(2) && $(AS) $(ASFLAGS) ${tmpf} -o /dev/null 2> /dev/null && echo $(1) || echo $(4))
|
|
|
|
as_4 := "pblendvb xmm2, xmm1;"
|
|
|
|
as_6 := "vinserti32x8 zmm0, ymm1, 1;"
|
|
|
|
as_10 := "vpcompressb zmm0 {k1}, zmm1;"
|
|
|
|
|
|
|
|
tmpf := $(shell mktemp)
|
|
|
|
as_feature_level := $(call test-as, 4, $(tmpf), $(as_4), $(as_feature_level))
|
|
|
|
as_feature_level := $(call test-as, 6, $(tmpf), $(as_6), $(as_feature_level))
|
|
|
|
as_feature_level := $(call test-as, 10, $(tmpf), $(as_10), $(as_feature_level))
|
|
|
|
tmpf := $(shell rm ${tmpf})
|
|
|
|
|
|
|
|
ifneq ($(findstring $(as_feature_level),6 10),)
|
|
|
|
D_HAVE_AS_KNOWS_AVX512_y := -DHAVE_AS_KNOWS_AVX512
|
|
|
|
endif
|
|
|
|
|
|
|
|
CFLAGS += -DAS_FEATURE_LEVEL=$(as_feature_level) $(D_HAVE_AS_KNOWS_AVX512_y)
|
|
|
|
ASFLAGS += -DAS_FEATURE_LEVEL=$(as_feature_level) $(D_HAVE_AS_KNOWS_AVX512_y)
|
|
|
|
|
2019-07-17 00:47:20 +02:00
|
|
|
|
2019-06-11 22:45:41 +02:00
|
|
|
# Check for pthreads
|
2021-03-03 01:26:28 +01:00
|
|
|
have_threads ?= $(shell printf "int main(void){return 0;}\n" | $(CC) -x c - -o /dev/null -lpthread && echo y )
|
2019-06-11 22:45:41 +02:00
|
|
|
THREAD_LD_$(have_threads) := -lpthread
|
|
|
|
THREAD_CFLAGS_$(have_threads) := -DHAVE_THREADS
|
2017-10-07 03:48:38 +02:00
|
|
|
|
2018-07-10 02:56:26 +02:00
|
|
|
progs: $(bin_PROGRAMS)
|
|
|
|
$(bin_PROGRAMS): CFLAGS += -DVERSION=\"$(version)\"
|
2019-06-11 22:45:41 +02:00
|
|
|
$(bin_PROGRAMS): LDLIBS += $(THREAD_LD_y)
|
|
|
|
$(bin_PROGRAMS): CFLAGS += $(THREAD_CFLAGS_y)
|
2015-10-22 23:54:34 +02:00
|
|
|
sim test trace: $(addsuffix .run,$(all_unit_tests))
|
2015-11-18 23:52:20 +01:00
|
|
|
perf: $(addsuffix .run,$(all_perf_tests))
|
2016-08-25 19:48:28 +02:00
|
|
|
check: $(addsuffix .run,$(all_check_tests))
|
2017-03-02 23:23:22 +01:00
|
|
|
ex: $(notdir $(examples))
|
2015-10-22 23:54:34 +02:00
|
|
|
all: lib $(all_tests)
|
2015-11-18 23:52:20 +01:00
|
|
|
other: $(notdir $(other_tests))
|
2017-10-07 03:48:38 +02:00
|
|
|
llvm_fuzz_tests: $(all_llvm_fuzz_tests)
|
2015-10-22 23:54:34 +02:00
|
|
|
tests: $(all_unit_tests)
|
2015-11-18 23:52:20 +01:00
|
|
|
perfs: $(all_perf_tests)
|
2016-08-25 19:48:28 +02:00
|
|
|
checks: $(all_check_tests)
|
2018-11-16 01:08:14 +01:00
|
|
|
trace: SIM=sde -debugtrace --
|
|
|
|
sim: SIM=sde --
|
2015-10-22 23:54:34 +02:00
|
|
|
check test sim:
|
|
|
|
@echo Finished running $@
|
|
|
|
|
|
|
|
$(objs): | $(O)
|
|
|
|
$(O): ; mkdir -p $(O)
|
|
|
|
|
|
|
|
# Build rule to run tests
|
2015-11-18 23:52:20 +01:00
|
|
|
$(addsuffix .run,$(all_tests)): %.run : %
|
2018-11-14 21:05:32 +01:00
|
|
|
$(SIM) ./$<$(EXT)
|
2015-10-22 23:54:34 +02:00
|
|
|
@echo Completed run: $<
|
|
|
|
|
|
|
|
# Other build rules
|
2017-03-02 23:23:22 +01:00
|
|
|
msg = $(if $(DEBUG),DEBUG) $(patsubst 32,32-bit,$(host_cpu)) $D
|
2015-10-22 23:54:34 +02:00
|
|
|
|
2018-12-19 04:23:25 +01:00
|
|
|
# yasm/nasm assembly files
|
2015-10-22 23:54:34 +02:00
|
|
|
$(O)/%.o: %.asm
|
|
|
|
@echo " ---> Building $< $(msg)"
|
|
|
|
@$(AS) $(ASFLAGS) -o $@ $<
|
|
|
|
|
2018-12-19 04:23:25 +01:00
|
|
|
# gcc assembly files
|
|
|
|
$(O)/%.o: $(host_cpu)/%.S
|
|
|
|
@echo " ---> Building $< $(msg)"
|
2019-05-13 12:41:06 +02:00
|
|
|
@$(AS) $(ASFLAGS) -o $@ $<
|
2018-12-19 04:23:25 +01:00
|
|
|
|
2019-05-13 12:41:06 +02:00
|
|
|
$(O)/%.o : $(host_cpu)/%.c
|
|
|
|
@echo " ---> Building $< $(msg)"
|
|
|
|
@$(COMPILE.c) $(OUTPUT_OPTION) $<
|
2015-10-22 23:54:34 +02:00
|
|
|
$(O)/%.o %.o: %.c
|
|
|
|
@echo " ---> Building $< $(msg)"
|
|
|
|
@$(COMPILE.c) $(OUTPUT_OPTION) $<
|
|
|
|
|
|
|
|
$(all_tests):
|
|
|
|
@echo " ---> Building Test $@ $(msg)"
|
|
|
|
@$(LINK.o) $(CFLAGS) $^ $(LDLIBS) -o $@
|
|
|
|
|
2018-07-10 02:56:26 +02:00
|
|
|
$(bin_PROGRAMS): % : %_cli.c $(lib_name)
|
|
|
|
@echo " ---> Building Programs $@ $(msg)"
|
|
|
|
@$(LINK.o) $(CFLAGS) $^ $(LDLIBS) -o $@
|
|
|
|
|
2015-10-22 23:54:34 +02:00
|
|
|
|
|
|
|
# Target to build lib files
|
|
|
|
lib: $(lib_name)
|
|
|
|
ifneq ($(lib_debug),1)
|
|
|
|
$(lib_name): DEBUG_$(AS)= # Don't put debug symbols in the lib
|
|
|
|
$(lib_name): DEBUG=
|
|
|
|
$(lib_name): DEFINES+=-D NDEBUG
|
|
|
|
endif
|
|
|
|
ifeq ($(lib_debug),1)
|
|
|
|
DEBUG+=-D DEBUG # Define DEBUG for macros
|
|
|
|
endif
|
|
|
|
|
|
|
|
#lib $(lib_name): $(lib_name)(${objs})
|
|
|
|
$(lib_name): $(objs)
|
|
|
|
@echo " ---> Creating Lib $@"
|
|
|
|
@$(AR) $(ARFLAGS) $^
|
2019-12-16 06:31:45 +01:00
|
|
|
ifneq ($(lib_debug),1)
|
2015-10-22 23:54:34 +02:00
|
|
|
@$(STRIP_$(CC))
|
2019-12-16 06:31:45 +01:00
|
|
|
endif
|
2015-10-22 23:54:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
# Target for shared lib
|
|
|
|
so_lib_name = bin/libisal.so
|
|
|
|
so_lib_inst = $(notdir $(so_lib_name))
|
|
|
|
so_lib_ver = $(so_lib_inst).$(version)
|
|
|
|
soname = $(so_lib_inst).$(word 1, $(subst ., ,$(version)))
|
|
|
|
|
|
|
|
slib: $(so_lib_name)
|
2017-03-02 23:23:22 +01:00
|
|
|
aobjs += $(addprefix $(O)/,$(patsubst %.asm,%.o,$(filter %.asm,$(notdir $(lsrc) $(lsrc_intrinsic)))))
|
2018-12-19 04:23:25 +01:00
|
|
|
aobjs += $(addprefix $(O)/,$(patsubst %.S,%.o,$(filter %.S,$(notdir $(lsrc) $(lsrc_intrinsic)))))
|
2017-03-02 23:23:22 +01:00
|
|
|
shared_objs += $(addprefix $(O)/shared_ver_,$(patsubst %.c,%.o,$(filter %.c,$(notdir $(lsrc) $(lsrc_intrinsic)))))
|
2015-10-22 23:54:34 +02:00
|
|
|
|
|
|
|
$(O)/shared_ver_%.o: %.c
|
|
|
|
@echo " ---> Building shared $< $(msg)"
|
|
|
|
@$(COMPILE.c) $(OUTPUT_OPTION) $<
|
2019-05-13 12:41:06 +02:00
|
|
|
$(O)/shared_ver_%.o: $(host_cpu)/%.c
|
|
|
|
@echo " ---> Building shared $< $(msg)"
|
|
|
|
@$(COMPILE.c) $(OUTPUT_OPTION) $<
|
2015-10-22 23:54:34 +02:00
|
|
|
ifneq ($(lib_debug),1)
|
|
|
|
$(so_lib_name): DEBUG_$(AS)=
|
|
|
|
$(so_lib_name): DEBUG=
|
|
|
|
$(so_lib_name): DEFINES+=-D NDEBUG
|
|
|
|
endif
|
|
|
|
|
|
|
|
$(shared_objs): CFLAGS += -fPIC
|
|
|
|
$(shared_objs) $(aobjs): | $(O)
|
2016-09-02 02:53:28 +02:00
|
|
|
$(so_lib_name): LDFLAGS+=$(LDFLAGS_so)
|
2015-10-22 23:54:34 +02:00
|
|
|
$(so_lib_name): $(shared_objs) $(aobjs)
|
|
|
|
@echo " ---> Creating Shared Lib $@"
|
|
|
|
@$(CC) $(CFLAGS) --shared $(LDFLAGS) -o $@ $^
|
|
|
|
@(cd $(@D); ln -f -s $(so_lib_inst) $(soname))
|
|
|
|
|
2016-08-31 19:57:09 +02:00
|
|
|
|
|
|
|
isa-l.h:
|
|
|
|
@echo 'Building $@'
|
|
|
|
@echo '' >> $@
|
2018-02-09 19:13:27 +01:00
|
|
|
@echo '/**' >> $@
|
|
|
|
@echo ' * @file isa-l.h' >> $@
|
|
|
|
@echo ' * @brief Include for ISA-L library' >> $@
|
|
|
|
@echo ' */' >> $@
|
|
|
|
@echo '' >> $@
|
2016-08-31 19:57:09 +02:00
|
|
|
@echo '#ifndef _ISAL_H_' >> $@
|
|
|
|
@echo '#define _ISAL_H_' >> $@
|
|
|
|
@echo '' >> $@
|
|
|
|
@echo '#define.ISAL_MAJOR_VERSION.${version}' | ${AWK} -F . '{print $$1, $$2, $$3}' >> $@
|
|
|
|
@echo '#define.ISAL_MINOR_VERSION.${version}' | ${AWK} -F . '{print $$1, $$2, $$4}' >> $@
|
|
|
|
@echo '#define.ISAL_PATCH_VERSION.${version}' | ${AWK} -F . '{print $$1, $$2, $$5}' >> $@
|
|
|
|
@echo '#define ISAL_MAKE_VERSION(maj, min, patch) ((maj) * 0x10000 + (min) * 0x100 + (patch))' >> $@
|
|
|
|
@echo '#define ISAL_VERSION ISAL_MAKE_VERSION(ISAL_MAJOR_VERSION, ISAL_MINOR_VERSION, ISAL_PATCH_VERSION)' >> $@
|
|
|
|
@echo '' >> $@
|
|
|
|
@for unit in $(sort $(extern_hdrs)); do echo "#include <isa-l/$$unit>" | sed -e 's;include/;;' >> $@; done
|
|
|
|
@echo '#endif //_ISAL_H_' >> $@
|
|
|
|
|
|
|
|
|
2015-10-22 23:54:34 +02:00
|
|
|
# Target for install
|
|
|
|
prefix = /usr/local
|
2018-09-22 03:14:20 +02:00
|
|
|
man1dir ?= $(prefix)/share/man/man1
|
|
|
|
install_dirs = $(prefix)/lib $(prefix)/include/isa-l $(prefix)/bin $(man1dir)
|
2015-10-22 23:54:34 +02:00
|
|
|
$(install_dirs): ; mkdir -p $@
|
2018-09-22 03:14:20 +02:00
|
|
|
install: $(sort $(extern_hdrs)) | $(install_dirs) $(lib_name) $(so_lib_name) isa-l.h $(bin_PROGRAMS)
|
2015-10-22 23:54:34 +02:00
|
|
|
install -m 644 $(lib_name) $(prefix)/lib/libisal.a
|
|
|
|
install -m 644 $^ $(prefix)/include/isa-l/.
|
2016-08-31 19:57:09 +02:00
|
|
|
install -m 664 isa-l.h $(prefix)/include/.
|
2015-10-22 23:54:34 +02:00
|
|
|
install -m 664 $(so_lib_name) $(prefix)/lib/$(so_lib_ver)
|
|
|
|
(cd $(prefix)/lib && ln -f -s $(so_lib_ver) $(soname) && ln -f -s $(so_lib_ver) $(so_lib_inst))
|
|
|
|
ifeq ($(shell uname),Darwin)
|
|
|
|
(cd $(prefix)/lib && ln -f -s $(so_lib_ver) $(basename $(so_lib_inst)).dylib)
|
2016-09-02 02:53:28 +02:00
|
|
|
which glibtool && glibtool --mode=finish $(prefix)/lib
|
|
|
|
else
|
2015-10-22 23:54:34 +02:00
|
|
|
which libtool && libtool --mode=finish $(prefix)/lib || \
|
|
|
|
echo 'Lib installed at $(prefix)/lib. Run system-dependent programs to add shared lib path.'
|
2016-09-02 02:53:28 +02:00
|
|
|
endif
|
2018-07-10 02:56:26 +02:00
|
|
|
install -m 774 $(bin_PROGRAMS) $(prefix)/bin/.
|
2018-09-22 03:14:20 +02:00
|
|
|
install -m 664 $(dist_man_MANS) $(man1dir)/.
|
2015-10-22 23:54:34 +02:00
|
|
|
|
|
|
|
uninstall:
|
|
|
|
$(RM) $(prefix)/lib/libisal.a
|
|
|
|
$(RM) $(prefix)/lib/$(soname)
|
|
|
|
$(RM) $(prefix)/lib/$(so_lib_ver)
|
|
|
|
$(RM) $(prefix)/lib/$(so_lib_inst)
|
|
|
|
$(RM) -r $(prefix)/include/isa-l
|
|
|
|
$(RM) $(prefix)/include/isa-l.h
|
|
|
|
$(RM) $(prefix)/lib/$(basename $(so_lib_inst)).dylib
|
2018-07-10 02:56:26 +02:00
|
|
|
$(RM) $(prefix)/bin/$(notdir $(bin_PROGRAMS))
|
2018-09-22 03:14:20 +02:00
|
|
|
$(RM) $(man1dir)/$(notdir $(dist_man_MANS))
|
2015-10-22 23:54:34 +02:00
|
|
|
|
|
|
|
# Collect performance data
|
|
|
|
rpt_name = perf_report_$(shell uname -n)_$(shell date +%y%m%d).perf
|
|
|
|
|
|
|
|
perf_report:
|
|
|
|
echo Results for $(rpt_name) >> $(rpt_name)
|
2015-11-18 23:52:20 +01:00
|
|
|
$(MAKE) -f Makefile.unx -k perf | tee -a $(rpt_name)
|
2015-10-22 23:54:34 +02:00
|
|
|
@echo Summary:
|
|
|
|
-grep runtime $(rpt_name)
|
|
|
|
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo Cleaning up
|
2018-11-14 21:05:32 +01:00
|
|
|
@$(RM) -r $(CLEANFILES)
|
2015-10-22 23:54:34 +02:00
|
|
|
|
|
|
|
|
2017-01-12 03:14:23 +01:00
|
|
|
doc: isa-l.h
|
|
|
|
(cat Doxyfile; echo 'PROJECT_NUMBER=$(version)') | doxygen -
|
|
|
|
$(MAKE) -C generated_doc/latex &> generated_doc/latex_build_api.log
|
|
|
|
cp generated_doc/latex/refman.pdf isa-l_api_$(version).pdf
|
2015-10-22 23:54:34 +02:00
|
|
|
|