summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile21
-rw-r--r--lib/build/memset.obin0 -> 1328 bytes
-rw-r--r--lib/string/memset.c14
3 files changed, 35 insertions, 0 deletions
diff --git a/lib/Makefile b/lib/Makefile
new file mode 100644
index 0000000..b44c1f6
--- /dev/null
+++ b/lib/Makefile
@@ -0,0 +1,21 @@
+BUILDDIR=build/${TARGET}
+TARGETDIR=../mainboard/${TARGET}
+
+.if !exists(${TARGETDIR}/conf/mainboard.conf)
+.error 'ERROR: invalid target "${TARGET}"'
+.else
+.include <${TARGETDIR}/conf/mainboard.conf>
+.endif
+
+SRC=\
+ string/memset.c
+
+
+${BUILDDIR}/libc.a: ${SRC}
+ mkdir -p ${BUILDDIR}
+ cd ${BUILDDIR} && ${CROSS_COMPILE}gcc -c ${CFLAGS} ${SRC:%=../../%}
+ cd ${BUILDDIR} && ${CROSS_COMPILE}ar -rcs ${@:T} ${SRC:T:%.c=%.o}
+
+
+clean:
+ rm -rf ${BUILDDIR}
diff --git a/lib/build/memset.o b/lib/build/memset.o
new file mode 100644
index 0000000..a5c0c8c
--- /dev/null
+++ b/lib/build/memset.o
Binary files differ
diff --git a/lib/string/memset.c b/lib/string/memset.c
new file mode 100644
index 0000000..59e3bea
--- /dev/null
+++ b/lib/string/memset.c
@@ -0,0 +1,14 @@
+#include <stddef.h>
+#include <string.h>
+
+void *
+memset(void *s, int c, size_t n)
+{
+ char *xs = s;
+
+ while (n--)
+ *xs++ = c;
+
+ return s;
+}
+