summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: ab22a4b1a11a4bd5433014ddcf54f9392db530ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

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