]> arthur.barton.de Git - netdata.git/commitdiff
makefile cleanups; math is enabled by default - added make flags nomath=1 to disable...
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Thu, 19 Mar 2015 20:38:12 +0000 (22:38 +0200)
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>
Thu, 19 Mar 2015 20:38:12 +0000 (22:38 +0200)
Makefile
src/Makefile
src/plugins.d/Makefile
src/unit_test.c

index 13a4f49f3fc3179d5e081d57b2425f1337a012b2..28943b469abbad6f4025af1b4b7356259477ea46 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -20,20 +20,16 @@ ifdef debug
 COMMON_FLAGS += debug=1\r
 endif\r
 \r
-.PHONY: all\r
 all: \r
        $(MAKE) -C src $(COMMON_FLAGS) all\r
 \r
-.PHONY: clean\r
 clean:\r
        $(MAKE) -C src clean\r
        -rm -f netdata netdata.old plugins.d/apps.plugin plugins.d/apps.plugin.old\r
 \r
-.PHONY: install\r
 install:\r
        $(MAKE) -C src $(COMMON_FLAGS) install\r
 \r
-.PHONY: getconf\r
 getconf:\r
        @wget -O conf.d/netdata.conf.new "http://localhost:19999/netdata.conf"; \\r
        if [ $$? -eq 0 -a -s conf.d/netdata.conf.new ]; \\r
@@ -41,3 +37,5 @@ getconf:
                mv conf.d/netdata.conf conf.d/netdata.conf.old; \\r
                mv conf.d/netdata.conf.new conf.d/netdata.conf; \\r
        fi\r
+\r
+.PHONY: all clean install getconf\r
index b5e52cb32faab9c5b01bbc823b23c09880d33c9a..ab3d9e6cdc1153f851b295c401f6deb189540d9e 100755 (executable)
@@ -14,6 +14,10 @@ ifndef PLUGINS_DIR
 PLUGINS_DIR = "plugins.d"
 endif
 
+ifndef nomath
+STORAGE_WITH_MATH = 1
+endif
+
 COMMON_FLAGS = BIN_DIR='$(BIN_DIR)' CONFIG_DIR='$(CONFIG_DIR)' LOG_DIR='$(LOG_DIR)' PLUGINS_DIR='$(PLUGINS_DIR)'
 
 ifdef debug
@@ -30,6 +34,7 @@ sources = procfile.c common.c log.c popen.c url.c config.c web_buffer.c storage_
 libs    = -pthread -lz
 
 ifdef STORAGE_WITH_MATH
+CFLAGS += -DSTORAGE_WITH_MATH=1
 libs += -lm
 endif
 
@@ -43,25 +48,22 @@ endif
 headers = $(patsubst %.c,%.h,$(sources))
 objects = $(patsubst %.c,%.o,$(sources) $(proc_sources))
 
-.PHONY: options
-options:
-       @echo "    COMPILING WITH OPTIONS: $(CFLAGS)"
+all: show_options netdata plugins
 
-all: options netdata plugins
+%.o: %.c ${headers}
+       @echo "    $(CC) $<"
+       @$(CC) $(CFLAGS) -c $< -o $@
 
 netdata: $(objects)
        @echo "    $(CC) netdata"
        @$(CC) -o netdata $(objects) $(libs)
 
-.PHONY: plugins
+show_options:
+       @echo "    COMPILING WITH OPTIONS: $(CFLAGS)"
+
 plugins:
        $(MAKE) -C plugins.d $(COMMON_FLAGS) all
 
-%.o: %.c ${headers}
-       @echo "    $(CC) $<"
-       @$(CC) $(CFLAGS) -c $< -o $@
-
-.PHONY: clean
 clean:
        $(MAKE) -C plugins.d clean
        rm -f *.o netdata core
@@ -76,3 +78,5 @@ install: all
        fi; \
        cp -f netdata $(BIN_DIR)/; \
        echo
+
+.PHONY: all show_options plugins clean install
index f8a6ee66ca6d718d9f25ad5f45efdefd3ac0a37f..20a924f7e5306c438415a7f2050d5ff965adaa95 100755 (executable)
@@ -25,14 +25,11 @@ else
 CFLAGS = -Wall -Wextra -O3 -DBIN_DIR='$(BIN_DIR)' -DCONFIG_DIR='$(CONFIG_DIR)' -DLOG_DIR='$(LOG_DIR)' -DPLUGINS_DIR='$(PLUGINS_DIR)'\r
 endif\r
 \r
-.PHONY: options\r
+all: options plugins\r
+\r
 options:\r
        @echo "    COMPILING WITH OPTIONS: $(CFLAGS)"\r
 \r
-.PHONY: all\r
-all: options plugins\r
-\r
-.PHONY: plugins\r
 plugins: apps.plugin\r
 \r
 apps.plugin: apps_plugin.c\r
@@ -64,3 +61,4 @@ install: all
        fi; \\r
        echo;\r
 \r
+.PHONY: options all plugins clean install\r
index 3750b961762be292f6d077a172503af2e4200d2b..3366ca7a44b80eaa1b87515f237d23a46efe73f8 100755 (executable)
@@ -8,7 +8,7 @@
 #include "log.h"
 #include "web_buffer.h"
 
-#define ACCURACY_LOSS 100.0000001
+#define ACCURACY_LOSS 0.0000001
 
 int check_storage_number(calculated_number n, int debug) {
        char buffer[100];
@@ -31,14 +31,14 @@ int check_storage_number(calculated_number n, int debug) {
                fprintf(stderr,
                        CALCULATED_NUMBER_FORMAT " original\n"
                        CALCULATED_NUMBER_FORMAT " packed and unpacked, (stored as 0x%08X, diff " CALCULATED_NUMBER_FORMAT ", " CALCULATED_NUMBER_FORMAT "%%)\n"
-                       "%s printed after unpacked (%lu bytes)\n"
+                       "%s printed after unpacked (%zu bytes)\n"
                        CALCULATED_NUMBER_FORMAT " re-parsed from printed (diff " CALCULATED_NUMBER_FORMAT ", " CALCULATED_NUMBER_FORMAT "%%)\n\n",
                        n,
                        d, s, ddiff, dcdiff,
                        buffer,
                        len, p, pdiff, pcdiff
                );
-               if(len != strlen(buffer)) fprintf(stderr, "ERROR: printed number %s is reported to have length %lu but it has %lu\n", buffer, len, strlen(buffer));
+               if(len != strlen(buffer)) fprintf(stderr, "ERROR: printed number %s is reported to have length %zu but it has %zu\n", buffer, len, strlen(buffer));
                if(dcdiff > ACCURACY_LOSS) fprintf(stderr, "WARNING: packing number " CALCULATED_NUMBER_FORMAT " has accuracy loss %0.7Lf %%\n", n, dcdiff);
                if(pcdiff > ACCURACY_LOSS) fprintf(stderr, "WARNING: re-parsing the packed, unpacked and printed number " CALCULATED_NUMBER_FORMAT " has accuracy loss %0.7Lf %%\n", n, pcdiff);
        }
@@ -63,8 +63,8 @@ void benchmark_storage_number(int loop, int multiplier) {
 
        // ------------------------------------------------------------------------
 
-       fprintf(stderr, "SYSTEM  LONG DOUBLE    SIZE: %lu bytes\n", sizeof(calculated_number));
-       fprintf(stderr, "NETDATA FLOATING POINT SIZE: %lu bytes\n", sizeof(storage_number));
+       fprintf(stderr, "SYSTEM  LONG DOUBLE    SIZE: %zu bytes\n", sizeof(calculated_number));
+       fprintf(stderr, "NETDATA FLOATING POINT SIZE: %zu bytes\n", sizeof(storage_number));
 
        mine = (calculated_number)sizeof(storage_number) * (calculated_number)loop;
        their = (calculated_number)sizeof(calculated_number) * (calculated_number)loop;