diff options
| author | Tadas Vilkeliskis <vilkeliskis.t@gmail.com> | 2026-06-11 21:09:47 -0400 |
|---|---|---|
| committer | Tadas Vilkeliskis <vilkeliskis.t@gmail.com> | 2026-06-11 21:09:47 -0400 |
| commit | 8049d751271b37d8f66ea482f96c09a286b9b06c (patch) | |
| tree | 91d0543a867cd408d531084000436676f47e3538 | |
| parent | 761d4f8d38cc0e1f5e438cad4a2d33e2ece37a68 (diff) | |
build: convert project to standard libtool library with pkg-config
- Update tests and examples to link against libcsv_parser.la instead of
compiling raw sources directly.
- Add csv_parser.pc.in to generate pkg-config file for standard linking
and library discovery by other projects.
| -rw-r--r-- | .gitignore | 11 | ||||
| -rw-r--r-- | Makefile.am | 3 | ||||
| -rw-r--r-- | configure.ac | 2 | ||||
| -rw-r--r-- | csv_parser.pc.in | 10 | ||||
| -rw-r--r-- | examples/Makefile.am | 10 | ||||
| -rw-r--r-- | tests/Makefile.am | 5 |
6 files changed, 31 insertions, 10 deletions
@@ -11,3 +11,14 @@ Makefile .deps .dirstamp libtool + +*.pc +configure~ +.libs/ +*.la +*.lo +*.log +*.trs +examples/bench +examples/parser +tests/test diff --git a/Makefile.am b/Makefile.am index f1a6938..cef9bbe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,3 +10,6 @@ EXTRA_DIST = \ test: all cd tests ; $(MAKE) check + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = csv_parser.pc diff --git a/configure.ac b/configure.ac index c88cebf..6e3584f 100644 --- a/configure.ac +++ b/configure.ac @@ -13,5 +13,5 @@ LT_INIT # Checks for programs. AC_PROG_CC -AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile examples/Makefile]) +AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile examples/Makefile csv_parser.pc]) AC_OUTPUT diff --git a/csv_parser.pc.in b/csv_parser.pc.in new file mode 100644 index 0000000..d5bb944 --- /dev/null +++ b/csv_parser.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: @PACKAGE_NAME@ +Description: A simple CSV parser library +Version: @PACKAGE_VERSION@ +Libs: -L${libdir} -lcsv_parser +Cflags: -I${includedir} diff --git a/examples/Makefile.am b/examples/Makefile.am index e5d43ab..8988ab2 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -2,10 +2,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/src bin_PROGRAMS = parser bench -parser_SOURCES = ../src/csv_parser.c \ - ../src/csv_parser.h \ - parser.c +parser_SOURCES = parser.c +parser_LDADD = $(top_builddir)/src/libcsv_parser.la -bench_SOURCES = ../src/csv_parser.c \ - ../src/csv_parser.h \ - bench.c +bench_SOURCES = bench.c +bench_LDADD = $(top_builddir)/src/libcsv_parser.la diff --git a/tests/Makefile.am b/tests/Makefile.am index 1cc23f1..2b26bf2 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -3,8 +3,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/src noinst_PROGRAMS = test test_LDFLAGS = -lcheck -test_SOURCES = ../src/csv_parser.c \ - ../src/csv_parser.h \ - main.c +test_SOURCES = main.c +test_LDADD = $(top_builddir)/src/libcsv_parser.la TESTS = test |
