Makefile: Add install target

tight-png
Andri Yngvason 2019-09-07 17:10:37 +00:00
parent 6046949726
commit 5aea8a61ed
2 changed files with 17 additions and 0 deletions

View File

@ -18,6 +18,10 @@ OBJECTS += $(BUILD_DIR)/miniz.o
DSO_PATH := $(BUILD_DIR)/$(DSO_NAME)
DSO := $(DSO_PATH).so.$(DSO_MAJOR).$(DSO_MINOR)
ifndef DONT_STRIP
INSTALL_STRIP := -s --strip-program=$(STRIP)
endif
$(DSO): $(OBJECTS)
$(LINK_DSO)
ln -sf $(DSO_NAME).so.$(DSO_MAJOR).$(DSO_MINOR) $(DSO_PATH).so.$(DSO_MINOR)
@ -37,6 +41,11 @@ $(BENCH_DIR)/zrle-bench: $(OBJECTS) $(BUILD_DIR)/pngfb.o \
$(BENCH_DIR)/zrle-bench.o
$(LINK_EXE) $(shell pkg-config --libs libpng)
.PHONY: install
install: $(DSO)
install $(INSTALL_STRIP) -Dt $(DESTDIR)$(PREFIX)/lib $(BUILD_DIR)/*.so*
install -Dt $(DESTDIR)$(PREFIX)/include inc/neatvnc.h
.PHONY: bench
bench: $(BENCH_DIR)/zrle-bench
./$(BENCH_DIR)/zrle-bench

View File

@ -2,6 +2,8 @@ MACHINE := $(shell $(CC) -dumpmachine)
ARCH := $(firstword $(subst -, ,$(MACHINE)))
BUILD_DIR ?= build-$(MACHINE)
PREFIX ?= /usr/local
ifeq ($(ARCH),x86_64)
ARCH_CFLAGS := -mavx
else
@ -10,6 +12,12 @@ ifeq ($(ARCH),arm)
endif # end arm block
endif # end x86_64 block
ifeq (, $(shell which $(MACHINE)-strip 2>/dev/null))
STRIP := strip
else
STRIP := $(MACHINE)-strip
endif
CFLAGS ?= -g -O3 $(ARCH_CFLAGS) -flto -DNDEBUG
LDFLAGS ?= -flto