diff --git a/convert/BUILD.bazel b/convert/BUILD.bazel index ee554f1..bd2a938 100644 --- a/convert/BUILD.bazel +++ b/convert/BUILD.bazel @@ -28,15 +28,15 @@ cc_library( "convert.c", "convert_1f.c", "convert_1r.c", - "toolbox.c", ], hdrs = [ "convert.h", "data.h", - "defs.h", - "test.h", ], copts = COPTS, + deps = [ + "//lib", + ], ) cc_test( @@ -47,5 +47,6 @@ cc_test( copts = COPTS, deps = [ ":convert", + "//lib", ], ) diff --git a/convert/convert.h b/convert/convert.h index 678ad42..a132958 100644 --- a/convert/convert.h +++ b/convert/convert.h @@ -2,7 +2,7 @@ #define convert_h /* convert.h - character set conversion routines. */ -#include "convert/defs.h" +#include "lib/defs.h" /* Error codes. */ enum diff --git a/convert/convert_1f.c b/convert/convert_1f.c index 474fcef..2408151 100644 --- a/convert/convert_1f.c +++ b/convert/convert_1f.c @@ -1,6 +1,6 @@ /* convert_1f.c - Forward conversion from extended ASCII to UTF-8. */ #include "convert/convert.h" -#include "convert/defs.h" +#include "lib/defs.h" struct Convert1fData { /* Unicode characters, encoded in UTF-8, and packed MSB first. Always either diff --git a/convert/convert_1r.c b/convert/convert_1r.c index cfbab46..68f272b 100644 --- a/convert/convert_1r.c +++ b/convert/convert_1r.c @@ -1,6 +1,6 @@ /* convert_1r.c - Reverse conversion from UTF-8 to extended ASCII. */ #include "convert/convert.h" -#include "convert/defs.h" +#include "lib/defs.h" enum { diff --git a/convert/convert_test.c b/convert/convert_test.c index 4e6fa4d..4382618 100644 --- a/convert/convert_test.c +++ b/convert/convert_test.c @@ -3,7 +3,7 @@ #include "convert/convert.h" #include "convert/data.h" -#include "convert/test.h" +#include "lib/test.h" #include #include diff --git a/convert/data.h b/convert/data.h index 5dd2320..04725d0 100644 --- a/convert/data.h +++ b/convert/data.h @@ -1,7 +1,7 @@ #ifndef data_h #define data_h /* data.h - charmap data, not used for classic Mac OS builds */ -#include "convert/defs.h" +#include "lib/defs.h" /* Get the ID of the given character map. Return NULL if no such character map exists. */ diff --git a/lib/BUILD.bazel b/lib/BUILD.bazel new file mode 100644 index 0000000..163584d --- /dev/null +++ b/lib/BUILD.bazel @@ -0,0 +1,15 @@ +load("@rules_cc//cc:defs.bzl", "cc_library") +load("//bazel:copts.bzl", "COPTS") + +cc_library( + name = "lib", + srcs = [ + "toolbox.c", + ], + hdrs = [ + "defs.h", + "test.h", + ], + copts = COPTS, + visibility = ["//visibility:public"], +) diff --git a/convert/defs.h b/lib/defs.h similarity index 100% rename from convert/defs.h rename to lib/defs.h diff --git a/convert/test.h b/lib/test.h similarity index 93% rename from convert/test.h rename to lib/test.h index 1c8d4cc..a803a16 100644 --- a/convert/test.h +++ b/lib/test.h @@ -2,7 +2,7 @@ #define test_h /* test.h - unit testing definitions. */ -#include "convert/defs.h" +#include "lib/defs.h" /* Print an error message and exit. */ void Dief(const char *msg, ...) __attribute__((noreturn, format(printf, 1, 2))); diff --git a/convert/toolbox.c b/lib/toolbox.c similarity index 96% rename from convert/toolbox.c rename to lib/toolbox.c index b2b643d..184d9a5 100644 --- a/convert/toolbox.c +++ b/lib/toolbox.c @@ -3,8 +3,8 @@ This is used to run conversion tests on non-Mac OS systems to make development easier. These are not intended to make it possible to port the converter to non-Mac OS systems. */ -#include "convert/defs.h" -#include "convert/test.h" +#include "lib/defs.h" +#include "lib/test.h" #include #include