From 88cb4f8cff03388c3a03ef4a59e95f3320245c78 Mon Sep 17 00:00:00 2001 From: Hrishikesh Bawane Date: Sat, 19 Dec 2020 00:04:33 +0530 Subject: [PATCH] Added make for test --- .gitignore | 3 +-- Makefile | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 6f2af3a..94626d4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ *.csv *.o -test/tread_csv -test/tto_csv *.out +test/test_csv cscope.out tags diff --git a/Makefile b/Makefile index f581a8d..73dad08 100644 --- a/Makefile +++ b/Makefile @@ -1,9 +1,20 @@ -all: build +CXX = g++ +CXXFLAGS = -g -Wall +LIBFLAGS = -lcsv +TESTFLAGS = -lcppunit +TESTM = test/test_csv.cpp +SRCM = src/csv.cpp +LIBM = libcsv.a + +all: test build + +test: + $(CXX) $(CXXFLAGS) $(TESTM) -o test_csv $(LIBFLAGS) $(TESTFLAGS) build: - g++ src/csv.cpp -c - ar rcs libcsv.a csv.o - rm /lib/libcsv.a + $(CXX) $(SRCM) -c + ar rcs $(LIBM) csv.o + rm /lib/$(LIBM) rm *.o - chmod 777 libcsv.a - mv libcsv.a /lib/ + chmod 777 $(LIBM) + mv $(LIBM) /lib/