import.c: Count and (optionally) print max downtime depth
[nagios-reports-module.git] / Makefile
blob40e7531520fd753538484bc5a600ae1df8cb54c5
1 CC = gcc
2 CPPFLAGS = -I.
3 CFLAGS = $(OPTFLAGS) -Wall -ggdb3
4 #OPTFLAGS = -O2 -pipe
5 DSOLDFLAGS = -shared -nostartfiles $(SQL_LDFLAGS)
6 SQL_LDFLAGS = -L/usr/lib/mysql -lmysqlclient
7 TESTLDFLAGS = -ldl -rdynamic -Wl,-export-dynamic
8 OBJS = module.o hooks.o cfgfile.o logging.o sql.o utils.o hash.o mm.o
9 TEST_OBJS = test_utils.o utils.o hash.o mm.o
10 DEPS = Makefile module.h cfgfile.h utils.h
11 DSO = ndbneb.so
12 TESTPROG = nebtest
13 CONFIG_FILE = db.conf
14 DESTDIR = /tmp/ndbneb
15 ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
17 ifndef V
18 QUIET_CC = @echo ' ' CC $@;
19 QUIET_LINK = @echo ' ' LINK $@;
20 endif
22 all: $(DSO) $(TESTPROG) import
24 install: all
25 @echo "Installing to $(DESTDIR)"
26 @test -d $(DESTDIR) || mkdir -m 755 -p $(DESTDIR)
27 @cp -a scripts import $(DSO) $(TESTPROG) $(DESTDIR)
28 @cp -a db.conf $(DESTDIR)/ndbneb.conf
30 $(DSO): $(OBJS)
31 $(QUIET_LINK)$(CC) $(DSOLDFLAGS) $^ -o $@
33 $(TESTPROG): $(TESTPROG).o $(TEST_OBJS)
34 $(QUIET_LINK)$(CC) $(TESTLDFLAGS) $^ -o $@
36 import: import.o $(TEST_OBJS) sql.o hooks.o logging.o
37 $(QUIET_LINK)$(CC) $(SQL_LDFLAGS) $^ -o $@
39 test: mod $(TESTPROG) $(CONFIG_FILE)
40 ./$(TESTPROG) -f $(CONFIG_FILE) $(DSO)
42 mod: $(DSO)
44 %.o: %.c
45 $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) $<
47 %.so: %.c
48 @echo "CC $@"
49 @$(CC) $(CFLAGS) $(DSOLDFLAGS) $^ -o $@
51 clean:
52 rm -f core core.* *.{o,so,out,log} $(TESTPROG) import
54 #'^[^.%][A-Za-z0-9_]*:'
55 help:
56 @echo Available make targets:
57 @echo -----------------------
58 @$(MAKE) --print-data-base --question | sed -n -e '/^Makefile/d' -e 's/^\([A-Za-z0-9_]*\):.*/\1/p'
60 ## PHONY targets
61 .PHONY: clean help
63 # dependencies
64 $(TESTPROG).o: $(TESTPROG).c $(DEPS)
65 import.o: import.c hooks.h sql.h logging.h Makefile
66 logging.o: logging.c logging.h $(DEPS)
67 cfgfile.o: cfgfile.c cfgfile.h
68 sql.o: sql.c sql.h $(DEPS)
69 hash.o: hash.c hash.h
70 hooks.o: hooks.c sql.h hooks.h $(DEPS)
71 module.o: module.c hooks.h $(DEPS)
72 utils.o: utils.c utils.h