diff options
author | louis <louis.braun@gmx.de> | 2014-05-09 15:41:31 +0200 |
---|---|---|
committer | louis <louis.braun@gmx.de> | 2014-05-09 15:41:31 +0200 |
commit | 9ebafce3fdc930a4f2efcc3fe2501c15a7227b73 (patch) | |
tree | 55f6be65dce96855abc6d6aeef39f3cd658a97af /lib | |
parent | ca71c83e5d68f7995442c5c3a9f0d61fed1d2224 (diff) | |
download | vdr-plugin-scraper2vdr-9ebafce3fdc930a4f2efcc3fe2501c15a7227b73.tar.gz vdr-plugin-scraper2vdr-9ebafce3fdc930a4f2efcc3fe2501c15a7227b73.tar.bz2 |
some fixes in logging
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Makefile | 73 | ||||
-rw-r--r-- | lib/db.h | 6 |
2 files changed, 70 insertions, 9 deletions
diff --git a/lib/Makefile b/lib/Makefile index 0716ea6..a50f78e 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,14 +1,75 @@ +# +# Makefile +# +# See the README file for copyright information and how to reach the author. +# -BASELIBS = -lrt -lz -lmysqlclient -lcurl -luuid +LIBTARGET = libhorchi +HLIB = -L. -lhorchi + +DEMO = demo +TEST = tst + +LIBOBJS = common.o curl.o imgtools.o config.o db.o tabledef.o dbdict.o + +CC = g++ +doCompile = $(CC) -c $(CFLAGS) $(DEFINES) +doLink = $(CC) $(LFLAGS) +doLib = ar -rs + +BASELIBS = -lrt -lz -lmysqlclient -lcurl -luuid -lcrypto BASELIBS += $(shell mysql_config --libs) +DEBUG = 1 + +ifdef DEBUG + CFLAGS += -ggdb -O0 +endif + +CFLAGS += -fPIC -Wreturn-type -Wall -Wno-parentheses -Wformat -pedantic -Wunused-variable -Wunused-label \ + -Wunused-value -Wunused-function \ + -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 + CFLAGS += $(shell mysql_config --include) -all: - g++ -ggdb -DPLGDIR='"."' $(CFLAGS) test.c dbdict.c common.c config.c db.c tabledef.c $(BASELIBS) -o t +DEFINES = -DPLGDIR='"."' -DUSEUUID -DUSEMD5 + +all: lib $(TEST) $(DEMO) +lib: $(LIBTARGET).a -demo: demo.c - g++ -ggdb -DUSEUUID -DPLGDIR='"."' $(CFLAGS) demo.c common.c db.c tabledef.c config.c $(BASELIBS) -o demo +$(LIBTARGET).a : $(LIBOBJS) + @echo Building Lib ... + $(doLib) $@ $(LIBOBJS) + +tst: test.o + $(doLink) test.o $(HLIB) $(BASELIBS) -o $@ + +demo: demo.o + $(doLink) demo.o $(HLIB) $(BASELIBS) -o $@ clean: - rm -f *.o *.a *~ core demo + rm -f *.o *~ core $(TEST) $(DEMO) $(LIBTARGET).a + +cppchk: + cppcheck --template="{file}:{line}:{severity}:{message}" --quiet --force *.c *.h + +%.o: %.c + @echo Compile "$(*F)" ... + $(doCompile) $(*F).c -o $@ + +#-------------------------------------------------------- +# dependencies +#-------------------------------------------------------- + +HEADER = db.h common.h config.h + +common.o : common.c $(HEADER) common.h +curl.o : curl.c $(HEADER) +imgtools.o : imgtools.c $(HEADER) imgtools.h +config.o : config.c $(HEADER) config.h +db.o : db.c $(HEADER) db.h +tabledef.o : tabledef.c $(HEADER) tabledef.h +dbdict.o : dbdict.c $(HEADER) dbdict.h + +demo.o : demo.c $(HEADER) +test.o : test.c $(HEADER) @@ -455,9 +455,9 @@ class cDbStatements void append(cDbStatement* s) { statements.push_back(s); } void remove(cDbStatement* s) { statements.remove(s); } - void showStat() + void showStat(const char* name) { - tell(0, "Statement statistic of last %ld seconds:", statisticPeriod); + tell(0, "Statement statistic of last %ld seconds from '%s':", time(0) - statisticPeriod, name); for (std::list<cDbStatement*>::iterator it = statements.begin() ; it != statements.end(); ++it) { @@ -756,7 +756,7 @@ class cDbConnection int errorSql(cDbConnection* mysql, const char* prefix, MYSQL_STMT* stmt = 0, const char* stmtTxt = 0); - void showStat() { statements.showStat(); } + void showStat(const char* name = "") { statements.showStat(name); } static int init() { |