aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Łyszczek <michal.lyszczek@bofc.pl>2020-05-29 18:16:33 +0200
committerMichał Łyszczek <michal.lyszczek@bofc.pl>2020-05-29 18:16:33 +0200
commit8b09eab8df86a8dfd8af3437c8173c590b577849 (patch)
treee961291d0f5d60490b998e9cc61cd1523ae2de69
parente82d130bd9dcdad7849c3251623897cd52414d6c (diff)
downloadembedlog-8b09eab8df86a8dfd8af3437c8173c590b577849.tar.gz
embedlog-8b09eab8df86a8dfd8af3437c8173c590b577849.tar.bz2
embedlog-8b09eab8df86a8dfd8af3437c8173c590b577849.zip
cleanup building examples and tests
Remove links in examples/ and tst/ directories that were used to "staticaly" build embedlog with test and examples. Instead really link statically with libembedlog.a. This nicely cleans clutter in directories and Makefile.am. Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
-rw-r--r--configure.ac22
-rw-r--r--embedlog-sources.mk27
-rw-r--r--examples/Makefile.am27
l---------examples/el-decode-number.c1
l---------examples/el-encode-number.c1
l---------examples/el-file.c1
l---------examples/el-flush.c1
l---------examples/el-lock.c1
l---------examples/el-options.c1
l---------examples/el-pbinary.c1
l---------examples/el-perror.c1
l---------examples/el-pmemory.c1
l---------examples/el-print.c1
l---------examples/el-puts.c1
l---------examples/el-ts.c1
l---------examples/el-tty.c1
l---------examples/el-utils.c1
l---------examples/el-utils.h1
l---------examples/snprintf.c1
-rw-r--r--src/Makefile.am28
-rw-r--r--tst/Makefile.am13
l---------tst/el-decode-number.c1
l---------tst/el-encode-number.c1
l---------tst/el-file.c1
l---------tst/el-flush.c1
l---------tst/el-lock.c1
l---------tst/el-options.c1
l---------tst/el-pbinary.c1
l---------tst/el-perror.c1
l---------tst/el-pmemory.c1
l---------tst/el-print.c1
l---------tst/el-puts.c1
l---------tst/el-ts.c1
l---------tst/el-tty.c1
l---------tst/el-utils.c1
l---------tst/el-utils.h1
l---------tst/snprintf.c1
37 files changed, 74 insertions, 75 deletions
diff --git a/configure.ac b/configure.ac
index e27ded9..e1939b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,6 +78,26 @@ AC_CONFIG_FILES(include/embedlog.h)
#
###
+# --enable-dev
+#
+# Not to be used on production, this enables some macros that adds
+# some code to library that is completaly useless on production.
+# This is mainly code for marking some tests, which would be extra
+# hard to implement without extra code in production library.
+#
+
+
+AC_ARG_ENABLE([dev],
+ AS_HELP_STRING([--enable-dev], [Enable developer mode]),
+ [], [enable_dev="no"])
+
+AS_IF([test "x$enable_dev" = "xyes"],
+[
+ AC_DEFINE([RUN_TESTS], [1], [Enables extra code for testing purposes])
+])
+
+
+###
# --enable-out-stderr
#
@@ -520,3 +540,5 @@ echo "maximum function namelength. : $EL_FUNCLEN_MAX"
echo "maximum log message......... : $EL_LOG_MAX"
echo "maximum path length......... : $MAX_PATH"
echo "pmemory line size........... : $EL_MEM_LINE_SIZE"
+echo
+echo "developer mode.............. : $enable_dev"
diff --git a/embedlog-sources.mk b/embedlog-sources.mk
index f238661..e69de29 100644
--- a/embedlog-sources.mk
+++ b/embedlog-sources.mk
@@ -1,27 +0,0 @@
-embedlog_sources = el-options.c \
- el-perror.c \
- el-pmemory.c \
- el-print.c \
- el-puts.c \
- el-ts.c \
- el-flush.c \
- el-utils.c \
- snprintf.c
-
-if ENABLE_OUT_FILE
-embedlog_sources += el-file.c
-endif
-
-if ENABLE_OUT_TTY
-embedlog_sources += el-tty.c
-endif
-
-if ENABLE_BINARY_LOGS
-embedlog_sources += el-pbinary.c \
- el-decode-number.c \
- el-encode-number.c
-endif
-
-if ENABLE_PTHREAD
-embedlog_sources += el-lock.c
-endif
diff --git a/examples/Makefile.am b/examples/Makefile.am
index adaa4d5..c14f881 100644
--- a/examples/Makefile.am
+++ b/examples/Makefile.am
@@ -1,17 +1,32 @@
-include $(top_srcdir)/embedlog-sources.mk
CFLAGS += -I$(top_builddir)/include -I$(top_srcdir)/src
+VLDFLAGS = -static
+VLDADD = $(top_builddir)/src/libembedlog.la
+
EXTRA_PROGRAMS = print_to_file \
print_options \
print_simple \
print_memory \
print_tty
-print_to_file_SOURCES = print-to-file.c $(embedlog_sources)
-print_options_SOURCES = print-options.c $(embedlog_sources)
-print_simple_SOURCES = print-simple.c $(embedlog_sources)
-print_memory_SOURCES = print-memory.c $(embedlog_sources)
-print_tty_SOURCES = print-tty.c $(embedlog_sources)
+print_to_file_SOURCES = print-to-file.c
+print_options_SOURCES = print-options.c
+print_simple_SOURCES = print-simple.c
+print_memory_SOURCES = print-memory.c
+print_tty_SOURCES = print-tty.c
+
+print_to_file_LDFLAGS = $(VLDFLAGS)
+print_options_LDFLAGS = $(VLDFLAGS)
+print_simple_LDFLAGS = $(VLDFLAGS)
+print_memory_LDFLAGS = $(VLDFLAGS)
+print_tty_LDFLAGS = $(VLDFLAGS)
+
+print_to_file_LDADD = $(VLDADD)
+print_options_LDADD = $(VLDADD)
+print_simple_LDADD = $(VLDADD)
+print_memory_LDADD = $(VLDADD)
+print_tty_LDADD = $(VLDADD)
+.PHONY: examples
examples: $(EXTRA_PROGRAMS)
clean-local:
diff --git a/examples/el-decode-number.c b/examples/el-decode-number.c
deleted file mode 120000
index 268c6a8..0000000
--- a/examples/el-decode-number.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-decode-number.c \ No newline at end of file
diff --git a/examples/el-encode-number.c b/examples/el-encode-number.c
deleted file mode 120000
index c90c2c0..0000000
--- a/examples/el-encode-number.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-encode-number.c \ No newline at end of file
diff --git a/examples/el-file.c b/examples/el-file.c
deleted file mode 120000
index 12ef212..0000000
--- a/examples/el-file.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-file.c \ No newline at end of file
diff --git a/examples/el-flush.c b/examples/el-flush.c
deleted file mode 120000
index 3291726..0000000
--- a/examples/el-flush.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-flush.c \ No newline at end of file
diff --git a/examples/el-lock.c b/examples/el-lock.c
deleted file mode 120000
index d509131..0000000
--- a/examples/el-lock.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-lock.c \ No newline at end of file
diff --git a/examples/el-options.c b/examples/el-options.c
deleted file mode 120000
index 7265099..0000000
--- a/examples/el-options.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-options.c \ No newline at end of file
diff --git a/examples/el-pbinary.c b/examples/el-pbinary.c
deleted file mode 120000
index 3e46c13..0000000
--- a/examples/el-pbinary.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-pbinary.c \ No newline at end of file
diff --git a/examples/el-perror.c b/examples/el-perror.c
deleted file mode 120000
index cc73051..0000000
--- a/examples/el-perror.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-perror.c \ No newline at end of file
diff --git a/examples/el-pmemory.c b/examples/el-pmemory.c
deleted file mode 120000
index 5dcc35f..0000000
--- a/examples/el-pmemory.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-pmemory.c \ No newline at end of file
diff --git a/examples/el-print.c b/examples/el-print.c
deleted file mode 120000
index 1b5a73a..0000000
--- a/examples/el-print.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-print.c \ No newline at end of file
diff --git a/examples/el-puts.c b/examples/el-puts.c
deleted file mode 120000
index 774e523..0000000
--- a/examples/el-puts.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-puts.c \ No newline at end of file
diff --git a/examples/el-ts.c b/examples/el-ts.c
deleted file mode 120000
index 478d0cd..0000000
--- a/examples/el-ts.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-ts.c \ No newline at end of file
diff --git a/examples/el-tty.c b/examples/el-tty.c
deleted file mode 120000
index b69c4ac..0000000
--- a/examples/el-tty.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-tty.c \ No newline at end of file
diff --git a/examples/el-utils.c b/examples/el-utils.c
deleted file mode 120000
index 822a39d..0000000
--- a/examples/el-utils.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-utils.c \ No newline at end of file
diff --git a/examples/el-utils.h b/examples/el-utils.h
deleted file mode 120000
index 2315c63..0000000
--- a/examples/el-utils.h
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-utils.h \ No newline at end of file
diff --git a/examples/snprintf.c b/examples/snprintf.c
deleted file mode 120000
index 52193de..0000000
--- a/examples/snprintf.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/snprintf.c \ No newline at end of file
diff --git a/src/Makefile.am b/src/Makefile.am
index 27d86a5..b446fba 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,30 @@
-include $(top_srcdir)/embedlog-sources.mk
+embedlog_sources = el-options.c \
+ el-perror.c \
+ el-pmemory.c \
+ el-print.c \
+ el-puts.c \
+ el-ts.c \
+ el-flush.c \
+ el-utils.c \
+ snprintf.c
+
+if ENABLE_OUT_FILE
+embedlog_sources += el-file.c
+endif
+
+if ENABLE_OUT_TTY
+embedlog_sources += el-tty.c
+endif
+
+if ENABLE_BINARY_LOGS
+embedlog_sources += el-pbinary.c \
+ el-decode-number.c \
+ el-encode-number.c
+endif
+
+if ENABLE_PTHREAD
+embedlog_sources += el-lock.c
+endif
lib_LTLIBRARIES = libembedlog.la
diff --git a/tst/Makefile.am b/tst/Makefile.am
index 75eca05..fb571ba 100644
--- a/tst/Makefile.am
+++ b/tst/Makefile.am
@@ -1,9 +1,7 @@
include Makefile.am.coverage
-include $(top_srcdir)/embedlog-sources.mk
check_PROGRAMS = test
-test_SOURCES = $(embedlog_sources)
-test_SOURCES += main.c \
+test_SOURCES = main.c \
test-el-options.c \
test-el-print.c \
test-el-file.c \
@@ -15,14 +13,11 @@ test_SOURCES += main.c \
test_CFLAGS = -I$(top_builddir)/include \
-I$(top_srcdir)/src \
- -I/usr/local/include \
- -I/usr/include \
- -DRUN_TESTS=1 \
$(COVERAGE_CFLAGS)
-test_LDFLAGS = -L/usr/local/lib \
- -L/usr/lib \
- $(COVERAGE_LDFLAGS)
+test_LDFLAGS = \
+ $(COVERAGE_LDFLAGS) \
+ -Wl,-Bstatic $(top_builddir)/src/libembedlog.la -Wl,-Bdynamic
test_LDADD = -lrb
TESTS = $(check_PROGRAMS)
diff --git a/tst/el-decode-number.c b/tst/el-decode-number.c
deleted file mode 120000
index 268c6a8..0000000
--- a/tst/el-decode-number.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-decode-number.c \ No newline at end of file
diff --git a/tst/el-encode-number.c b/tst/el-encode-number.c
deleted file mode 120000
index c90c2c0..0000000
--- a/tst/el-encode-number.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-encode-number.c \ No newline at end of file
diff --git a/tst/el-file.c b/tst/el-file.c
deleted file mode 120000
index 12ef212..0000000
--- a/tst/el-file.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-file.c \ No newline at end of file
diff --git a/tst/el-flush.c b/tst/el-flush.c
deleted file mode 120000
index 3291726..0000000
--- a/tst/el-flush.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-flush.c \ No newline at end of file
diff --git a/tst/el-lock.c b/tst/el-lock.c
deleted file mode 120000
index d509131..0000000
--- a/tst/el-lock.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-lock.c \ No newline at end of file
diff --git a/tst/el-options.c b/tst/el-options.c
deleted file mode 120000
index 7265099..0000000
--- a/tst/el-options.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-options.c \ No newline at end of file
diff --git a/tst/el-pbinary.c b/tst/el-pbinary.c
deleted file mode 120000
index 3e46c13..0000000
--- a/tst/el-pbinary.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-pbinary.c \ No newline at end of file
diff --git a/tst/el-perror.c b/tst/el-perror.c
deleted file mode 120000
index cc73051..0000000
--- a/tst/el-perror.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-perror.c \ No newline at end of file
diff --git a/tst/el-pmemory.c b/tst/el-pmemory.c
deleted file mode 120000
index 5dcc35f..0000000
--- a/tst/el-pmemory.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-pmemory.c \ No newline at end of file
diff --git a/tst/el-print.c b/tst/el-print.c
deleted file mode 120000
index 1b5a73a..0000000
--- a/tst/el-print.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-print.c \ No newline at end of file
diff --git a/tst/el-puts.c b/tst/el-puts.c
deleted file mode 120000
index 774e523..0000000
--- a/tst/el-puts.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-puts.c \ No newline at end of file
diff --git a/tst/el-ts.c b/tst/el-ts.c
deleted file mode 120000
index 478d0cd..0000000
--- a/tst/el-ts.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-ts.c \ No newline at end of file
diff --git a/tst/el-tty.c b/tst/el-tty.c
deleted file mode 120000
index b69c4ac..0000000
--- a/tst/el-tty.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-tty.c \ No newline at end of file
diff --git a/tst/el-utils.c b/tst/el-utils.c
deleted file mode 120000
index 822a39d..0000000
--- a/tst/el-utils.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-utils.c \ No newline at end of file
diff --git a/tst/el-utils.h b/tst/el-utils.h
deleted file mode 120000
index 2315c63..0000000
--- a/tst/el-utils.h
+++ /dev/null
@@ -1 +0,0 @@
-../src/el-utils.h \ No newline at end of file
diff --git a/tst/snprintf.c b/tst/snprintf.c
deleted file mode 120000
index 52193de..0000000
--- a/tst/snprintf.c
+++ /dev/null
@@ -1 +0,0 @@
-../src/snprintf.c \ No newline at end of file