nps: poci/Makefile (NEW), poci/makefile (REMOVED), poci/makefile_h...
baggins
baggins at pld-linux.org
Sat Jul 30 12:35:00 CEST 2005
Author: baggins Date: Sat Jul 30 10:35:00 2005 GMT
Module: nps Tag: HEAD
---- Log message:
- one Makefile to rule them all
---- Files affected:
nps/poci:
Makefile (NONE -> 1.1) (NEW), makefile (1.1.1.1 -> NONE) (REMOVED), makefile_hb (1.1.1.1 -> NONE) (REMOVED), makefile_mc (1.1.1.1 -> NONE) (REMOVED), makefile_poci (1.1.1.1 -> NONE) (REMOVED)
---- Diffs:
================================================================
Index: nps/poci/Makefile
diff -u /dev/null nps/poci/Makefile:1.1
--- /dev/null Sat Jul 30 12:35:00 2005
+++ nps/poci/Makefile Sat Jul 30 12:34:55 2005
@@ -0,0 +1,98 @@
+################################################################################
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+#
+################################################################################
+
+KERNEL_MAJOR_VERSION ?= $(shell uname -r | sed 's/\([0-9]*\)\.[0-9]*\..*/\1/')
+KERNEL_MINOR_VERSION ?= $(shell uname -r | sed 's/[0-9]*\.\([0-9]*\)\..*/\1/')
+ARCH_VERSION ?= $(shell uname -m)
+
+ifeq ($(KERNEL_MAJOR_VERSION),2)
+ifeq ($(KERNEL_MINOR_VERSION),6)
+ifeq ($(ARCH_VERSION),x86_64)
+MC_CFLAGS_EXTRA += -DLINUX_2_6_KERNEL=1
+POCI_CFLAGS_EXTRA += -DLINUX_2_6_KERNEL=1 -L /usr/lib -L /usr/lib64 -lpci
+endif
+endif
+endif
+
+CFLAGS = -O2 -I ../common
+
+.PHONY: all install uninstall postinstall preuninstall postuninstall clean
+
+all:
+ gcc $(CFLAGS) -o nws_mc nws_mc.c $(MC_CFLAGS_EXTRA)
+ gcc $(CFLAGS) -o nws_hb nws_hb.c
+ gcc $(CFLAGS) -o nws_poci nws_poci.c $(POCI_CFLAGS_EXTRA)
+
+clean:
+ rm -f nws_mc nws_hb nws_poci
+
+install:
+ @mkdir -p $(DESTDIR)/usr/sbin
+ @mkdir -p $(DESTDIR)/etc/init.d
+ @mkdir -p $(DESTDIR)/etc/newisys/poci
+ install -m744 nws_mc $(DESTDIR)/usr/sbin
+ install -m744 nws_hb $(DESTDIR)/usr/sbin
+ install -m744 nws_poci $(DESTDIR)/usr/sbin
+ install -m744 script/poci $(DESTDIR)/etc/init.d
+ sed -e "s/<SWInstalledDate>.*</<SWInstalledDate>`date +%s`</" \
+ -e "s/SWInfo\(.*\)</SWInfo\1 Source</" \
+ < swinventory.xml > swinventory.new
+ mv swinventory.new swinventory.xml
+ install -D -m 644 swinventory.xml $(DESTDIR)/etc/newisys/poci/swinventory.xml
+ @if [ ! -f ../file.list ] ; then \
+ echo "%defattr(-,root,root)" >../file.list ;\
+ fi
+ @echo "/usr/sbin/nws_mc" >>../file.list
+ @echo "/usr/sbin/nws_hb" >>../file.list
+ @echo "/usr/sbin/nws_poci" >>../file.list
+ @echo "/etc/init.d/poci" >>../file.list
+ @echo "/etc/newisys/poci/swinventory.xml" >> ../file.list
+ make postinstall
+
+uninstall: preuninstall
+ rm -f $(DESTDIR)/usr/sbin/nws_mc
+ rm -f $(DESTDIR)/usr/sbin/nws_hb
+ rm -f $(DESTDIR)/usr/sbin/nws_poci
+ rm -f $(DESTDIR)/etc/init.d/poci
+ rm -rf $(DESTDIR)/etc/newisys/poci
+
+#
+# now add poci as a service
+#
+postinstall:
+ifeq (,$(BUILD_FROM_RPM))
+ if [ -f $(DESTDIR)/etc/init.d/functions ] ; then \
+ chkconfig --add poci ;\
+ else \
+ insserv $(DESTDIR)/etc/init.d/poci ;\
+ fi
+endif
+
+#
+# check to see if poci is running...if so, stop it
+#
+preuninstall:
+ if [ 'ps -Af | grep -v "grep" | grep -q "nws_poci"' ] ; then \
+ $(DESTDIR)/etc/init.d/poci stop ;\
+ fi ;\
+ if [ -f $(DESTDIR)/etc/init.d/functions ] ; then \
+ chkconfig --del poci ;\
+ else \
+ insserv -r $(DESTDIR)/etc/init.d/poci ;\
+ fi
================================================================
More information about the pld-cvs-commit
mailing list