X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=Makefile;h=052dff92685a0ce725385f6d059d60f2866b26e1;hb=471ddd68074c546156a01216fe2b99a3a7e64a04;hp=3db02ca369bac778bd1aecdf8b082262b9153313;hpb=7629ce9554acbbb1d76f42a840e87670eeb83752;p=netdata.git diff --git a/Makefile b/Makefile index 3db02ca3..052dff92 100755 --- a/Makefile +++ b/Makefile @@ -1,40 +1,45 @@ +ifndef BIN_DIR +BIN_DIR = "$(PWD)" +endif -CONFIG_DIR = "conf.d" -LOG_DIR = "log" -PLUGINS_DIR = "plugins.d" - -COMMON_FLAGS = -DCONFIG_DIR='$(CONFIG_DIR)' -DLOG_DIR='$(LOG_DIR)' -DPLUGINS_DIR='$(PLUGINS_DIR)' - -ifdef debug -CFLAGS = $(COMMON_FLAGS) -Wall -Wextra -ggdb -else -CFLAGS = $(COMMON_FLAGS) -Wall -Wextra -O3 +ifndef CONFIG_DIR +CONFIG_DIR = "$(PWD)/conf.d" endif -all: setuid +ifndef LOG_DIR +LOG_DIR = "$(PWD)/log" +endif -bin: netdata plugins +ifndef PLUGINS_DIR +PLUGINS_DIR = "$(PWD)/plugins.d" +endif -setuid: bin - @echo - @echo " >>> apps.plugin requires root access to access files in /proc" - @echo " >>> Please authorize it!" - @echo - sudo chown root plugins.d/apps.plugin - sudo chmod 4775 plugins.d/apps.plugin +COMMON_FLAGS = BIN_DIR='$(BIN_DIR)' CONFIG_DIR='$(CONFIG_DIR)' LOG_DIR='$(LOG_DIR)' PLUGINS_DIR='$(PLUGINS_DIR)' -netdata: netdata.c - $(CC) $(CFLAGS) -o netdata netdata.c -lpthread -lz +ifdef debug +COMMON_FLAGS += debug=1 +endif -plugins: plugins.d/apps.plugin +ifdef nozlib +COMMON_FLAGS += nozlib=1 +endif -plugins.d/apps.plugin: apps_plugin.c - $(CC) $(CFLAGS) -o plugins.d/apps.plugin apps_plugin.c +all: + $(MAKE) -C src $(COMMON_FLAGS) all clean: - rm -f *.o netdata plugins.d/apps.plugin core + $(MAKE) -C src clean + -rm -f netdata netdata.old plugins.d/apps.plugin plugins.d/apps.plugin.old + +install: + $(MAKE) -C src $(COMMON_FLAGS) install getconf: - wget -O conf.d/netdata.conf.new "http://localhost:19999/netdata.conf" - mv conf.d/netdata.conf conf.d/netdata.conf.old - mv conf.d/netdata.conf.new conf.d/netdata.conf + @wget -O conf.d/netdata.conf.new "http://localhost:19999/netdata.conf"; \ + if [ $$? -eq 0 -a -s conf.d/netdata.conf.new ]; \ + then \ + mv conf.d/netdata.conf conf.d/netdata.conf.old; \ + mv conf.d/netdata.conf.new conf.d/netdata.conf; \ + fi + +.PHONY: all clean install getconf