Automate tests
[centaur.git] / Makefile
index b62b9ab7582ca6af70f0a73df2d214b412ad8cce..c93b2abc61d0d24440717d1ce48fcd970fd07ef5 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,6 @@
-PROJ := elfedit
+PROJ := elfucli
+
+LIBRARIES := libelf
 
 BUILDDIR   := build
 INCLUDEDIR := include
@@ -11,9 +13,9 @@ HEADERS += $(shell find $(SRCDIR)/ -iname "*.h")
 SOURCES := $(shell find $(SRCDIR)/ -iname "*.c")
 OBJS    := $(patsubst %.c, $(BUILDDIR)/%.o, $(SOURCES))
 
-INCLUDES := $(patsubst %, -I%, $(INCLUDEDIR) $(SRCDIR))
-CFLAGS   := -g -Wall
-LDFLAGS  := -lelf
+INCLUDES := $(patsubst %, -I%, $(INCLUDEDIR) $(SRCDIR)) $(shell pkg-config --cflags-only-I $(LIBRARIES))
+CFLAGS   := -g -Wall -pedantic -Wno-variadic-macros $(shell pkg-config --cflags-only-other $(LIBRARIES))
+LDFLAGS  := $(shell pkg-config --libs $(LIBRARIES))
 
 
 
@@ -23,10 +25,7 @@ default: $(EXE)
 
 .PHONY: check
 check: $(EXE)
-       $(EXE) $(EXE) -o testexe
-       @cmp $(EXE) testexe
-       @rm testexe
-       @echo "Check successful."
+       make -C tests check
 
 
 .PHONY: debug
@@ -50,6 +49,7 @@ clean:
        rm -f $(OBJS)
        rm -f $(TESTEXES)
        rm -rf $(BUILDDIR)/
+       make -C tests clean
 
 
 .PHONY: distclean