0928368f62
This adds the Arm Optimized Routines (see https://github.com/ARM-software/optimized-routines) source code under the the LLVM license. The version of the code provided in this patch is v20.02 of the Arm Optimized Routines project. This entire contribution is being committed as is even though it does not currently fit the LLVM libc model and does not follow the LLVM coding style. In the near future, implementations from this patch will be moved over to their right place in the LLVM-libc tree. This will be done over many small patches, all of which will go through the normal LLVM code review process. See this libc-dev post for the plan: http://lists.llvm.org/pipermail/libc-dev/2020-March/000044.html Differential revision of the original upload: https://reviews.llvm.org/D75355
102 lines
2.6 KiB
Makefile
102 lines
2.6 KiB
Makefile
# Makefile fragment - requires GNU make
|
|
#
|
|
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
# See https://llvm.org/LICENSE.txt for license information.
|
|
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
|
|
S := $(srcdir)/string
|
|
B := build/string
|
|
|
|
ifeq ($(ARCH),)
|
|
all-string check-string install-string clean-string:
|
|
@echo "*** Please set ARCH in config.mk. ***"
|
|
@exit 1
|
|
else
|
|
|
|
string-lib-srcs := $(wildcard $(S)/$(ARCH)/*.[cS])
|
|
string-test-srcs := $(wildcard $(S)/test/*.c)
|
|
|
|
string-includes := $(patsubst $(S)/%,build/%,$(wildcard $(S)/include/*.h))
|
|
|
|
string-libs := \
|
|
build/lib/libstringlib.so \
|
|
build/lib/libstringlib.a \
|
|
|
|
string-tools := \
|
|
build/bin/test/memcpy \
|
|
build/bin/test/memmove \
|
|
build/bin/test/memset \
|
|
build/bin/test/memchr \
|
|
build/bin/test/memcmp \
|
|
build/bin/test/strcpy \
|
|
build/bin/test/stpcpy \
|
|
build/bin/test/strcmp \
|
|
build/bin/test/strchr \
|
|
build/bin/test/strrchr \
|
|
build/bin/test/strchrnul \
|
|
build/bin/test/strlen \
|
|
build/bin/test/strnlen \
|
|
build/bin/test/strncmp
|
|
|
|
string-lib-objs := $(patsubst $(S)/%,$(B)/%.o,$(basename $(string-lib-srcs)))
|
|
string-test-objs := $(patsubst $(S)/%,$(B)/%.o,$(basename $(string-test-srcs)))
|
|
|
|
string-objs := \
|
|
$(string-lib-objs) \
|
|
$(string-lib-objs:%.o=%.os) \
|
|
$(string-test-objs) \
|
|
|
|
string-files := \
|
|
$(string-objs) \
|
|
$(string-libs) \
|
|
$(string-tools) \
|
|
$(string-includes) \
|
|
|
|
all-string: $(string-libs) $(string-tools) $(string-includes)
|
|
|
|
$(string-objs): $(string-includes)
|
|
$(string-objs): CFLAGS_ALL += $(string-cflags)
|
|
|
|
build/lib/libstringlib.so: $(string-lib-objs:%.o=%.os)
|
|
$(CC) $(CFLAGS_ALL) $(LDFLAGS) -shared -o $@ $^
|
|
|
|
build/lib/libstringlib.a: $(string-lib-objs)
|
|
rm -f $@
|
|
$(AR) rc $@ $^
|
|
$(RANLIB) $@
|
|
|
|
build/bin/test/%: $(B)/test/%.o build/lib/libstringlib.a
|
|
$(CC) $(CFLAGS_ALL) $(LDFLAGS) -static -o $@ $^ $(LDLIBS)
|
|
|
|
build/include/%.h: $(S)/include/%.h
|
|
cp $< $@
|
|
|
|
build/bin/%.sh: $(S)/test/%.sh
|
|
cp $< $@
|
|
|
|
check-string: $(string-tools)
|
|
$(EMULATOR) build/bin/test/memcpy
|
|
$(EMULATOR) build/bin/test/memmove
|
|
$(EMULATOR) build/bin/test/memset
|
|
$(EMULATOR) build/bin/test/memchr
|
|
$(EMULATOR) build/bin/test/memcmp
|
|
$(EMULATOR) build/bin/test/strcpy
|
|
$(EMULATOR) build/bin/test/stpcpy
|
|
$(EMULATOR) build/bin/test/strcmp
|
|
$(EMULATOR) build/bin/test/strchr
|
|
$(EMULATOR) build/bin/test/strrchr
|
|
$(EMULATOR) build/bin/test/strchrnul
|
|
$(EMULATOR) build/bin/test/strlen
|
|
$(EMULATOR) build/bin/test/strnlen
|
|
$(EMULATOR) build/bin/test/strncmp
|
|
|
|
install-string: \
|
|
$(string-libs:build/lib/%=$(DESTDIR)$(libdir)/%) \
|
|
$(string-includes:build/include/%=$(DESTDIR)$(includedir)/%)
|
|
|
|
clean-string:
|
|
rm -f $(string-files)
|
|
endif
|
|
|
|
.PHONY: all-string check-string install-string clean-string
|