summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2025-09-15 20:28:11 -0400
committerpommicket <pommicket@gmail.com>2025-09-15 20:28:11 -0400
commit06e068ea14220903bd95fea94d44fe3f1a918481 (patch)
tree278ce9ab78bda672454dc1de63389337f79b67bd
parentaafaca51cfbdc66a6ff9af52121470f59b9559ac (diff)
Installable library
-rw-r--r--CMakeLists.txt12
-rw-r--r--Makefile3
-rw-r--r--README.md27
3 files changed, 38 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0972a9b..69291e6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,12 +8,16 @@ else()
endif()
-add_library(pom-static STATIC pom.c)
-add_library(pom SHARED pom.c)
+add_library(pom STATIC pom.c)
+add_library(pom-shared SHARED pom.c)
+set_target_properties(pom-shared PROPERTIES OUTPUT_NAME pom)
add_executable(tests tests/errors.c tests/location.c tests/parsing.c tests/interpretation.c tests/main.c)
target_include_directories(tests PRIVATE .)
-target_link_libraries(tests pom-static)
+target_link_libraries(tests pom)
add_executable(read_conf examples/read_conf.c)
target_include_directories(read_conf PRIVATE .)
-target_link_libraries(read_conf pom-static)
+target_link_libraries(read_conf pom)
+install(TARGETS pom pom-shared DESTINATION lib)
+install(FILES pom.pc DESTINATION lib)
+install(FILES pom.h DESTINATION include)
diff --git a/Makefile b/Makefile
index f68e530..0629ef3 100644
--- a/Makefile
+++ b/Makefile
@@ -9,4 +9,7 @@ test: __build
valgrind --exit-on-first-error=yes --error-exitcode=1 --track-origins=yes \
--leak-check=full --show-leak-kinds=all $(BUILD_DIR)/tests
+install: __build
+ $(MAKE) -C $(BUILD_DIR) install
+
.PHONY: __build test
diff --git a/README.md b/README.md
index c808c3d..e9c37fa 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,29 @@
C parser for [POM configuration language](https://pom.computer)
+## About
+
+libpom has
+
+- small size (~20KB code+data)
+- support for custom memory allocation
+- no dependencies other than libc
+
+## Building
+
+Build with
+
+```
+make -j`nproc`
+```
+
+Install with
+```
+sudo make install
+```
+
+You can also do `PROFILE=Debug make` to build with debug information.
+
## Basic usage
```c
@@ -25,6 +48,10 @@ int main(void) {
}
```
+Assuming you have run `make install`, you just need to add `-l:libpom.a` (or `-lpom` to
+use the shared library) to your compiler flags.
+
+
See `examples/` directory for more examples.
## Contributing