aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-09-26 23:47:06 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-09-27 01:05:04 +0200
commit93153289831a5e67f13488054410a20558719d41 (patch)
tree24f2f58c2724fa18224458d5eaada3958eb4902a
parent8b39bc5db98c252269fe526a8c411bf245770ba2 (diff)
downloadlibweb-93153289831a5e67f13488054410a20558719d41.tar.gz
Makefile, CMakeLists.txt: Add installation targets
-rw-r--r--CMakeLists.txt2
-rw-r--r--Makefile10
2 files changed, 12 insertions, 0 deletions
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