From 550a1c057ca473e9889d03738f6f65340f07d973 Mon Sep 17 00:00:00 2001
From: Ruanito Santos <rds11@c3sl.ufpr.br>
Date: Fri, 4 May 2012 09:38:00 -0300
Subject: [PATCH] client: Add tests for soap and install Makefile options

Add it to lib/Makefile.

These tests make it possible to execute "make" and "make install" after the
first time without ocurring any errors.

Signed-off-by: Ruanito Santos <rds11@c3sl.ufpr.br>
Acked-by: Aryane Ast dos Santos <aras10@c3sl.ufpr.br>
Signed-off-by: Erik Alexandre Pucci <eap08@c3sl.ufpr.br>
---
 client/lib/Makefile | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/client/lib/Makefile b/client/lib/Makefile
index aca1f02..432b386 100644
--- a/client/lib/Makefile
+++ b/client/lib/Makefile
@@ -16,14 +16,22 @@ win:
 	@tar xzf $(LIBGSOAP)_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz
 
 soap:
-	@wget -nc "$(GSOAPDOWNLOADLINK)" -O "$(LIBGSOAP)_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz"
-	@tar xzf $(LIBGSOAP)_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz
-	@echo "Installing gSOAP library, wait..."
-	@cp -f stdsoap2.? $(LIBDIR)/$(LIBGSOAPDIR)/${LIBGSOAP}/
-	@cd $(LIBDIR)/$(LIBGSOAPDIR) && ./configure -q --prefix=$(PWD)/$(LIBGSOAP) && make
+	@if ! test -d "$(LIBDIR)/$(LIBGSOAPDIR)"; then\
+		wget -nc "$(GSOAPDOWNLOADLINK)" -O "$(LIBGSOAP)_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz";\
+		tar xzf $(LIBGSOAP)_$(LIBGSOAPVER).$(LIBGSOAPSVER).tar.gz;\
+		echo "Installing gSOAP library, wait...";\
+		cp -f stdsoap2.? $(LIBDIR)/$(LIBGSOAPDIR)/${LIBGSOAP}/;\
+		cd $(LIBDIR)/$(LIBGSOAPDIR) && ./configure -q --prefix=$(PWD)/$(LIBGSOAP) && make;\
+	elif test -d "$(LIBDIR)/$(LIBGSOAPDIR)"; then\
+		echo "Packages already downloaded";\
+	fi
 
 install:
-	@cd $(LIBDIR)/$(LIBGSOAPDIR) && make install
+	@if ! test -d $(LIBGSOAP); then\
+		cd $(LIBDIR)/$(LIBGSOAPDIR) && make install;\
+	elif test -d $(LIBGSOAP); then\
+		echo "Packages already installed";\
+	fi
 
 clean:
 	@cd $(LIBDIR)/$(LIBGSOAPDIR) && make clean
-- 
GitLab