1# Xymon - common tools
2#
3
4PROGRAMS = xymongrep xymondigest xymon xymoncmd xymonlaunch xymoncfg
5CLIENTPROGRAMS = ../client/xymon ../client/xymonlaunch ../client/xymoncmd ../client/xymongrep ../client/xymoncfg ../client/xymondigest
6
7HOSTGREPOBJS = xymongrep.o
8HOSTSHOWOBJS = xymoncfg.o
9DIGESTOBJS   = xymondigest.o
10XYMONOBJS    = xymon.o
11LAUNCHOBJS   = xymonlaunch.o
12CMDOBJS      = xymoncmd.o
13
14XYMONCLIENTLIB = ../lib/libxymonclient.a
15XYMONCLIENTLIBS = $(XYMONCLIENTLIB)
16XYMONCLIENTCOMMLIB = ../lib/libxymonclientcomm.a
17XYMONCLIENTCOMMLIBS = $(XYMONCLIENTCOMMLIB) $(SSLLIBS) $(NETLIBS) $(LIBRTDEF)
18
19XYMONLIB = ../lib/libxymon.a
20XYMONLIBS = $(XYMONLIB)
21XYMONCOMMLIB = ../lib/libxymoncomm.a
22XYMONCOMMLIBS = $(XYMONCOMMLIB) $(SSLLIBS) $(NETLIBS) $(ZLIBLIBS) $(LIBRTDEF)
23XYMONTIMELIB = ../lib/libxymontime.a
24XYMONTIMELIBS = $(XYMONTIMELIB) $(LIBRTDEF)
25
26all: $(PROGRAMS)
27
28client: $(CLIENTPROGRAMS)
29
30xymongrep: $(HOSTGREPOBJS) $(XYMONCOMMLIB) $(XYMONLIB)
31	$(CC) $(CFLAGS) -o $@ $(HOSTGREPOBJS) $(XYMONCOMMLIBS) $(XYMONLIBS)
32
33../client/xymongrep: $(HOSTGREPOBJS) $(XYMONCLIENTCOMMLIB) $(XYMONCLIENTLIB)
34	$(CC) $(CFLAGS) -o $@ $(HOSTGREPOBJS) $(XYMONCLIENTCOMMLIBS) $(XYMONCLIENTLIBS)
35
36xymoncfg: $(HOSTSHOWOBJS) $(XYMONLIB)
37	$(CC) $(CFLAGS) -o $@ $(HOSTSHOWOBJS) $(XYMONLIBS)
38
39../client/xymoncfg: $(HOSTSHOWOBJS) $(XYMONCLIENTLIB)
40	$(CC) $(CFLAGS) -o $@ $(HOSTSHOWOBJS) $(XYMONCLIENTLIBS)
41
42xymon: $(XYMONOBJS) $(XYMONCOMMLIB) $(XYMONLIB)
43	$(CC) $(CFLAGS) -o $@ $(XYMONOBJS) $(XYMONCOMMLIBS) $(XYMONLIBS)
44
45../client/xymon: $(XYMONOBJS) $(XYMONCLIENTCOMMLIB) $(XYMONCLIENTLIB)
46	$(CC) $(CFLAGS) -o $@ $(XYMONOBJS) $(XYMONCLIENTCOMMLIBS) $(XYMONCLIENTLIBS)
47
48xymonlaunch: $(LAUNCHOBJS) $(XYMONTIMELIB) $(XYMONLIB)
49	$(CC) $(CFLAGS) -o $@ $(LAUNCHOBJS) $(XYMONTIMELIBS) $(XYMONLIBS)
50
51../client/xymonlaunch: $(LAUNCHOBJS) $(XYMONTIMELIB) $(XYMONCLIENTLIB)
52	$(CC) $(CFLAGS) -o $@ $(LAUNCHOBJS) $(XYMONTIMELIBS) $(XYMONCLIENTLIBS)
53
54xymoncmd: $(CMDOBJS) $(XYMONLIB)
55	$(CC) $(CFLAGS) -o $@ $(CMDOBJS) $(XYMONLIBS)
56
57../client/xymoncmd: $(CMDOBJS) $(XYMONCLIENTLIB)
58	$(CC) $(CFLAGS) -o $@ $(CMDOBJS) $(XYMONCLIENTLIBS)
59
60xymondigest: $(DIGESTOBJS) $(XYMONLIB)
61	$(CC) $(CFLAGS) -o $@ $(DIGESTOBJS) $(XYMONCOMMLIBS) $(XYMONLIBS)
62
63../client/xymondigest: $(DIGESTOBJS) $(XYMONCLIENTCOMMLIB) $(XYMONCLIENTLIB)
64	$(CC) $(CFLAGS) -o $@ $(DIGESTOBJS) $(XYMONCLIENTCOMMLIBS) $(XYMONCLIENTLIBS)
65
66
67xymon.exe: xymon.c ../lib/strfunc.c ../lib/errormsg.c ../lib/environ.c ../lib/stackio.c ../lib/timefunc.c ../lib/memory.c ../lib/sendmsg.c ../lib/holidays.c ../lib/rbtr.c ../lib/msort.c
68	$(CC) $(CFLAGS) -c xymon.c
69	$(CC) $(CFLAGS) -DXYMONTOPDIR=\"$(XYMONTOPDIR)\" -DXYMONLOGDIR=\"$(XYMONLOGDIR)\" -DXYMONHOSTNAME=\"$(XYMONHOSTNAME)\" -DXYMONHOSTIP=\"$(XYMONHOSTIP)\" -DXYMONHOSTOS=\"$(XYMONHOSTOS)\" -DXYMONHOME=\"$(XYMONHOME)\" -c ../lib/environ.c
70	$(CC) $(CFLAGS) -c ../lib/strfunc.c
71	$(CC) $(CFLAGS) -c ../lib/errormsg.c
72	$(CC) $(CFLAGS) -c ../lib/stackio.c
73	$(CC) $(CFLAGS) -c ../lib/timefunc.c
74	$(CC) $(CFLAGS) -c ../lib/memory.c
75	$(CC) $(CFLAGS) -c ../lib/sendmsg.c
76	$(CC) $(CFLAGS) -c ../lib/holidays.c
77	$(CC) $(CFLAGS) -c ../lib/rbtr.c
78	$(CC) $(CFLAGS) -c ../lib/msort.c
79	$(CC) $(CFLAGS) -c ../lib/misc.c
80	ar cr xymonwin32.a environ.o strfunc.o errormsg.o stackio.o timefunc.o memory.o sendmsg.o holidays.o rbtr.o msort.o misc.o
81	ranlib xymonwin32.a || echo ""
82	$(CC) -o $@ xymon.o xymonwin32.a
83
84
85################################################
86# Default compilation rules
87################################################
88%.o: %.c
89	$(CC) $(CFLAGS) -c -o $@ $<
90
91clean:
92	rm -f *.o *.a *~ $(PROGRAMS) $(CLIENTPROGRAMS)
93
94install: install-bin install-man
95
96install-bin: $(PROGRAMS)
97ifndef PKGBUILD
98	chown $(XYMONUSER) $(PROGRAMS)
99	chgrp `$(IDTOOL) -g $(XYMONUSER)` $(PROGRAMS)
100	chmod 755 $(PROGRAMS)
101endif
102	cp -fp $(PROGRAMS) $(INSTALLROOT)$(INSTALLBINDIR)/
103	cd $(INSTALLROOT)$(INSTALLBINDIR)/; rm -f bb bbcmd bbhostgrep bbhostshow; ln -s xymon bb; ln -s xymoncmd bbcmd; ln -s xymongrep bbhostgrep; ln -s xymondigest bbdigest; ln -s xymoncfg bbhostshow
104
105install-man:
106ifndef PKGBUILD
107	chown $(XYMONUSER) *.1 *.5 *.7 *.8
108	chgrp `$(IDTOOL) -g $(XYMONUSER)` *.1 *.5 *.7 *.8
109	chmod 644 *.1 *.5 *.7 *.8
110endif
111	mkdir -p $(INSTALLROOT)$(MANROOT)/man1 $(INSTALLROOT)$(MANROOT)/man5 $(INSTALLROOT)$(MANROOT)/man7 $(INSTALLROOT)$(MANROOT)/man8
112ifndef PKGBUILD
113	chown $(XYMONUSER) $(INSTALLROOT)$(MANROOT)/man1 $(INSTALLROOT)$(MANROOT)/man5 $(INSTALLROOT)$(MANROOT)/man7 $(INSTALLROOT)$(MANROOT)/man8
114	chgrp `$(IDTOOL) -g $(XYMONUSER)` $(INSTALLROOT)$(MANROOT)/man1 $(INSTALLROOT)$(MANROOT)/man5 $(INSTALLROOT)$(MANROOT)/man7 $(INSTALLROOT)$(MANROOT)/man8
115	chmod 755 $(INSTALLROOT)$(MANROOT)/man1 $(INSTALLROOT)$(MANROOT)/man5 $(INSTALLROOT)$(MANROOT)/man7 $(INSTALLROOT)$(MANROOT)/man8
116endif
117	cp -fp *.1 $(INSTALLROOT)$(MANROOT)/man1/
118	cp -fp *.5 $(INSTALLROOT)$(MANROOT)/man5/
119	cp -fp *.7 $(INSTALLROOT)$(MANROOT)/man7/
120	cp -fp *.8 $(INSTALLROOT)$(MANROOT)/man8/
121
122