From 2bcf896a57aed6cca8453eb52ce11dab92f71247 Mon Sep 17 00:00:00 2001 From: Huck Boles Date: Sun, 22 Jan 2023 14:39:23 -0600 Subject: [PATCH] makefile fixes --- Makefile | 14 +++++++------- test/errortest.c | 6 ------ test/helptest.c | 5 ----- 3 files changed, 7 insertions(+), 18 deletions(-) delete mode 100644 test/errortest.c delete mode 100644 test/helptest.c diff --git a/Makefile b/Makefile index 49e0a47..ba53210 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ NAME = gol -VER ?= 0.1.0 +VER ?= 0.2.2 SHELL = /bin/bash @@ -15,7 +15,7 @@ DOCDIR ?= $(USRDIR)/share/doc/$(NAME) SRCDIR ?= ./src OBJDIR ?= ./obj BUILD ?= ./build -TESTDIR ?= ./test +TESTDIR ?= ./tests TESTBIN ?= $(TESTDIR)/bin BIN ?= $(BUILD)/$(NAME) @@ -23,7 +23,7 @@ SRC ?= $(wildcard $(SRCDIR)/*.c) HDR ?= $(wildcard $(SRCDIR)/*.h) OBJ ?= $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(SRC)) TEST ?= $(wildcard $(TESTDIR)/*.c) -TESTS ?= $(patsubst $(TESTDIR)/%.c, $(TESTBIN)/%, $(TESTS)) +TESTS ?= $(patsubst $(TESTDIR)/%.c, $(TESTBIN)/%, $(TEST)) TAR ?= $(BUILD)/$(NAME)-$(VERSION).tar.gz TARSUM ?= $(BUILD)/$(NAME)-$(VERSION)-tar.hash @@ -38,8 +38,8 @@ AR ?= tar HASH ?= sha256sum CFLAGS += -O2 -pipe WARNINGS ?= -Wall -Wextra -Wpedantic -CPPFLAGS += -I . -LDFLAGS += -L . +CPPFLAGS += -I $(SRCDIR) +LDFLAGS += -L $(SRCDIR) LDLIBS += FLAGS ?= $(CPPFLAGS) $(CFLAGS) $(WARNINGS) $(LDFLAGS) $(LDLIBS) @@ -70,7 +70,7 @@ tar: $(SRC) $(HDR) $(MAN) $(DOC) $(BIN): $(OBJ) $(CC) $(OBJ) $(FLAGS) -o $(BIN) -$(OBJDIR)/%.o: $(SRCDIR)/%.c $(SRCDIR)/$(HDR) +$(OBJDIR)/%.o: $(SRCDIR)/%.c $(HDR) $(CC) -c $(FLAGS) $< -o $@ clean: @@ -80,7 +80,7 @@ debug: CFLAGS += -ggdb3 -Og debug: $(BIN) $(TESTBIN)/%: $(TESTDIR)/%.c - $(CC) $(FLAGS) $< $(OBJS) -o $@ + $(CC) $(FLAGS) $< $(filter-out $(OBJDIR)/$(NAME).o,$(OBJ)) -o $@ test: $(BIN) $(TESTBIN) $(TESTS) for test in $(TESTS); do ./$$test; done diff --git a/test/errortest.c b/test/errortest.c deleted file mode 100644 index aa3500e..0000000 --- a/test/errortest.c +++ /dev/null @@ -1,6 +0,0 @@ -#include "gol.h" - -int main(int argc, char **argv){ - errorcheck(NO_ERROR); - errorcheck(FLAG_ERROR); -} diff --git a/test/helptest.c b/test/helptest.c deleted file mode 100644 index 7495e93..0000000 --- a/test/helptest.c +++ /dev/null @@ -1,5 +0,0 @@ -#includ "gol.h" - -int main(int argc, char **argv){ - help(); -} -- 2.45.2