# kacpimon makefile

sources = acpi_ids.c kacpimon.c connection_list.c input_layer.c libnetlink.c \
	netlink.c
target = kacpimon
CFLAGS = -g -O0 -Wall -Wextra -Wundef -Wshadow -Werror
# Non-debug flags
#CFLAGS = -O2 -Wall -Wextra -Wundef -Wshadow -Werror

objects := $(sources:.c=.o)

# Default target
$(target) : $(objects)

depends := $(sources:.c=.d)

# Dependency files can be made from .c files like this...
# (the sed line adds the .d file itself as a target)
%.d : %.c
	@set -e; \
	rm -f $@; \
	$(CPP) -MM $(CPPFLAGS) $< > $@.$$$$; \
	sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
	rm -f $@.$$$$

# Pull in all dependencies from the .d files.
-include $(depends)

.PHONY : clean
clean :
	-rm $(depends) $(objects) $(target) 2> /dev/null
