From: lichtstrahlreiter <45295540+lichtstrahlreiter@users.noreply.github.com> Date: Fri, 23 Nov 2018 17:34:30 +0000 (+0000) Subject: Fix linking X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ee94eab6670481d7360a25fd12ddce71291ed0a3;p=sysbacklight Fix linking Without this change I get the following error message: cc -c -o sysbacklight.o -I/usr/include/sysfs/ -Wall -std=c99 sysbacklight.c cc -o sysbacklight -lsysfs sysbacklight.o sysbacklight.o: In function `find_brightness_device': sysbacklight.c:(.text+0xe): undefined reference to `sysfs_open_class' sysbacklight.c:(.text+0x39): undefined reference to `sysfs_get_class_devices' sysbacklight.c:(.text+0x74): undefined reference to `dlist_start' sysbacklight.c:(.text+0x85): undefined reference to `_dlist_mark_move' sysbacklight.c:(.text+0x9c): undefined reference to `sysfs_get_classdev_attr' sysbacklight.c:(.text+0xdf): undefined reference to `_dlist_mark_move' sysbacklight.o: In function `get_brightness': sysbacklight.c:(.text+0x12d): undefined reference to `sysfs_get_classdev_attr' sysbacklight.c:(.text+0x16a): undefined reference to `sysfs_get_classdev_attr' sysbacklight.o: In function `set_brightness': sysbacklight.c:(.text+0x1f4): undefined reference to `sysfs_get_classdev_attr' sysbacklight.c:(.text+0x231): undefined reference to `sysfs_get_classdev_attr' sysbacklight.c:(.text+0x392): undefined reference to `sysfs_write_attribute' collect2: error: ld returned 1 exit status Makefile:7: recipe for target 'sysbacklight' failed make: *** [sysbacklight] Error 1 --- diff --git a/Makefile b/Makefile index 0916454..3596973 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ LDFLAGS?=$(shell pkg-config --libs libsysfs) all: sysbacklight sysbacklight: sysbacklight.o - $(CC) -o $@ $(LDFLAGS) $< + $(CC) -o $@ $< $(LDFLAGS) %.o: %.c $(CC) -c -o $@ $(CFLAGS) $<