From 98421fab9094c8d7587583dc029b11ef7e7308b2 Mon Sep 17 00:00:00 2001 From: Albert S Date: Mon, 14 Mar 2022 22:30:53 +0100 Subject: [PATCH] Makefile: Build exile.o separately, link it in all tests --- Makefile | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 090dd03..e277dd6 100644 --- a/Makefile +++ b/Makefile @@ -7,13 +7,17 @@ CXXFLAGS = -std=c++20 -Wall -Wextra -pedantic clean: - rm -f test testcpp + rm -f test exile.o testcpp -test: test.c exile.h - $(CC) test.c exile.c -g $(CFLAGS) -o test -testcpp: test.cpp exile.h exile.hpp - $(CXX) test.cpp -g $(CXXFLAGS) -o testcpp +exile.o: exile.c exile.h + $(CC) -c exile.c -g $(CFLAGS) -o exile.o + +test: test.c exile.h exile.o + $(CC) test.c exile.o -g $(CFLAGS) -o test + +testcpp: test.cpp exile.h exile.hpp exile.o + $(CXX) test.cpp exile.o -g $(CXXFLAGS) -o testcpp tests: test testcpp