diff --git a/Makefile b/Makefile index b8e248c..db8c3f6 100644 --- a/Makefile +++ b/Makefile @@ -8,3 +8,4 @@ include make/libmsl.mk include make/liballoc.mk include make/libterminal.mk include make/libprocess.mk +include make/libstring.mk diff --git a/aux/devel.sh b/aux/devel.sh index f8cd000..c4b591d 100755 --- a/aux/devel.sh +++ b/aux/devel.sh @@ -12,6 +12,7 @@ make -B all_libmsl make -B all_liballoc make -B all_libprocess make -B all_libterminal +make -B all_libstring make -B all_apps make -B all_dist ./aux/limine_iso_amd64.sh diff --git a/aux/format.sh b/aux/format.sh index 71bd892..39811ea 100755 --- a/aux/format.sh +++ b/aux/format.sh @@ -7,4 +7,5 @@ make -B format_libmsl make -B format_libterminal make -B format_libprocess make -B format_liballoc +make -B format_libstring make -B format_apps diff --git a/init/Makefile b/init/Makefile index 0efb681..ba46368 100644 --- a/init/Makefile +++ b/init/Makefile @@ -3,5 +3,6 @@ include ../make/ufuncs.mk $(eval $(call add_lib,libterminal)) $(eval $(call add_lib,liballoc)) $(eval $(call add_lib,libprocess)) +$(eval $(call add_lib,libstring)) include ../make/user.mk diff --git a/init/init.c b/init/init.c index a629dee..32d5291 100644 --- a/init/init.c +++ b/init/init.c @@ -2,7 +2,7 @@ #include #include #include -#include +#include #include #define MUTEX 2000 diff --git a/libmsl/src.mk b/libmsl/src.mk index 2d7c2af..b61f45d 100644 --- a/libmsl/src.mk +++ b/libmsl/src.mk @@ -1,4 +1,3 @@ include $(platform)/src.mk include init/src.mk include m/src.mk -include string/src.mk diff --git a/libmsl/string/src.mk b/libmsl/string/src.mk deleted file mode 100644 index c3ea4f1..0000000 --- a/libmsl/string/src.mk +++ /dev/null @@ -1,3 +0,0 @@ -c += string/string.c - -o += string/string.o diff --git a/libmsl/string/.gitignore b/libstring/.gitignore similarity index 100% rename from libmsl/string/.gitignore rename to libstring/.gitignore diff --git a/libstring/Makefile b/libstring/Makefile new file mode 100644 index 0000000..598af92 --- /dev/null +++ b/libstring/Makefile @@ -0,0 +1,28 @@ +cc := clang +o := +c := +cflags := -isystem . -isystem ../libmsl +buildtype ?= release + +include src.mk +include ../generic/flags.mk +include ../$(platform)/flags.mk + +all: build/libstring.a + +build/libstring.a: $(o) + llvm-ar rcs $@ $^ + +%.o: %.c + $(cc) -c -o $@ $(cflags) $< + +%.o: %.S + $(cc) -c -o $@ $(cflags) $< + +clean: + rm -f $(o) build/libstring.a + +format: + clang-format -i $$(git ls-files '*.c' '*.h') + +.PHONY: all clean format diff --git a/libstring/src.mk b/libstring/src.mk new file mode 100644 index 0000000..a4a67c9 --- /dev/null +++ b/libstring/src.mk @@ -0,0 +1,3 @@ +c += string.c + +o += string.o diff --git a/libmsl/string/string.c b/libstring/string.c similarity index 97% rename from libmsl/string/string.c rename to libstring/string.c index 76ca357..5abfd33 100644 --- a/libmsl/string/string.c +++ b/libstring/string.c @@ -1,6 +1,6 @@ #include #include -#include +#include size_t memset (void* dst, uint8_t b, size_t n) { uint8_t* dst1 = dst; diff --git a/libmsl/string/string.h b/libstring/string.h similarity index 74% rename from libmsl/string/string.h rename to libstring/string.h index f679a13..3ab38ca 100644 --- a/libmsl/string/string.h +++ b/libstring/string.h @@ -1,5 +1,5 @@ -#ifndef _LIBMSL_STRING_STRING_H -#define _LIBMSL_STRING_STRING_H +#ifndef _LIBSTRING_STRING_H +#define _LIBSTRING_STRING_H #include #include @@ -10,4 +10,4 @@ void strncpy (char* dst, const char* src, size_t n); size_t strlen (const char* str); int memcmp (const void* s1, const void* s2, size_t n); -#endif // _LIBMSL_STRING_STRING_H +#endif // _LIBSTRING_STRING_H diff --git a/make/libstring.mk b/make/libstring.mk new file mode 100644 index 0000000..7323c95 --- /dev/null +++ b/make/libstring.mk @@ -0,0 +1,10 @@ +all_libstring: + make -C libstring platform=$(platform) all + +clean_libstring: + make -C libstring platform=$(platform) clean + +format_libstring: + make -C libstring platform=$(platform) format + +.PHONY: all_libstring clean_libstring format_libstring