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
all: sysbacklight
sysbacklight: sysbacklight.o
- $(CC) -o $@ $(LDFLAGS) $<
+ $(CC) -o $@ $< $(LDFLAGS)
%.o: %.c
$(CC) -c -o $@ $(CFLAGS) $<