Skip to content

Commit 4d072f6

Browse files
Merge pull request #21 from guillemj/pu/build-sys
Build system improvements
2 parents 5406b33 + 81c3e01 commit 4d072f6

7 files changed

Lines changed: 26 additions & 8 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
*.la
22
*.lo
33
*.o
4+
*.pc
45
.deps
56
.libs
67
INSTALL

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

configure.ac

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ AC_CHECK_FUNCS([bzero isascii memset strchr strerror strrchr strstr strtol])
5656

5757
AC_CONFIG_FILES([Makefile
5858
lib/Makefile
59+
lib/libsysfs.pc
5960
cmd/Makefile
6061
test/Makefile])
6162
AC_CONFIG_HEADERS([config.h])

lib/Makefile.am

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
EXTRA_DIST = libsysfs.pc.in
2+
3+
pkgconfigdir = $(libdir)/pkgconfig
4+
pkgconfig_DATA = libsysfs.pc
5+
16
lib_LTLIBRARIES = libsysfs.la
27
libsysfs_la_SOURCES = sysfs_utils.c sysfs_attr.c sysfs_class.c dlist.c \
38
sysfs_device.c sysfs_driver.c sysfs_bus.c sysfs_module.c sysfs.h
4-
libsysfs_la_CPPFLAGS = -I../include
9+
libsysfs_la_CPPFLAGS = -I$(top_srcdir)/include
510
libsysfs_la_LDFLAGS = -version-info 2:1:0
611
EXTRA_CFLAGS = @EXTRA_CLFAGS@
712
libsysfs_la_CFLAGS = -Wall -W -Wextra -Wstrict-prototypes $(EXTRA_CLFAGS)

lib/libsysfs.pc.in

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
prefix=@prefix@
2+
exec_prefix=@exec_prefix@
3+
libdir=@libdir@
4+
includedir=@includedir@
5+
6+
Name: libsysfs
7+
Description: interface to Linux sysfs
8+
Version: @VERSION@
9+
URL: https://github.com/linux-ras/sysfsutils
10+
Libs: -L${libdir} -lsysfs
11+
Cflags: -I${includedir}

test/Makefile.am

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
bin_PROGRAMS = dlist_test get_device get_driver get_module testlibsysfs
1+
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-
./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)