From bffb07aa988e149ca2f3eb65368ee0bfe2acd93f Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Sun, 9 Oct 2016 17:16:09 +0300 Subject: Fix warnings and make Makefile more dynamic --- Makefile | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a61038c..2ecc212 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,28 @@ -PREFIX=$(PREFIX) +CXX=g++ +CXXFLAGS=-std=c++11 -Wall -O2 +SRC=*.cpp +TARGET=me +PREFIX=$$PREFIX all: - g++ -std=c++11 *.cpp -o me -Wall -O2 + $(CXX) $(SRC) $(CXXFLAGS) -o $(TARGET) + echo "Done." -clean: me - rm 'me' +clean: $(TARGET) + rm $(TARGET) test: - echo $$PREFIX + echo $(PREFIX) -install: me +install: $(TARGET) if [ -z "$$PREFIX" ] ; then \ echo "No PREFIX set. Aborting install."; \ else \ echo "Installing in $$PREFIX/bin/..."; \ cp me "$$PREFIX"/bin/me; \ - echo "Done."; \ + if [ $$? -eq 0 ] ; then \ + echo "Installation successful."; \ + else \ + echo "Installation failed."; \ + fi \ fi -- cgit v1.3