diff --git a/alchitry-loader/Dockerfile b/alchitry-loader/Dockerfile new file mode 100644 index 0000000..7ca2190 --- /dev/null +++ b/alchitry-loader/Dockerfile @@ -0,0 +1,16 @@ +FROM debian:bookworm AS deps + +RUN apt-get update -qq && apt-get install -qq -y --no-install-recommends build-essential + + + +FROM deps AS build + +ADD . /workspace +WORKDIR /workspace + +RUN make loader + + +FROM scratch AS export +COPY --from=build /workspace/loader / diff --git a/alchitry-loader/Makefile b/alchitry-loader/Makefile new file mode 100644 index 0000000..ef5a3c2 --- /dev/null +++ b/alchitry-loader/Makefile @@ -0,0 +1,32 @@ +sources = $(wildcard src/*.cpp) +objects = $(sources:.cpp=.o) +os = $(shell uname -s) +static_libs = lib/$(os)/libftd2xx.a +libs = -lpthread + +CXXFLAGS = -std=c++11 + +export DOCKER_BUILDKIT=1 + +# Assume target is Mac OS if build host is Mac OS; any other host targets Linux +ifeq ($(os), Darwin) + libs += -lobjc -framework IOKit -framework CoreFoundation +else + libs += -lrt +endif + +loader: $(objects) ## build the loader executable + $(CXX) $(LDFLAGS) -o $@ $^ $(static_libs) $(libs) + +build: ## build the loader in docker (linux) + docker build -o . . + +.PHONY: clean +clean: + rm -rf loader $(objects) + +.PHONY: help +help: ## Show this help + @echo Noteworthy targets: + @egrep '^[a-zA-Z_-]+:.*?## .*$$' $(firstword $(MAKEFILE_LIST)) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' +.DEFAULT_GOAL := help diff --git a/alchitry-loader/lib/macos/libftd2xx.a b/alchitry-loader/lib/Darwin/libftd2xx.a similarity index 100% rename from alchitry-loader/lib/macos/libftd2xx.a rename to alchitry-loader/lib/Darwin/libftd2xx.a diff --git a/alchitry-loader/lib/linux/libftd2xx.a b/alchitry-loader/lib/Linux/libftd2xx.a similarity index 100% rename from alchitry-loader/lib/linux/libftd2xx.a rename to alchitry-loader/lib/Linux/libftd2xx.a diff --git a/alchitry-loader/makefile b/alchitry-loader/makefile deleted file mode 100644 index 0cbea0b..0000000 --- a/alchitry-loader/makefile +++ /dev/null @@ -1,24 +0,0 @@ -sources = $(wildcard src/*.cpp) -objects = $(sources:.cpp=.o) -static_libs = lib/macos/libftd2xx.a -libs = -lpthread - -CXXFLAGS = -std=c++11 - -UNAME := $(shell uname) -# Assume target is Mac OS if build host is Mac OS; any other host targets Linux -ifeq ($(UNAME), Darwin) - libs += -lobjc -framework IOKit -framework CoreFoundation -else - libs += -lrt -endif - -all: loader - -loader: $(objects) - $(CXX) $(LDFLAGS) -o $@ $^ $(static_libs) $(libs) - -.PHONY: clean - -clean: - rm -rf loader $(objects)