From 93153289831a5e67f13488054410a20558719d41 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Tue, 26 Sep 2023 23:47:06 +0200 Subject: Makefile, CMakeLists.txt: Add installation targets --- CMakeLists.txt | 2 ++ Makefile | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 093cf1f..bbe1afc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,8 @@ add_library(${PROJECT_NAME} add_subdirectory(dynstr) target_include_directories(${PROJECT_NAME} PUBLIC include) target_link_libraries(${PROJECT_NAME} PUBLIC dynstr) +install(TARGETS ${PROJECT_NAME}) +install(DIRECTORY include/slweb TYPE INCLUDE) if(BUILD_EXAMPLES) add_subdirectory(examples) diff --git a/Makefile b/Makefile index c9a29e8..283c005 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ .POSIX: PROJECT = libslweb.a +PREFIX = /usr/local +DST = $(PREFIX)/lib O = -Og CDEFS = -D_FILE_OFFSET_BITS=64 # Required for large file support on 32-bit. CFLAGS = $(O) $(CDEFS) -g -Iinclude -Idynstr/include -MD -MF $(@:.o=.d) @@ -14,6 +16,14 @@ OBJECTS = \ all: $(PROJECT) +install: all + mkdir -p $(PREFIX)/include + cp -R include/slweb $(PREFIX)/include + chmod 0644 $(PREFIX)/include/slweb/*.h + mkdir -p $(DST) + cp $(PROJECT) $(DST) + chmod 0755 $(DST)/$(PROJECT) + clean: rm -f $(OBJECTS) $(DEPS) +cd examples && $(MAKE) clean -- cgit v1.2.3