1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
|
# $Id: moodss.mk,v 1.35 2005/02/21 21:30:59 jfontain Exp $
VERSION = 19.7
# note: TCLSH and WISH must include path as they are used
# as shell interpreters inside scripts (using the #! syntax)
TCLSH = /usr/bin/tclsh
WISH = /usr/bin/wish
CC = gcc
# dynamic libraries compilation options:
CFLAGS = -O2
TCLLIBDIR = /usr/lib
# optionally add Tcl includes path (use -Idirectory syntax):
INCLUDES =
# optionally include SQLite package (set to true or false):
INCLUDESQLITE = false
# network related libraries
# (use -llibrary syntax, -lresolv on SunOS, none on Linux and FreeBSD):
EXTRALIBS =
# only use as the temporary installation directory, such as from a rpm
# specification file, otherwise change the directories below instead:
ROOTDIR =
# you may change the directories below:
BASEDIR =
BINDIR = $(BASEDIR)/usr/bin
LIBDIR = $(BASEDIR)/usr/lib
MANDIR = $(BASEDIR)/usr/share/man
DOCDIR = $(BASEDIR)/usr/share/doc
MOODSSLIBDIR = $(LIBDIR)/moodss
# where the modules will be finally installed (useful in rpm specification):
MODULESDIR = $(MOODSSLIBDIR)
MOODSSDOCDIR = $(DOCDIR)/moodss-$(VERSION)
# where the HTML documentation will be finally installed (useful in rpm specification):
MOODSSHTMLDIR = $(MOODSSDOCDIR)
# uncomment the MODULES entries for your platform below,
# while obviously commenting those entries for all the other platforms:
# Linux:
MODULES = apache apachex arp cpustats disks diskstats formulas hddtemp interrupts kernmods log memstats minimal mounts myerrorlog myhealth myprocs myquery myreplication mystatus myvars nagios netdev odbcquery partitions pci ping ps psbyname psbyuser random route sensors smithy snmp snmptrap system trace usb Log Minimal Random Threaded minipy randpy
# Solaris:
#MODULES = apache apachex formulas log minimal mounts myerrorlog myhealth myprocs myquery myreplication mystatus myvars nagios odbcquery ping random smithy snmp snmptrap trace Log Minimal Random minipy randpy
# FreeBSD:
#MODULES = apache apachex cpustats formulas log memstats minimal mounts myerrorlog myhealth myprocs myquery myreplication mystatus myvars nagios odbcquery ping ps psbyname psbyuser random smithy snmp snmptrap trace Log Minimal Random minipy randpy
### You should not need to change anything below this line ###
### (let me know at jfontain@free.fr if you have to) ###
all: htmldata.tcl htmldata-ja.tcl moodss packlibs/libfilesystem.so.1.1 packlibs/libnetwork.so.1.20 packlibs/liblogging.so.1.0
install: all
mkdir -p $(ROOTDIR)$(BINDIR)
mkdir -p $(ROOTDIR)$(LIBDIR)
mkdir -p $(ROOTDIR)$(MANDIR)/man1
mkdir -p $(ROOTDIR)$(MOODSSDOCDIR)
# append final modules directory to Tcl automatic package path
sed -e 's,$$::tcl_library/moodss,$(MODULESDIR),;' moodss > $(ROOTDIR)$(BINDIR)/moodss
chmod 755 $(ROOTDIR)$(BINDIR)/moodss
# use final module directory for images in HTML help:
for module in $(MODULES); do\
directory=$(MOODSSLIBDIR)/$$module;\
mkdir -p $(ROOTDIR)$$directory;\
cp -f $$module/pkgIndex.tcl $(ROOTDIR)$$directory/;\
for file in $$module/$$module.htm $$module/$$module-*.htm; do\
if [ -r $$file ]; then\
name=`basename $$file`;\
sed -e "s,<img src=\",<img src=\"$(MODULESDIR)/$$module/,g;" $$file > $(ROOTDIR)$$directory/$$name;\
chmod 644 $(ROOTDIR)$$directory/$$name;\
fi;\
done;\
for extension in gif pm py tcl; do\
file=$$module/$$module.$$extension;\
if [ -r $$file ]; then\
cp -f $$file $(ROOTDIR)$$directory/;\
fi;\
done;\
done
cp -f apache/apacheu.tcl $(ROOTDIR)$(MOODSSLIBDIR)/apache/
# note: arp module in not installed in all architectures:
test -d $(ROOTDIR)$(MOODSSLIBDIR)/arp && cp -f arp/manuf.txt $(ROOTDIR)$(MOODSSLIBDIR)/arp/ || :
for file in INSTALL hosts; do\
cp -f ping/$$file $(ROOTDIR)$(MOODSSLIBDIR)/ping/;\
done
cp -f mystatus/mystatus.dat $(ROOTDIR)$(MOODSSLIBDIR)/mystatus/
cp -f myvars/myvars.dat $(ROOTDIR)$(MOODSSLIBDIR)/myvars/
cp -f myerrorlog/*.txt $(ROOTDIR)$(MOODSSLIBDIR)/myerrorlog/
mkdir -p $(ROOTDIR)$(MOODSSLIBDIR)/packlibs
for file in pkgIndex.tcl htmldata.tcl htmldata-ja.tcl misc.tcl network.tcl threads.tcl linetask.tcl hashes.tcl libfilesystem.so.1.1 libnetwork.so.1.20 liblogging.so.1.0; do\
cp -f packlibs/$$file $(ROOTDIR)$(MOODSSLIBDIR)/packlibs/;\
done
mkdir -p $(ROOTDIR)$(MOODSSLIBDIR)/stooop
for file in pkgIndex.tcl stooop.tcl switched.tcl; do\
cp -f stooop/$$file $(ROOTDIR)$(MOODSSLIBDIR)/stooop/;\
done
mkdir -p $(ROOTDIR)$(MOODSSLIBDIR)/msgs
for file in pkgIndex.tcl fr.msg ja.msg; do\
cp -f msgs/$$file $(ROOTDIR)$(MOODSSLIBDIR)/msgs/;\
done
mkdir -p $(ROOTDIR)$(MOODSSLIBDIR)/instance
for file in pkgIndex.tcl instance.tcl; do\
cp -f instance/$$file $(ROOTDIR)$(MOODSSLIBDIR)/instance/;\
done
# SQLite package, eventually install library (http://www.hwaci.com/sw/sqlite/):
if $(INCLUDESQLITE); then\
mkdir -p $(ROOTDIR)$(MOODSSLIBDIR)/sqlite;\
echo 'package ifneeded sqlite 2 [list load [file join $$dir tclsqlite.so]]' > $(ROOTDIR)$(MOODSSLIBDIR)/sqlite/pkgIndex.tcl;\
echo 'package ifneeded sqlite3 3 [list load [file join $$dir tclsqlite3.so] sqlite3]' >> $(ROOTDIR)$(MOODSSLIBDIR)/sqlite/pkgIndex.tcl;\
if [ -f sqlite/tclsqlite.so ]; then\
cp -f sqlite/tclsqlite.so $(ROOTDIR)$(MOODSSLIBDIR)/sqlite/;\
fi;\
if [ -f sqlite/tclsqlite3.so ]; then\
cp -f sqlite/tclsqlite3.so $(ROOTDIR)$(MOODSSLIBDIR)/sqlite/;\
fi;\
fi
cp -f documentation/moodss.1 $(ROOTDIR)$(MANDIR)/man1/
# in HTML documentation, convert relative URLs for modules to absolute ones:
sed -e 's,<a href="../,<a href="$(MODULESDIR)/,;' documentation/modules.htm > $(ROOTDIR)$(MOODSSDOCDIR)/modules.htm
cd documentation;\
cp -f README CHANGES INSTALL DEVELOPMENT COPYRIGHT BUGS TODO moodss.htm moodss-ja.htm formulas.htm formulas-ja.htm FAQ.htm FAQ-ja.htm develop.htm database.htm *.gif $(ROOTDIR)$(MOODSSDOCDIR)/;\
cd ..
clean:
rm -f moodss htmldata.tcl htmldata-ja.tcl packlibs/htmldata.tcl packlibs/htmldata-ja.tcl packlibs/libfilesystem.so.1.1 packlibs/libnetwork.so.1.20 packlibs/liblogging.so.1.0
# combine all source into a single Tcl code file:
moodss:
rm -f $@
echo '#!$(WISH)' > $@
$(TCLSH) source.tcl moodss.tcl | sed\
-e 's/if {\[catch {package require stooop.*/if {1} {/;' -e 's/if {\[catch {package require switched.*/if {1} {/;'\
-e 's/if {\[catch {package require scwoop.*/if {1} {/;' -e 's/if {\[catch {package require tkpiechart.*/if {1} {/;'\
-e 's/if {\[catch {package require BWidget.*/if {1} {/;' >> $@
chmod 755 $@
htmldata.tcl: documentation/moodss.htm documentation/formulas.htm
# fix local image links according to final installation directory
$(TCLSH) genhtml.tcl moodsshelp htmlHelpContents htmlHelpData < documentation/moodss.htm |\
sed -e 's,<img src=",<img src="$(MOODSSHTMLDIR)/,g;' > $@
$(TCLSH) genhtml.tcl '' htmlFormulasHelpContents htmlFormulasHelpData < documentation/formulas.htm |\
sed -e 's,<img src=",<img src="$(MOODSSHTMLDIR)/,g;' >> $@
cd packlibs/ && ln -f -s ../$@ $@ && cd ..
htmldata-ja.tcl: documentation/moodss-ja.htm documentation/formulas-ja.htm
# fix local image links according to final installation directory
LANG=ja $(TCLSH) genhtml.tcl moodsshelp htmlHelpContents htmlHelpData < documentation/moodss-ja.htm |\
sed -e 's,<img src=",<img src="$(MOODSSHTMLDIR)/,g;' > $@
LANG=ja $(TCLSH) genhtml.tcl '' htmlFormulasHelpContents htmlFormulasHelpData < documentation/formulas-ja.htm |\
sed -e 's,<img src=",<img src="$(MOODSSHTMLDIR)/,g;' >> $@
cd packlibs/ && ln -f -s ../$@ $@ && cd ..
libtclstub.a::
LIBRARY="$(TCLLIBDIR)/libtclstub`echo 'puts $$tcl_version' | $(TCLSH)`.a"; export LIBRARY;\
rm -f $@; test -f $$LIBRARY && ln -s $$LIBRARY $@ || ln -s $(TCLLIBDIR)/$@ $@
packlibs/libfilesystem.so.1.1: packlibs/filesystem.c libtclstub.a
$(CC) -shared -fPIC -DUSE_TCL_STUBS $(CFLAGS) $(INCLUDES) -o $@ $?
packlibs/libnetwork.so.1.20: packlibs/network.c libtclstub.a
$(CC) -shared -fPIC -DUSE_TCL_STUBS $(CFLAGS) $(INCLUDES) -o $@ $? $(EXTRALIBS)
packlibs/liblogging.so.1.0: packlibs/logging.c libtclstub.a
$(CC) -shared -fPIC -DUSE_TCL_STUBS $(CFLAGS) $(INCLUDES) -o $@ $?
|