From df7a3d8175b227530486a00f923d789e45d1c546 Mon Sep 17 00:00:00 2001 From: Dangerous Devices Date: Mon, 1 May 2023 15:38:18 -0400 Subject: [PATCH] Patched to build shared library and install it --- Makefile | 57 +++++++++++++++++++++++++++++++++++++++++++++---------- README.md | 6 ++++++ 2 files changed, 53 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index e1f3e0a..a5eaae3 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,33 @@ -CFLAGS = -O3 -ggdb3 -fsanitize=address +CFLAGS = -O3 -ggdb3 -fsanitize=address -fPIC CPPFLAGS = -std=c11 -I. -LDFLAGS = -lm -fsanitize=address +LDFLAGS = -L. -lm -lft8 -fsanitize=address +PREFIX ?= /usr +LIBDIR := ${PREFIX}/lib/x86_64-linux-gnu -TARGETS = gen_ft8 decode_ft8 test +# The shared library and it's parts +ft8lib := libft8.so +ft8lib_hdrs += ft8/constants.h +ft8lib_hdrs += ft8/crc.h +ft8lib_hdrs += ft8/decode.h +ft8lib_hdrs += ft8/encode.h +ft8lib_hdrs += ft8/ldpc.h +ft8lib_hdrs += ft8/pack.h +ft8lib_hdrs += ft8/text.h +ft8lib_hdrs += ft8/unpack.h + +ft8lib_objs += common/wave.o +ft8lib_objs += fft/kiss_fft.o +ft8lib_objs += fft/kiss_fftr.o +ft8lib_objs += ft8/constants.o +ft8lib_objs += ft8/crc.o +ft8lib_objs += ft8/decode.o +ft8lib_objs += ft8/encode.o +ft8lib_objs += ft8/text.o +ft8lib_objs += ft8/pack.o +ft8lib_objs += ft8/ldpc.o +ft8lib_objs += ft8/unpack.o + +TARGETS = ${ft8lib} gen_ft8 decode_ft8 test .PHONY: run_tests all clean @@ -11,17 +36,29 @@ all: $(TARGETS) run_tests: test @./test -gen_ft8: gen_ft8.o ft8/constants.o ft8/text.o ft8/pack.o ft8/encode.o ft8/crc.o common/wave.o +decode_ft8.o gen_ft8.o: ${ft8lib} #install + +gen_ft8: gen_ft8.o $(CXX) $(LDFLAGS) -o $@ $^ -test: test.o ft8/pack.o ft8/encode.o ft8/crc.o ft8/text.o ft8/constants.o fft/kiss_fftr.o fft/kiss_fft.o +test: test.o $(CXX) $(LDFLAGS) -o $@ $^ -decode_ft8: decode_ft8.o fft/kiss_fftr.o fft/kiss_fft.o ft8/decode.o ft8/encode.o ft8/crc.o ft8/ldpc.o ft8/unpack.o ft8/text.o ft8/constants.o common/wave.o - $(CXX) $(LDFLAGS) -o $@ $^ +decode_ft8: decode_ft8.o + $(CXX) $(LDFLAGS) -lft8 -o $@ $^ clean: - rm -f *.o ft8/*.o common/*.o fft/*.o $(TARGETS) + rm -f ${ft8lib} *.o ft8/*.o common/*.o fft/*.o $(TARGETS) *.a + install: - $(AR) rc libft8.a ft8/constants.o ft8/encode.o ft8/pack.o ft8/text.o common/wave.o - install libft8.a /usr/lib/libft8.a +# $(AR) rc libft8.a ${ft8lib_objs} +# install -m 0644 libft8.a ${LIBDIR}/lib/libft8.a + install -d ${PREFIX}/include/ft8 + install -m 0644 ${ft8lib_hdrs} ${PREFIX}/include/ft8 + install -m 0644 libft8.so ${LIBDIR}/libft8.so + install -m 0755 gen_ft8 ${PREFIX}/bin/genft8 + install -m 0755 decode_ft8 ${PREFIX}/bin/decode_ft8 + +# Build the shared library +${ft8lib}: ${ft8lib_objs} + ${CXX} -shared -Wl,-soname,$@ -o $@ $^ diff --git a/README.md b/README.md index 4ebe25d..4484c16 100644 --- a/README.md +++ b/README.md @@ -52,3 +52,9 @@ Of course in moments of frustration I have looked up the original WSJT-X code, w Karlis Goba, YL3JG + +------ +This has been patched by Dangerous Devices / Pripyat Automations to build as +usable shared library. + +I'll try to keep it up to day!.