From be32ee43cd600c7ccd3954c656f53b1dc081644f Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Wed, 27 Dec 2006 14:25:48 +0000
Subject: [PATCH] Remember the last OS that the utilities was built for.  Added
 'install' target.

---
 src/lyskom/Makefile | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/lyskom/Makefile b/src/lyskom/Makefile
index fbc27e5..05fbb0f 100644
--- a/src/lyskom/Makefile
+++ b/src/lyskom/Makefile
@@ -1,20 +1,25 @@
 # Makefile for lyskom Nagios utilities
 
+LIBEXECDIR=/usr/local/nagios/libexec/
+PROGS=notify_lyskom check_lyskom
 COBJS=lyskom.o buffer.o
 
 CFLAGS=-g -O
 
 boo:
-	@echo "Enter 'make linux' or 'make solaris'"
+	@if [ -f .lastos ]; then $(MAKE) `cat .lastos`||exit 1; \
+	else echo "Enter 'make linux' or 'make solaris'" ; fi
 
 linux:
+	echo linux > .lastos
 	$(MAKE) LIBS="-lrt" CC="$(CC)" CFLAGS="$(CFLAGS)" all
 
 solaris:
+	echo solaris > .lastos
 	$(MAKE) LIBS="-lrt -lnsl -lsocket" CC="$(CC)" CFLAGS="$(CFLAGS)" all
 
 
-all: 	notify_lyskom check_lyskom
+all: 	$(PROGS)
 
 notify_lyskom:	notify_lyskom.o $(COBJS)
 	$(CC) -o notify_lyskom notify_lyskom.o $(COBJS) $(LIBS)
@@ -24,3 +29,8 @@ check_lyskom:	check_lyskom.o $(COBJS)
 
 distclean clean:
 	-rm -f core notify_lyskom check_lyskom *.o *~ \#*
+
+install:
+	$(MAKE) boo
+	for i in $(PROGS); \
+	do install $$i $(DESTDIR)$(LIBEXECDIR)/$$i || exit 1; done
-- 
GitLab