CFLAGS ?= -Wall -Werror -g CFLAGS += -D_GNU_SOURCE -DDEBUG PKGCONFIG ?= pkg-config LIBKMOD_CFLAGS := $(shell $(PKGCONFIG) --cflags libkmod) LIBKMOD_LIBS := $(shell $(PKGCONFIG) --libs libkmod) BLKID_CFLAGS := $(shell $(PKGCONFIG) --cflags blkid) BLKID_LIBS := $(shell $(PKGCONFIG) --libs blkid) nlsockd_SRCS = nlsockd.c nlsockd_OBJS = $(nlsockd_SRCS:%.c=%.o) nlplug_SRCS = nlplug.c nlplug_OBJS = $(nlplug_SRCS:%.c=%.o) nlplug_LIBS = $(LIBKMOD_LIBS) $(BLKID_LIBS) CFLAGS += $(LIBKMOD_CFLAGS) $(BLKID_CFLAGS) handler_SRCS = handler.c handler_OBJS = $(handler_SRCS:%.c=%.o) all: nlsockd nlplug handler nlsockd: $(nlsockd_OBJS) nlplug: $(nlplug_OBJS) handler: $(handler_OBJS) handler nlsockd nlplug: echo $(BLKID_CFLAGS) $(CC) -o $@ $(CFLAGS) $($@_CFLAGS) $($@_OBJS) $(LDFLAGS) $($@_LIBS) clean: rm -f nlplug nlsockd