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_PATH := $(BUILD_DIR)/$(DSO_NAME)
DSO := $(DSO_PATH).so.$(DSO_MAJOR).$(DSO_MINOR) DSO := $(DSO_PATH).so.$(DSO_MAJOR).$(DSO_MINOR)
ifndef DONT_STRIP
INSTALL_STRIP := -s --strip-program=$(STRIP)
endif
$(DSO): $(OBJECTS) $(DSO): $(OBJECTS)
$(LINK_DSO) $(LINK_DSO)
ln -sf $(DSO_NAME).so.$(DSO_MAJOR).$(DSO_MINOR) $(DSO_PATH).so.$(DSO_MINOR) 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 $(BENCH_DIR)/zrle-bench.o
$(LINK_EXE) $(shell pkg-config --libs libpng) $(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 .PHONY: bench
bench: $(BENCH_DIR)/zrle-bench bench: $(BENCH_DIR)/zrle-bench
./$(BENCH_DIR)/zrle-bench ./$(BENCH_DIR)/zrle-bench

View File

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