From d0d843b7046ced76336604450f8eb78b4decfa09 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Mon, 2 Oct 2023 14:39:43 +0200 Subject: [PATCH] Support installation --- CMakeLists.txt | 2 ++ Makefile | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6622657..4b21447 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,3 +15,5 @@ cmake_minimum_required(VERSION 3.0) project(dynstr C) add_library(${PROJECT_NAME} STATIC "dynstr.c") target_include_directories(${PROJECT_NAME} PUBLIC "include") +install(TARGETS ${PROJECT_NAME}) +install(DIRECTORY include/ TYPE INCLUDE) diff --git a/Makefile b/Makefile index dd3b3e9..784e171 100644 --- a/Makefile +++ b/Makefile @@ -14,6 +14,7 @@ .POSIX: +PREFIX = /usr/local PROJECT = libdynstr.a CFLAGS = -Iinclude DEPS = \ @@ -21,6 +22,14 @@ DEPS = \ all: $(PROJECT) +install: $(PROJECT) + mkdir -p $(PREFIX)/include + cp include/dynstr.h $(PREFIX)/include + chmod 0644 $(PREFIX)/include/dynstr.h + mkdir -p $(PREFIX)/bin + cp $(PROJECT) $(PREFIX)/bin + chmod 0755 $(PREFIX)/bin/$(PROJECT) + clean: rm -f $(DEPS)