Skip to content

Commit 81c3e01

Browse files
committed
build: Fix out-of-tree builds
In out-of-tree builds the current directory is the build directory which is different to the source directory. As a consequence this also fixes «make distcheck» to work.
1 parent 84aa8f6 commit 81c3e01

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

cmd/Makefile.am

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
bin_PROGRAMS = systool
22
systool_SOURCES = systool.c names.c names.h
3-
LDADD = ../lib/libsysfs.la
3+
LDADD = $(top_builddir)/lib/libsysfs.la
44
EXTRA_CFLAGS = @EXTRA_CFLAGS@
5-
AM_CPPFLAGS = -I../include
5+
AM_CPPFLAGS = -I$(top_srcdir)/include
66
AM_CFLAGS = -Wall -W -Wextra -Wstrict-prototypes $(EXTRA_CFLAGS)
77

lib/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pkgconfig_DATA = libsysfs.pc
66
lib_LTLIBRARIES = libsysfs.la
77
libsysfs_la_SOURCES = sysfs_utils.c sysfs_attr.c sysfs_class.c dlist.c \
88
sysfs_device.c sysfs_driver.c sysfs_bus.c sysfs_module.c sysfs.h
9-
libsysfs_la_CPPFLAGS = -I../include
9+
libsysfs_la_CPPFLAGS = -I$(top_srcdir)/include
1010
libsysfs_la_LDFLAGS = -version-info 2:1:0
1111
EXTRA_CFLAGS = @EXTRA_CLFAGS@
1212
libsysfs_la_CFLAGS = -Wall -W -Wextra -Wstrict-prototypes $(EXTRA_CLFAGS)

test/Makefile.am

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ check_PROGRAMS = dlist_test get_device get_driver get_module testlibsysfs
22
BUILT_SOURCES = test.h
33
CLEANFILES = test.h
44
test.h: libsysfs.conf create-test
5-
$(AM_V_GEN) ./create-test
5+
$(AM_V_GEN) $(srcdir)/create-test $(srcdir)/libsysfs.conf
66
get_device_SOURCES = get_device.c
77
get_driver_SOURCES = get_driver.c
88
get_module_SOURCES = get_module.c
99
testlibsysfs_SOURCES = test.c test_attr.c test_bus.c test_class.c \
1010
test_device.c test_driver.c test_module.c test_utils.c \
1111
testout.c test-defs.h libsysfs.conf create-test
12-
AM_CPPFLAGS = -I../include
13-
LDADD = ../lib/libsysfs.la
12+
AM_CPPFLAGS = -I$(top_srcdir)/include
13+
LDADD = $(top_builddir)/lib/libsysfs.la
1414
EXTRA_CFLAGS = @EXTRA_CLFAGS@
1515
AM_CFLAGS = -Wall -W -Wextra -Wstrict-prototypes $(EXTRA_CLFAGS)
1616

test/create-test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
rm -f test.h
44

5-
conf_file=./libsysfs.conf
5+
conf_file=${1:-libsysfs.conf}
66

77
. $conf_file
88

0 commit comments

Comments
 (0)