Skip to content

Commit f2c00df

Browse files
authored
Merge pull request #357 from kurok/fix/skip-liblsof-build-when-disabled
fix: skip building liblsof when --disable-liblsof is given
2 parents d1dee56 + 204a18f commit f2c00df

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

Makefile.am

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
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
136
AM_CFLAGS = -fvisibility=hidden
@@ -17,7 +10,7 @@ DIALECT_PATH = $(DIALECT_ROOT)/$(LSOF_DIALECT_DIR)
1710

1811
# Dialect specific sources
1912
if 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 \
2922
endif
3023

3124
if 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 \
4134
endif
4235

4336
if 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 \
5245
endif
5346

5447
if 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 \
6356
endif
6457

6558
if 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 \
7568
endif
7669

7770
if 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 \
8881
endif
8982

9083
if 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
10295
endif
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
105106
bin_PROGRAMS = lsof
106107

@@ -114,10 +115,9 @@ if DARWIN
114115
lsof_SOURCES += src/dialects/darwin/dprint.c
115116
endif
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
121121
lsof_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
204204
tests_LTunix_SOURCES = tests/LTunix.c tests/LTlib.c
205205
tests_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
207209
TESTS += tests/LTbasic2
208210
check_PROGRAMS += tests/LTbasic2
209211
tests_LTbasic2_CFLAGS = -I$(top_srcdir)/include
210212
tests_LTbasic2_LDADD = liblsof.la
213+
endif
211214

212215
# Documentation
213216
EXTRA_DIST += 00.README.FIRST 00CREDITS 00DCACHE 00DIALECTS 00DIST 00FAQ 00LSOF-L 00MANIFEST 00PORTING 00QUICKSTART 00README 00TEST 00XCONFIG

0 commit comments

Comments
 (0)