From 73836e04160123e28b8c39edbf6de5a4896f251d Mon Sep 17 00:00:00 2001 From: Uladzimir Karpenka Date: Thu, 25 Jun 2026 14:08:22 +0300 Subject: [PATCH] Restore install target --- INSTALL | 20 +++++++++++++++----- Makefile | 30 +++++++++++++++++++++++++++++- README | 3 +++ 3 files changed, 47 insertions(+), 6 deletions(-) diff --git a/INSTALL b/INSTALL index e9e5baf..7e0720b 100644 --- a/INSTALL +++ b/INSTALL @@ -1,8 +1,7 @@ INSTALLATION INSTRUCTIONS -To build and install the libfec libraries, simply say +To build and install the libfec libraries for the host platform, say -./configure make make test (optional) make install (as root) @@ -11,6 +10,19 @@ By default, "make install" puts the libfec libraries in /usr/local/lib, the include files in /usr/local/include, and the manual page in /usr/local/man. +To build a specific platform target, use one of: + +make linux +make macos +make windows + +Use DESTDIR for staged packaging installs, for example: + +make install DESTDIR=/tmp/libfec-package + +You can override prefix, libdir, includedir and mandir on the make +command line. + You may have an old version of the GNU assembler that cannot handle the relatively new SSE2 mnemonics. Update your version of the GNU "binutils" package. @@ -22,8 +34,7 @@ http://sources.redhat.com/binutils/ TESTING THE FEC LIBRARY -After running the ./configure script, optional tests can be built and -run as follows: +Optional native tests can be built and run as follows: make test @@ -36,4 +47,3 @@ broken. Phil Karn, karn@ka9q.net - diff --git a/Makefile b/Makefile index 54dad8d..b0d62ab 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ # make windows build Windows libraries (cross-build on Linux/macOS) # make static build only the static library # make shared build only the shared library +# make install install libraries, header and man pages # make clean remove obj/ and lib/ ifeq ($(OS),Windows_NT) @@ -18,6 +19,13 @@ endif BUILD ?= $(HOST_OS) +prefix ?= /usr/local +exec_prefix ?= $(prefix) +libdir ?= $(exec_prefix)/lib +includedir ?= $(prefix)/include +mandir ?= $(prefix)/man +INSTALL ?= install + OBJROOT := obj OUTROOT := lib OBJDIR := $(OBJROOT)/$(BUILD) @@ -45,6 +53,7 @@ ifeq ($(BUILD),windows) IMPORT_LIB := $(OUTDIR)/libfec.dll.a SHARED_FLAGS := -shared -Wl,--out-implib,$(IMPORT_LIB) PIC_CFLAGS := + REBIND := else ifeq ($(BUILD),linux) ifeq ($(origin CC),default) CC := gcc @@ -59,6 +68,7 @@ else ifeq ($(BUILD),linux) IMPORT_LIB := SHARED_FLAGS := -shared -Wl,-soname,libfec.so PIC_CFLAGS := -fPIC + REBIND := ldconfig else ifeq ($(BUILD),macos) ifeq ($(origin CC),default) CC := cc @@ -73,6 +83,7 @@ else ifeq ($(BUILD),macos) IMPORT_LIB := SHARED_FLAGS := -dynamiclib -install_name libfec.dylib PIC_CFLAGS := -fPIC + REBIND := else $(error Unsupported BUILD='$(BUILD)'; use BUILD=linux, BUILD=macos or BUILD=windows) endif @@ -89,6 +100,7 @@ HOSTCFLAGS ?= -O2 STATIC_LIB := $(OUTDIR)/libfec.a TEST_EXEEXT := $(if $(filter windows,$(BUILD)),.exe) +INSTALL_LIBS := $(STATIC_LIB) $(SHARED_LIB) $(IMPORT_LIB) SOURCES := \ cpu_mode_generic.c fec.c sim.c \ @@ -117,12 +129,28 @@ HOST_GEN_OBJECTS := $(TOOLDIR)/gen_ccsds.o $(TOOLDIR)/init_rs_char.o .DEFAULT_GOAL := all .SECONDARY: $(TEST_OBJECTS) -.PHONY: all build linux macos windows static shared test check-tools clean +.PHONY: all build linux macos windows static shared install test check-tools clean all: build build: check-tools static shared static: $(STATIC_LIB) shared: $(SHARED_LIB) +install: build + mkdir -p $(DESTDIR)$(libdir) + $(INSTALL) -m 644 -p $(INSTALL_LIBS) $(DESTDIR)$(libdir) +ifneq ($(REBIND),) +ifneq ($(DESTDIR),) + @echo "Skipping $(REBIND) for staged install under DESTDIR=$(DESTDIR)" +else ifeq ($(BUILD),$(HOST_OS)) + $(REBIND) +else + @echo "Skipping $(REBIND) for cross install BUILD=$(BUILD)" +endif +endif + mkdir -p $(DESTDIR)$(includedir) + $(INSTALL) -m 644 -p fec.h $(DESTDIR)$(includedir) + mkdir -m 0755 -p $(DESTDIR)$(mandir)/man3 + $(INSTALL) -m 644 -p simd-viterbi.3 rs.3 dsp.3 $(DESTDIR)$(mandir)/man3 ifeq ($(BUILD),$(HOST_OS)) test: $(TEST_PROGRAMS) $(OUTDIR)/vtest27$(TEST_EXEEXT) -e 3.0 -n 1000 -v diff --git a/README b/README index f20cec2..95306c2 100644 --- a/README +++ b/README @@ -111,6 +111,9 @@ The resulting files are in lib/linux/, lib/macos/ or lib/windows/. Use `make static` or `make shared` to build only one library type, and `make clean` to remove all generated files. +Use `make install` to install under /usr/local, or pass `DESTDIR` and the +standard `prefix`, `libdir`, `includedir` or `mandir` variables for packaging. + To build and run the native test programs: make test