-PROJ := elfedit
+PROJ := elfucli
+
+LIBRARIES := libelf
BUILDDIR := build
INCLUDEDIR := include
SOURCES := $(shell find $(SRCDIR)/ -iname "*.c")
OBJS := $(patsubst %.c, $(BUILDDIR)/%.o, $(SOURCES))
-INCLUDES := $(patsubst %, -I%, $(INCLUDEDIR) $(SRCDIR)) -I /usr/include/libelf
-CFLAGS := -g -Wall
-LDFLAGS := -lelf
+INCLUDES := $(patsubst %, -I%, $(INCLUDEDIR) $(SRCDIR)) $(shell pkg-config --cflags-only-I $(LIBRARIES))
+CFLAGS := -g -Wall $(shell pkg-config --cflags-only-other $(LIBRARIES))
+LDFLAGS := $(shell pkg-config --libs $(LIBRARIES))
.PHONY: check
check: $(EXE)
+ $(error the re-layouting has broken make check for now, sorry.)
$(EXE) $(EXE) -o testexe
@cmp $(EXE) testexe
@rm testexe