aboutsummaryrefslogtreecommitdiff
path: root/string/Dir.mk
diff options
context:
space:
mode:
authorSzabolcs Nagy <szabolcs.nagy@arm.com>2019-07-18 17:45:08 +0100
committerSzabolcs Nagy <szabolcs.nagy@arm.com>2019-07-22 17:10:41 +0100
commit6b594432c8ac46e71686ea21fad30d1c3f79e65a (patch)
treea89c0b5795abac9123c4505652286465ad9c953e /string/Dir.mk
parentd8114c3bdf5f7cab17dffad0751d0bbf46f4530e (diff)
downloadarm-optimized-routines-6b594432c8ac46e71686ea21fad30d1c3f79e65a.tar.gz
Add a string directory
The string directory is for optimized string functions, currently it is just a skeleton with dummy code.
Diffstat (limited to 'string/Dir.mk')
-rw-r--r--string/Dir.mk51
1 files changed, 51 insertions, 0 deletions
diff --git a/string/Dir.mk b/string/Dir.mk
new file mode 100644
index 0000000..e179642
--- /dev/null
+++ b/string/Dir.mk
@@ -0,0 +1,51 @@
+# Makefile fragment - requires GNU make
+#
+# Copyright (c) 2019, Arm Limited.
+# SPDX-License-Identifier: MIT
+
+string-lib-srcs := $(wildcard $(srcdir)/string/*.[cS])
+string-includes-src := $(wildcard $(srcdir)/string/include/*.h)
+string-includes := $(string-includes-src:$(srcdir)/string/%=build/%)
+string-test-srcs := $(wildcard $(srcdir)/string/test/*.c)
+
+string-libs := \
+ build/lib/libstringlib.so \
+ build/lib/libstringlib.a \
+
+string-tools := \
+ build/bin/test/memcpy \
+
+string-lib-base := $(basename $(string-lib-srcs))
+string-lib-objs := $(string-lib-base:$(srcdir)/%=build/%.o)
+string-test-base := $(basename $(string-test-srcs))
+string-test-objs := $(string-test-base:$(srcdir)/%=build/%.o)
+
+string-objs := \
+ $(string-lib-objs) \
+ $(string-test-objs) \
+
+all-string: $(string-libs) $(string-tools) $(string-includes)
+
+$(string-objs) $(string-objs:%.o=%.os): $(string-includes)
+
+build/lib/libstringlib.so: $(string-lib-objs:%.o=%.os)
+ $(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -shared -o $@ $^
+
+build/lib/libstringlib.a: $(string-lib-objs)
+ rm -f $@
+ $(AR) rc $@ $^
+ $(RANLIB) $@
+
+build/bin/test/%: build/string/test/%.o build/lib/libstringlib.a
+ $(CC) $(CFLAGS_ALL) $(LDFLAGS_ALL) -static -o $@ $^ $(LDLIBS)
+
+build/include/%.h: $(srcdir)/string/include/%.h
+ cp $< $@
+
+build/bin/%.sh: $(srcdir)/string/test/%.sh
+ cp $< $@
+
+check-string: $(string-tools)
+ $(EMULATOR) build/bin/test/memcpy
+
+.PHONY: all-string check-string