mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
First working command-line executable.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from build.c import clibrary
|
||||
from build.protobuf import proto, protocc
|
||||
|
||||
proto(
|
||||
@@ -23,3 +24,69 @@ proto(
|
||||
"./zilogmcz/zilogmcz.proto",
|
||||
],
|
||||
)
|
||||
|
||||
clibrary(
|
||||
name="arch",
|
||||
srcs=[
|
||||
"./aeslanier/decoder.cc",
|
||||
"./agat/agat.cc",
|
||||
"./agat/decoder.cc",
|
||||
"./agat/encoder.cc",
|
||||
"./amiga/amiga.cc",
|
||||
"./amiga/decoder.cc",
|
||||
"./amiga/encoder.cc",
|
||||
"./apple2/decoder.cc",
|
||||
"./apple2/encoder.cc",
|
||||
"./brother/decoder.cc",
|
||||
"./brother/encoder.cc",
|
||||
"./c64/c64.cc",
|
||||
"./c64/decoder.cc",
|
||||
"./c64/encoder.cc",
|
||||
"./f85/decoder.cc",
|
||||
"./fb100/decoder.cc",
|
||||
"./ibm/decoder.cc",
|
||||
"./ibm/encoder.cc",
|
||||
"./macintosh/decoder.cc",
|
||||
"./macintosh/encoder.cc",
|
||||
"./micropolis/decoder.cc",
|
||||
"./micropolis/encoder.cc",
|
||||
"./mx/decoder.cc",
|
||||
"./northstar/decoder.cc",
|
||||
"./northstar/encoder.cc",
|
||||
"./rolandd20/decoder.cc",
|
||||
"./smaky6/decoder.cc",
|
||||
"./tids990/decoder.cc",
|
||||
"./tids990/encoder.cc",
|
||||
"./victor9k/decoder.cc",
|
||||
"./victor9k/encoder.cc",
|
||||
"./zilogmcz/decoder.cc",
|
||||
],
|
||||
hdrs={
|
||||
"arch/ibm/ibm.h": "./ibm/ibm.h",
|
||||
"arch/apple2/data_gcr.h": "./apple2/data_gcr.h",
|
||||
"arch/apple2/apple2.h": "./apple2/apple2.h",
|
||||
"arch/smaky6/smaky6.h": "./smaky6/smaky6.h",
|
||||
"arch/tids990/tids990.h": "./tids990/tids990.h",
|
||||
"arch/zilogmcz/zilogmcz.h": "./zilogmcz/zilogmcz.h",
|
||||
"arch/amiga/amiga.h": "./amiga/amiga.h",
|
||||
"arch/f85/data_gcr.h": "./f85/data_gcr.h",
|
||||
"arch/f85/f85.h": "./f85/f85.h",
|
||||
"arch/mx/mx.h": "./mx/mx.h",
|
||||
"arch/aeslanier/aeslanier.h": "./aeslanier/aeslanier.h",
|
||||
"arch/northstar/northstar.h": "./northstar/northstar.h",
|
||||
"arch/brother/data_gcr.h": "./brother/data_gcr.h",
|
||||
"arch/brother/brother.h": "./brother/brother.h",
|
||||
"arch/brother/header_gcr.h": "./brother/header_gcr.h",
|
||||
"arch/macintosh/data_gcr.h": "./macintosh/data_gcr.h",
|
||||
"arch/macintosh/macintosh.h": "./macintosh/macintosh.h",
|
||||
"arch/agat/agat.h": "./agat/agat.h",
|
||||
"arch/fb100/fb100.h": "./fb100/fb100.h",
|
||||
"arch/victor9k/data_gcr.h": "./victor9k/data_gcr.h",
|
||||
"arch/victor9k/victor9k.h": "./victor9k/victor9k.h",
|
||||
"arch/rolandd20/rolandd20.h": "./rolandd20/rolandd20.h",
|
||||
"arch/micropolis/micropolis.h": "./micropolis/micropolis.h",
|
||||
"arch/c64/data_gcr.h": "./c64/data_gcr.h",
|
||||
"arch/c64/c64.h": "./c64/c64.h",
|
||||
},
|
||||
deps=["lib", "lib+config_proto_lib", "+protocol"],
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "lib/globals.h"
|
||||
#include "lib/decoders/decoders.h"
|
||||
#include "mx/mx.h"
|
||||
#include "arch/mx/mx.h"
|
||||
#include "lib/crc.h"
|
||||
#include "lib/fluxmap.h"
|
||||
#include "lib/decoders/fluxmapreader.h"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "lib/globals.h"
|
||||
#include "lib/decoders/decoders.h"
|
||||
#include "lib/encoders/encoders.h"
|
||||
#include "tids990/tids990.h"
|
||||
#include "arch/tids990/tids990.h"
|
||||
#include "lib/crc.h"
|
||||
#include "lib/fluxmap.h"
|
||||
#include "lib/decoders/fluxmapreader.h"
|
||||
|
||||
5
build.py
5
build.py
@@ -1,6 +1,11 @@
|
||||
from build.ab import export
|
||||
from build.c import clibrary
|
||||
from build.protobuf import proto, protocc
|
||||
from build.pkg import package
|
||||
|
||||
package(name="protobuf_lib", package="protobuf")
|
||||
package(name="z_lib", package="zlib")
|
||||
package(name="fmt_lib", package="fmt")
|
||||
|
||||
clibrary(name="protocol", hdrs={"protocol.h": "./protocol.h"})
|
||||
|
||||
|
||||
@@ -243,11 +243,11 @@ def targetof(s, cwd):
|
||||
t.materialise()
|
||||
return t
|
||||
|
||||
if s.startswith("+"):
|
||||
s = cwd + s
|
||||
if s.startswith("./"):
|
||||
if s.startswith(".+"):
|
||||
s = cwd + s[1:]
|
||||
elif s.startswith("./"):
|
||||
s = normpath(join(cwd, s))
|
||||
if s.startswith("$"):
|
||||
elif s.startswith("$"):
|
||||
return fileinvocation(s)
|
||||
|
||||
if "+" not in s:
|
||||
|
||||
15
build/c.py
15
build/c.py
@@ -97,6 +97,7 @@ def clibrary(
|
||||
"clibrary contains no sources and no exported headers"
|
||||
)
|
||||
|
||||
ldflags = []
|
||||
libraries = [d for d in deps if hasattr(d, "clibrary")]
|
||||
for library in libraries:
|
||||
if library.clibrary.cflags:
|
||||
@@ -124,7 +125,7 @@ def clibrary(
|
||||
i = i + 1
|
||||
|
||||
if srcs:
|
||||
nr = None
|
||||
hr = None
|
||||
if hdrcs:
|
||||
hr = normalrule(
|
||||
name=f"{name}_hdrs",
|
||||
@@ -151,7 +152,7 @@ def clibrary(
|
||||
commands=commands if actualsrcs else [],
|
||||
)
|
||||
|
||||
self.clibrary.ldflags = []
|
||||
self.clibrary.ldflags = ldflags
|
||||
self.clibrary.cflags = ["-I" + hr.normalrule.objdir] if hr else []
|
||||
else:
|
||||
r = normalrule(
|
||||
@@ -163,7 +164,7 @@ def clibrary(
|
||||
)
|
||||
r.materialise()
|
||||
|
||||
self.clibrary.ldflags = []
|
||||
self.clibrary.ldflags = ldflags
|
||||
self.clibrary.cflags = ["-I" + r.normalrule.objdir]
|
||||
|
||||
|
||||
@@ -201,7 +202,9 @@ def cprogram(
|
||||
deps: Targets = [],
|
||||
cflags=[],
|
||||
ldflags=[],
|
||||
commands=["$(CC) -o {outs[0]} {ins} {ldflags}"],
|
||||
commands=[
|
||||
"$(CC) -o {outs[0]} -Wl,--start-group {ins} -Wl,--end-group {ldflags}"
|
||||
],
|
||||
label="CLINK",
|
||||
):
|
||||
programimpl(
|
||||
@@ -226,7 +229,9 @@ def cxxprogram(
|
||||
deps: Targets = [],
|
||||
cflags=[],
|
||||
ldflags=[],
|
||||
commands=["$(CXX) -o {outs[0]} {ins} {ldflags}"],
|
||||
commands=[
|
||||
"$(CXX) -o {outs[0]} -Wl,--start-group {ins} -Wl,--end-group {ldflags}"
|
||||
],
|
||||
label="CXXLINK",
|
||||
):
|
||||
programimpl(
|
||||
|
||||
@@ -22,10 +22,10 @@ def package(self, name, package=None, fallback: Target = None):
|
||||
emit(f"$(error Required package '{package}' not installed.)")
|
||||
emit("else")
|
||||
emit(
|
||||
f"PACKAGE_CFLAGS_{package} := $(shell $(PKG_CONFIG) --cflags {package}"
|
||||
f"PACKAGE_CFLAGS_{package} := $(shell $(PKG_CONFIG) --cflags {package})"
|
||||
)
|
||||
emit(
|
||||
f"PACKAGE_LDFLAGS_{package} := $(shell $(PKG_CONFIG) --ldflags {package}"
|
||||
f"PACKAGE_LDFLAGS_{package} := $(shell $(PKG_CONFIG) --libs {package})"
|
||||
)
|
||||
emit(f"PACKAGE_DEP_{package} := ")
|
||||
emit("endif")
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import platform
|
||||
|
||||
windows = platform.system() == "Windows"
|
||||
osx = platform.system() == "Darwin"
|
||||
unix = not windows
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from build.c import clibrary
|
||||
from build.pkg import package
|
||||
from config import windows, osx, unix
|
||||
|
||||
clibrary(
|
||||
name="libusbp",
|
||||
srcs = [
|
||||
"./src/async_in_pipe.c",
|
||||
"./src/error.c",
|
||||
@@ -13,8 +13,52 @@ clibrary(
|
||||
"./src/libusbp_internal.h",
|
||||
"./include/libusbp_config.h",
|
||||
"./include/libusbp.h",
|
||||
],
|
||||
]
|
||||
deps = []
|
||||
|
||||
if windows:
|
||||
srcs += [
|
||||
"./src/windows/async_in_transfer_windows.c",
|
||||
"./src/windows/device_instance_id_windows.c",
|
||||
"./src/windows/device_windows.c",
|
||||
"./src/windows/error_windows.c",
|
||||
"./src/windows/generic_handle_windows.c",
|
||||
"./src/windows/generic_interface_windows.c",
|
||||
"./src/windows/interface_windows.c",
|
||||
"./src/windows/list_windows.c",
|
||||
"./src/windows/serial_port_windows.c",
|
||||
]
|
||||
elif osx:
|
||||
srcs += [
|
||||
"./src/mac/async_in_transfer_mac.c",
|
||||
"./src/mac/device_mac.c",
|
||||
"./src/mac/error_mac.c",
|
||||
"./src/mac/generic_handle_mac.c",
|
||||
"./src/mac/generic_interface_mac.c",
|
||||
"./src/mac/iokit_mac.c",
|
||||
"./src/mac/list_mac.c",
|
||||
"./src/mac/serial_port_mac.c",
|
||||
]
|
||||
else:
|
||||
package(name="udev_lib", package="libudev")
|
||||
srcs += [
|
||||
"./src/linux/async_in_transfer_linux.c",
|
||||
"./src/linux/device_linux.c",
|
||||
"./src/linux/error_linux.c",
|
||||
"./src/linux/generic_handle_linux.c",
|
||||
"./src/linux/generic_interface_linux.c",
|
||||
"./src/linux/list_linux.c",
|
||||
"./src/linux/serial_port_linux.c",
|
||||
"./src/linux/udev_linux.c",
|
||||
"./src/linux/usbfd_linux.c",
|
||||
]
|
||||
deps += [".+udev_lib"]
|
||||
|
||||
clibrary(
|
||||
name="libusbp",
|
||||
srcs=srcs,
|
||||
cflags=["-Idep/libusbp/include", "-Idep/libusbp/src"],
|
||||
deps=deps,
|
||||
hdrs={
|
||||
"libusbp_internal.h": "./src/libusbp_internal.h",
|
||||
"libusbp_config.h": "./include/libusbp_config.h",
|
||||
|
||||
@@ -99,6 +99,7 @@ clibrary(
|
||||
"lib/bitmap.h": "./bitmap.h",
|
||||
"lib/bytes.h": "./bytes.h",
|
||||
"lib/config.h": "./config.h",
|
||||
"lib/crc.h": "./crc.h",
|
||||
"lib/csvreader.h": "./csvreader.h",
|
||||
"lib/decoders/decoders.h": "./decoders/decoders.h",
|
||||
"lib/decoders/fluxdecoder.h": "./decoders/fluxdecoder.h",
|
||||
@@ -115,6 +116,7 @@ clibrary(
|
||||
"lib/image.h": "./image.h",
|
||||
"lib/imagereader/imagereader.h": "./imagereader/imagereader.h",
|
||||
"lib/imagewriter/imagewriter.h": "./imagewriter/imagewriter.h",
|
||||
"lib/layout.h": "./layout.h",
|
||||
"lib/proto.h": "./proto.h",
|
||||
"lib/readerwriter.h": "./readerwriter.h",
|
||||
"lib/sector.h": "./sector.h",
|
||||
@@ -125,7 +127,7 @@ clibrary(
|
||||
},
|
||||
deps=[
|
||||
"+fl2_proto_lib",
|
||||
"+config_proto_lib",
|
||||
".+config_proto_lib",
|
||||
"dep/libusbp",
|
||||
"dep/adflib",
|
||||
"dep/fatfs",
|
||||
@@ -150,7 +152,7 @@ proto(
|
||||
"./usb/usb.proto",
|
||||
"./vfs/vfs.proto",
|
||||
],
|
||||
deps=["+common_proto"],
|
||||
deps=[".+common_proto"],
|
||||
)
|
||||
|
||||
protocc(name="config_proto_lib", srcs=["+config_proto", "arch+arch_proto"])
|
||||
protocc(name="config_proto_lib", srcs=[".+config_proto", "arch+arch_proto"])
|
||||
|
||||
@@ -30,7 +30,11 @@ cxxprogram(
|
||||
cflags=["-I."],
|
||||
deps=[
|
||||
"+fl2_proto_lib",
|
||||
"+fmt_lib",
|
||||
"+protobuf_lib",
|
||||
"+protocol",
|
||||
"+z_lib",
|
||||
"arch",
|
||||
"dep/adflib",
|
||||
"dep/agg",
|
||||
"dep/fatfs",
|
||||
@@ -39,5 +43,6 @@ cxxprogram(
|
||||
"dep/stb",
|
||||
"lib",
|
||||
"lib+config_proto_lib",
|
||||
"src/formats",
|
||||
],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user