1- # liblsof
2- liblsof_la_SOURCES = lib/ckkv.c lib/cvfs.c lib/dvch.c lib/fino.c lib/isfn.c lib/lkud.c lib/lsof.c lib/misc.c lib/node.c lib/pdvn.c lib/prfp.c lib/print.c lib/proc.c lib/ptti.c lib/rdev.c lib/rnmt.c lib/rmnt.c lib/rnam.c lib/rnch.c lib/rnmh.c
3- liblsof_la_SOURCES += lib/common.h lib/proto.h lib/hash.h
4-
5- if INSTALL_LIBLSOF
6- lib_LTLIBRARIES = liblsof.la
7- include_HEADERS = include/lsof.h include/lsof_fields.h
8- else
9- noinst_LTLIBRARIES = liblsof.la
10- endif
1+ # Shared source list for liblsof and the lsof binary
2+ LIBLSOF_SOURCES = lib/ckkv.c lib/cvfs.c lib/dvch.c lib/fino.c lib/isfn.c lib/lkud.c lib/lsof.c lib/misc.c lib/node.c lib/pdvn.c lib/prfp.c lib/print.c lib/proc.c lib/ptti.c lib/rdev.c lib/rnmt.c lib/rmnt.c lib/rnam.c lib/rnch.c lib/rnmh.c
3+ LIBLSOF_SOURCES += lib/common.h lib/proto.h lib/hash.h
114
125# Hide internal functions
136AM_CFLAGS = -fvisibility=hidden
@@ -17,7 +10,7 @@ DIALECT_PATH = $(DIALECT_ROOT)/$(LSOF_DIALECT_DIR)
1710
1811# Dialect specific sources
1912if LINUX
20- liblsof_la_SOURCES += lib/dialects/linux/dfile.c \
13+ LIBLSOF_SOURCES += lib/dialects/linux/dfile.c \
2114 lib/dialects/linux/dmnt.c \
2215 lib/dialects/linux/dnode.c \
2316 lib/dialects/linux/dproc.c \
@@ -29,7 +22,7 @@ liblsof_la_SOURCES += lib/dialects/linux/dfile.c \
2922endif
3023
3124if DARWIN
32- liblsof_la_SOURCES += lib/dialects/darwin/ddev.c \
25+ LIBLSOF_SOURCES += lib/dialects/darwin/ddev.c \
3326 lib/dialects/darwin/dfile.c \
3427 lib/dialects/darwin/dmnt.c \
3528 lib/dialects/darwin/dproc.c \
@@ -41,7 +34,7 @@ liblsof_la_SOURCES += lib/dialects/darwin/ddev.c \
4134endif
4235
4336if FREEBSD
44- liblsof_la_SOURCES += lib/dialects/freebsd/dmnt.c \
37+ LIBLSOF_SOURCES += lib/dialects/freebsd/dmnt.c \
4538 lib/dialects/freebsd/dnode.c \
4639 lib/dialects/freebsd/dproc.c \
4740 lib/dialects/freebsd/dsock.c \
@@ -52,7 +45,7 @@ liblsof_la_SOURCES += lib/dialects/freebsd/dmnt.c \
5245endif
5346
5447if NETBSD
55- liblsof_la_SOURCES += lib/dialects/netbsd/dmnt.c \
48+ LIBLSOF_SOURCES += lib/dialects/netbsd/dmnt.c \
5649 lib/dialects/netbsd/dnode.c \
5750 lib/dialects/netbsd/dproc.c \
5851 lib/dialects/netbsd/dsock.c \
@@ -63,7 +56,7 @@ liblsof_la_SOURCES += lib/dialects/netbsd/dmnt.c \
6356endif
6457
6558if OPENBSD
66- liblsof_la_SOURCES += lib/dialects/openbsd/dfile.c \
59+ LIBLSOF_SOURCES += lib/dialects/openbsd/dfile.c \
6760 lib/dialects/openbsd/dmnt.c \
6861 lib/dialects/openbsd/dnode.c \
6962 lib/dialects/openbsd/dproc.c \
@@ -75,7 +68,7 @@ liblsof_la_SOURCES += lib/dialects/openbsd/dfile.c \
7568endif
7669
7770if SOLARIS
78- liblsof_la_SOURCES += lib/dialects/sun/ddev.c \
71+ LIBLSOF_SOURCES += lib/dialects/sun/ddev.c \
7972 lib/dialects/sun/dfile.c \
8073 lib/dialects/sun/dmnt.c \
8174 lib/dialects/sun/dnode.c \
@@ -88,7 +81,7 @@ liblsof_la_SOURCES += lib/dialects/sun/ddev.c \
8881endif
8982
9083if AIX
91- liblsof_la_SOURCES += lib/dialects/aix/ddev.c \
84+ LIBLSOF_SOURCES += lib/dialects/aix/ddev.c \
9285 lib/dialects/aix/dfile.c \
9386 lib/dialects/aix/dmnt.c \
9487 lib/dialects/aix/dnode.c \
@@ -101,6 +94,14 @@ liblsof_la_SOURCES += lib/dialects/aix/ddev.c \
10194 lib/dialects/aix/machine.h
10295endif
10396
97+ # liblsof shared library (only built when --enable-liblsof)
98+ if INSTALL_LIBLSOF
99+ lib_LTLIBRARIES = liblsof.la
100+ include_HEADERS = include/lsof.h include/lsof_fields.h
101+ liblsof_la_SOURCES = $(LIBLSOF_SOURCES )
102+ liblsof_la_CPPFLAGS = -I$(DIALECT_PATH ) -Iautotools -DAUTOTOOLS -I$(top_srcdir ) /lib -I$(top_srcdir ) /include
103+ endif
104+
104105# Binary
105106bin_PROGRAMS = lsof
106107
@@ -114,10 +115,9 @@ if DARWIN
114115lsof_SOURCES += src/dialects/darwin/dprint.c
115116endif
116117# TODO: link to dynamic library instead after internal functions are no longer used
117- lsof_SOURCES += $(liblsof_la_SOURCES )
118+ lsof_SOURCES += $(LIBLSOF_SOURCES )
118119# lsof_LDADD = liblsof.la
119120
120- liblsof_la_CPPFLAGS = -I$(DIALECT_PATH ) -Iautotools -DAUTOTOOLS -I$(top_srcdir ) /lib -I$(top_srcdir ) /include
121121lsof_CPPFLAGS = -I$(DIALECT_PATH ) -Iautotools -DAUTOTOOLS -I$(top_srcdir ) /lib -I$(top_srcdir ) /include -I$(top_srcdir ) /src
122122
123123# Testing scripts
@@ -204,10 +204,13 @@ tests_LTszoff_CFLAGS = @LSOF_TEST_CFLAGS@ -I$(top_srcdir)/include
204204tests_LTunix_SOURCES = tests/LTunix.c tests/LTlib.c
205205tests_LTunix_CFLAGS = @LSOF_TEST_CFLAGS@ -I$(top_srcdir ) /include
206206
207+ # LTbasic2 links against liblsof, only build when liblsof is enabled
208+ if INSTALL_LIBLSOF
207209TESTS += tests/LTbasic2
208210check_PROGRAMS += tests/LTbasic2
209211tests_LTbasic2_CFLAGS = -I$(top_srcdir ) /include
210212tests_LTbasic2_LDADD = liblsof.la
213+ endif
211214
212215# Documentation
213216EXTRA_DIST += 00.README.FIRST 00CREDITS 00DCACHE 00DIALECTS 00DIST 00FAQ 00LSOF-L 00MANIFEST 00PORTING 00QUICKSTART 00README 00TEST 00XCONFIG
0 commit comments