]> arthur.barton.de Git - netdata.git/blob - src/plugins.d/Makefile
makefile cleanups; math is enabled by default - added make flags nomath=1 to disable...
[netdata.git] / src / plugins.d / Makefile
1 ifndef BIN_DIR\r
2 BIN_DIR = "$(PWD)"\r
3 endif\r
4 \r
5 ifndef CONFIG_DIR\r
6 CONFIG_DIR = "conf.d"\r
7 endif\r
8 \r
9 ifndef LOG_DIR\r
10 LOG_DIR = "log"\r
11 endif\r
12 \r
13 ifndef PLUGINS_DIR\r
14 PLUGINS_DIR = "plugins.d"\r
15 endif\r
16 \r
17 COMMON_FLAGS = BIN_DIR='$(BIN_DIR)' CONFIG_DIR='$(CONFIG_DIR)' LOG_DIR='$(LOG_DIR)' PLUGINS_DIR='$(PLUGINS_DIR)'\r
18 \r
19 CC = gcc\r
20 \r
21 ifdef debug\r
22 COMMON_FLAGS += debug=1\r
23 CFLAGS = -Wall -Wextra -ggdb -DBIN_DIR='$(BIN_DIR)' -DCONFIG_DIR='$(CONFIG_DIR)' -DLOG_DIR='$(LOG_DIR)' -DPLUGINS_DIR='$(PLUGINS_DIR)'\r
24 else\r
25 CFLAGS = -Wall -Wextra -O3 -DBIN_DIR='$(BIN_DIR)' -DCONFIG_DIR='$(CONFIG_DIR)' -DLOG_DIR='$(LOG_DIR)' -DPLUGINS_DIR='$(PLUGINS_DIR)'\r
26 endif\r
27 \r
28 all: options plugins\r
29 \r
30 options:\r
31         @echo "    COMPILING WITH OPTIONS: $(CFLAGS)"\r
32 \r
33 plugins: apps.plugin\r
34 \r
35 apps.plugin: apps_plugin.c\r
36         @echo "    $(CC) $@"\r
37         @$(CC) $(CFLAGS) -o $@ apps_plugin.c\r
38 \r
39 clean:\r
40         -rm -f *.o apps.plugin core\r
41 \r
42 install: all\r
43         @echo; \\r
44         echo "    INSTALLING apps.plugin to $(PLUGINS_DIR)"; \\r
45         if [ -f $(PLUGINS_DIR)/apps.plugin ]; \\r
46         then \\r
47                 mv -f $(PLUGINS_DIR)/apps.plugin $(PLUGINS_DIR)/apps.plugin.old; \\r
48         fi; \\r
49         cp apps.plugin $(PLUGINS_DIR)/; \\r
50         if [ ! "$$USER" = "root" ]; \\r
51         then \\r
52                 echo; \\r
53                 echo " >>> apps.plugin requires root access to access files in /proc"; \\r
54                 echo " >>> Please authorize it!"; \\r
55                 echo; \\r
56                 sudo chown root $(PLUGINS_DIR)/apps.plugin; \\r
57                 sudo chmod 4775 $(PLUGINS_DIR)/apps.plugin; \\r
58         else \\r
59                 chown root $(PLUGINS_DIR)/apps.plugin; \\r
60                 chmod 4775 $(PLUGINS_DIR)/apps.plugin; \\r
61         fi; \\r
62         echo;\r
63 \r
64 .PHONY: options all plugins clean install\r