summaryrefslogtreecommitdiff
path: root/lib/Makefile
blob: 9d23cdc2879f70f2ed5f61581b1d3d9eb359bd6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#
# Makefile
#
# See the README file for copyright information and how to reach the author.
#

include ../Make.config

LIBTARGET = libhorchi
HLIB      = -L. -lhorchi

DEMO = demo
TEST = tst

LIBOBJS = common.o config.o db.o epgservice.o dbdict.o json.o xml.o

ifdef USEJPEG
   LIBOBJS += imgtools.o
endif

ifdef USECURL
   LIBOBJS += curl.o configuration.o thread.o
endif

CFLAGS += $(shell pkg-config --cflags uuid)
CFLAGS += $(shell pkg-config --cflags zlib)

BASELIBS += -lrt
BASELIBS += $(shell mysql_config --libs_r)
BASELIBS += $(shell pkg-config --libs uuid)
BASELIBS += $(shell pkg-config --libs zlib)
BASELIBS += $(shell pkg-config --libs tinyxml2)

ifdef USECURL
   BASELIBS += -lcurl
endif

ifdef USEEPGS
   LIBOBJS += searchtimer.o
endif

ifdef USEPYTHON
   LIBOBJS += python.o
endif

ifdef USELIBXML
   BASELIBS += $(shell xml2-config --libs) $(shell xslt-config --libs)
endif

ifdef SYSD_NOTIFY
   BASELIBS  += $(shell pkg-config --libs libsystemd-daemon)
   CFLAGS += $(shell pkg-config --cflags libsystemd-daemon)
endif

CFLAGS += $(shell mysql_config --include)
DEFINES += $(USES)

all: lib $(TEST) $(DEMO)
lib: $(LIBTARGET).a

$(LIBTARGET).a : $(LIBOBJS)
	@echo Building Lib ...
	$(doLib) $@ $(LIBOBJS)

tst: test.o lib
	$(doLink) test.o $(HLIB) -larchive -lcrypto $(BASELIBS) -o $@

demo: demo.o lib
	$(doLink) demo.o $(HLIB) -larchive -lcrypto $(BASELIBS) -o $@

pytst: pytst.c python.c python.h hlib
	$(CC) $(CFLAGS) pytst.c python.c -L./lib -lhorchi $(DLIBS) -o pytst

clean:
	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) -O3 $(INCLUDES) -o $@ $<

#--------------------------------------------------------
# dependencies
#--------------------------------------------------------

HEADER = db.h common.h config.h dbdict.h

common.o          :  common.c           $(HEADER) common.h
configuration.o   :  configuration.c    $(HEADER) configuration.h
thread.o     		:  thread.c      		 $(HEADER) thread.h
curl.o       		:  curl.c        		 $(HEADER) curl.h
imgtools.o   		:  imgtools.c    		 $(HEADER) imgtools.h
config.o     		:  config.c      		 $(HEADER) config.h
db.o         		:  db.c          		 $(HEADER) db.h
epgservice.o 		:  epgservice.c  		 $(HEADER) epgservice.h
dbdict.o     		:  dbdict.c      		 $(HEADER) dbdict.h
json.o       		:  json.c        		 $(HEADER) json.h
xml.o       		:  xml.c        		 $(HEADER) xml.h
python.o          :  python.c           $(HEADER) python.h
searchtimer.o     :  searchtimer.c      $(HEADER) searchtimer.h

demo.o       		:  demo.c        		 $(HEADER)
test.o       		:  test.c        		 $(HEADER)