# Toplevel Makefile WITH_RRD = yes WITH_MYSQL = yes WITH_CURL = yes # ############################ SAMMLER_SRC := sammler.c configfile.c event.c helper.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 ifeq ("$(WITH_CURL)", "yes") PLUGIN_SRC += p_apache.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_apache.so: p_apache_sh.o $(LD) -shared -lcurl -o $@ $^ 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)