sammler/Makefile
2006-10-08 01:58:01 +02:00

53 lines
999 B
Makefile

# Toplevel Makefile
WITH_RRD = yes
WITH_MYSQL = yes
# ############################
SAMMLER_SRC := sammler.c configfile.c logging.c network.c plugins.c
PLUGIN_SRC := p_ctstat.c p_load.c p_memory.c p_mount.c p_netdev.c p_random.c
PLUGIN_SRC += p_rtstat.c p_stat.c p_uptime.c p_vmstat.c
CFLAGS := -O2 -Wall
LDFLAGS := -ldl -rdynamic
# ############################
ifeq ("$(WITH_RRD)", "yes")
SAMMLER_SRC += rrdtool.c
CFLAGS += -DWITH_RRD
LDFLAGS += -lrrd
endif
ifeq ("$(WITH_MYSQL)", "yes")
PLUGIN_SRC += p_mysql.c
endif
# ############################
all: sammler $(PLUGIN_SRC:%.c=%.so)
sammler: $(SAMMLER_SRC:%.c=%.o)
$(CC) $(LDFLAGS) $^ -o $@
%.d: %.c
$(CC) $(CFLAGS) -MM -c $< -o $@
%.o: %.c
$(CC) $(CFLAGS) -o $@ -c $<
%_sh.o: %.c
$(CC) $(CFLAGS) -fPIC -o $@ -c $<
p_mysql.so: p_mysql_sh.o p_mysql_helper_sh.o
$(LD) -shared -lmysqlclient -o $@ $^
%.so: %_sh.o
$(LD) -shared -o $@ $<
clean:
rm -rf *.d *.o *.so sammler
#-include $(SAMMLER_SRC:.c=.d) $(PLUGIN_SRC:.c=.d)