diff --git a/Makefile b/Makefile index 1a9d3089..427f4ecf 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -export BUILDTYPE BUILDTYPE ?= host +export BUILDTYPE ifeq ($(BUILDTYPE),windows) MINGW = i686-w64-mingw32- diff --git a/build/c.py b/build/c.py index 3ec4c548..76e54f29 100644 --- a/build/c.py +++ b/build/c.py @@ -17,6 +17,8 @@ class Toolchain: cxxfile = ["$(CXX) -c -o {outs[0]} {ins[0]} $(CFLAGS) {cflags}"] clibrary = ["$(AR) cqs {outs[0]} {ins}"] cxxlibrary = ["$(AR) cqs {outs[0]} {ins}"] + clibraryt = ["$(AR) cqsT {outs[0]} {ins}"] + cxxlibraryt = ["$(AR) cqsT {outs[0]} {ins}"] cprogram = ["$(CC) -o {outs[0]} {ins} {ldflags} $(LDFLAGS)"] cxxprogram = ["$(CXX) -o {outs[0]} {ins} {ldflags} $(LDFLAGS)"] @@ -27,6 +29,8 @@ class HostToolchain: cxxfile = ["$(HOSTCXX) -c -o {outs[0]} {ins[0]} $(HOSTCFLAGS) {cflags}"] clibrary = ["$(HOSTAR) cqs {outs[0]} {ins}"] cxxlibrary = ["$(HOSTAR) cqs {outs[0]} {ins}"] + clibraryt = ["$(HOSTAR) cqs {outs[0]} {ins}"] + cxxlibraryt = ["$(HOSTAR) cqs {outs[0]} {ins}"] cprogram = ["$(HOSTCC) -o {outs[0]} {ins} {ldflags} $(HOSTLDFLAGS)"] cxxprogram = ["$(HOSTCXX) -o {outs[0]} {ins} {ldflags} $(HOSTLDFLAGS)"] @@ -44,7 +48,7 @@ def cfileimpl(self, name, srcs, deps, suffix, commands, label, kind, cflags): t = simplerule( replaces=self, ins=srcs, - deps=hdr_deps, + deps=sorted(hdr_deps), outs=[outleaf], label=label, commands=commands, @@ -312,7 +316,7 @@ def programimpl( label, filerule, kind, - libkind, + libaggrule, ): cfiles = findsources( self.localname, srcs, deps, cflags, toolchain, filerule, self.cwd @@ -326,11 +330,21 @@ def programimpl( targets=lib_deps, name="caller_ldflags", initial=ldflags ) + if len(libs) > 1: + libs = [ + simplerule( + name=f"{self.localname}_libs", + ins=libs, + outs=[f"={self.localname}.a"], + commands=libaggrule, + label="LIBT", + ) + ] + simplerule( replaces=self, - ins=cfiles + libs + libs, + ins=cfiles + libs, outs=[f"={self.localname}$(EXT)"], - deps=lib_deps, label=toolchain.label + label, commands=commands, args={ @@ -367,7 +381,7 @@ def cprogram( label, cfile, "cprogram", - "clibrary", + toolchain.clibraryt, ) @@ -397,5 +411,5 @@ def cxxprogram( label, cxxfile, "cxxprogram", - "cxxlibrary", + toolchain.cxxlibraryt, ) diff --git a/lib/build.py b/lib/build.py index e992b0e5..706ac453 100644 --- a/lib/build.py +++ b/lib/build.py @@ -30,7 +30,6 @@ name="config_proto", srcs=[ "./config.proto", - "./decoders/decoders.proto", "./imagereader/imagereader.proto", "./imagewriter/imagewriter.proto", ], @@ -44,6 +43,7 @@ "lib/vfs+proto", "lib/usb+proto", "lib/encoders+proto", + "lib/decoders+proto", ], ) @@ -56,6 +56,7 @@ "lib/vfs+proto_lib", "lib/usb+proto_lib", "lib/encoders+proto_lib", + "lib/decoders+proto_lib", "lib+drive_proto_lib", ], ) diff --git a/lib/decoders/build.py b/lib/decoders/build.py new file mode 100644 index 00000000..386248ca --- /dev/null +++ b/lib/decoders/build.py @@ -0,0 +1,12 @@ +from build.protobuf import proto, protocc + +proto( + name="proto", + srcs=["./decoders.proto"], + deps=["lib+common_proto", "arch+proto", "lib/fluxsink+proto"], +) +protocc( + name="proto_lib", + srcs=[".+proto"], + deps=["lib+common_proto_lib", "arch+proto_lib", "lib/fluxsink+proto_lib"], +) diff --git a/tests/build.py b/tests/build.py index 772b3c83..eee064e8 100644 --- a/tests/build.py +++ b/tests/build.py @@ -96,6 +96,7 @@ "dep/libusbp", "dep/snowhouse", "dep/stb", + "arch+proto_lib", "lib+config_proto_lib", "src/formats", ]