Restore install target
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user