|
1 |
|
2 # TODO: |
|
3 # clarify situation with references. should we really reference objects, passed as args to callbacks? if someone will store that object in a global environment and use later? |
|
4 # autotools |
|
5 # switch to common object struct? |
|
6 # tests? |
|
7 # more examples |
|
8 # llm should use lua/stdlib, no dependency on glib? though it still needs glib headers... maybe, indirectly :/ |
|
9 # separate lm and glib, now it is completely different projects // and one, probably, will die... :( |
|
10 |
|
11 PREFIX=${PWD}/inst |
|
12 DOCDIR=$(PREFIX)/share/doc/liblua-loudmouth |
|
13 SOLIBDIR=$(PREFIX)/lib/lua/5.1 |
|
14 LUALIBDIR=$(PREFIX)/share/lua/5.1 |
|
15 |
|
16 |
|
17 CC=gcc |
|
18 LD=gcc |
|
19 LIBTOOL=libtool |
|
20 INSTALL=install |
|
21 |
|
22 CFLAGS=-g -O0 -Wall |
|
23 LDFLAGS=-g -O0 |
|
24 LTFLAGS= |
|
25 TARGETS=loudmouth.la glib.la |
|
26 |
|
27 LMCFLAGS=`pkg-config --cflags lua5.1 loudmouth-1.0 glib-2.0` |
|
28 GLIBCFLAGS=`pkg-config --cflags lua5.1 glib-2.0` |
|
29 |
|
30 # add this flag to cflags, if your loudmouth have lm_connection_get_keep_alive_rate () |
|
31 #LMCFLAGS += -DHAVE_LM_CONNECTION_GET_KEEP_ALIVE_RATE |
|
32 |
|
33 LMLIBS=`pkg-config --libs lua5.1 loudmouth-1.0 glib-2.0` |
|
34 GLIBLIBS=`pkg-config --libs lua5.1 glib-2.0` |
|
35 |
|
36 LMSOURCES=util.c lm_types.c lm_proxy.c lm_ssl.c lm_connection.c lm_message.c lm_message_node.c lm_message_handler.c lm.c |
|
37 GLIBSOURCES=glib.c glib_types.c glib_main_context.c glib_source.c glib_timeout.c util.c |
|
38 |
|
39 LMOBJECTS=$(LMSOURCES:.c=.lo) |
|
40 GLIBOBJECTS=$(GLIBSOURCES:.c=.lo) |
|
41 |
|
42 DOCS=$(TARGETS:.la=.html) |
|
43 |
|
44 all: $(TARGETS) |
|
45 |
|
46 loudmouth.la: $(LMOBJECTS) |
|
47 $(LIBTOOL) $(LTFLAGS) --mode=link $(LD) $(LDFLAGS) -module -rpath $(SOLIBDIR) -o $@ $^ $(LMLIBS) |
|
48 |
|
49 glib.la: $(GLIBOBJECTS) |
|
50 $(LIBTOOL) $(LTFLAGS) --mode=link $(LD) $(LDFLAGS) -module -rpath $(SOLIBDIR) -o $@ $^ $(GLIBLIBS) |
|
51 |
|
52 # FIXME: CFLAGS... |
|
53 %.lo: %.c |
|
54 $(LIBTOOL) $(LTFLAGS) --mode=compile $(CC) $(CFLAGS) $(LMCFLAGS) -c $^ |
|
55 |
|
56 test: loudmouth.la glib.la |
|
57 cd .libs && lua ../test.lua |
|
58 |
|
59 test2: glib.la |
|
60 cd .libs && lua ../test2.lua |
|
61 |
|
62 doc: $(DOCS) |
|
63 |
|
64 loudmouth.html: docgen.pl $(LMSOURCES) |
|
65 ./docgen.pl $(LMSOURCES) > $@ |
|
66 |
|
67 glib.html: docgen.pl $(GLIBSOURCES) |
|
68 ./docgen.pl $(GLIBSOURCES) > $@ |
|
69 |
|
70 install: $(TARGETS) $(SOLIBDIR) $(LUALIBDIR) |
|
71 $(LIBTOOL) $(LTFLAGS) --mode=install $(INSTALL) loudmouth.la $(SOLIBDIR)/loudmouth.la |
|
72 $(INSTALL) -m 644 lm.lua $(LUALIBDIR)/lm.lua |
|
73 $(LIBTOOL) $(LTFLAGS) --mode=install $(INSTALL) glib.la $(SOLIBDIR)/glib.la |
|
74 $(LIBTOOL) $(LTFLAGS) --mode=finish $(SOLIBDIR) |
|
75 |
|
76 install-doc: doc test.lua $(DOCDIR) |
|
77 $(INSTALL) -m 644 -t $(DOCDIR) $(DOCS) |
|
78 $(INSTALL) -d $(DOCDIR)/examples |
|
79 $(INSTALL) -m 644 -t $(DOCDIR)/examples test.lua |
|
80 |
|
81 $(PREFIX): |
|
82 $(INSTALL) -D -d $@ |
|
83 |
|
84 $(DOCDIR): $(PREFIX) |
|
85 $(INSTALL) -D -d $@ |
|
86 |
|
87 $(SOLIBDIR): $(PREFIX) |
|
88 $(INSTALL) -D -d $@ |
|
89 |
|
90 $(LUALIBDIR): $(PREFIX) |
|
91 $(INSTALL) -D -d $@ |
|
92 |
|
93 uninstall: |
|
94 $(LIBTOOL) $(LTFLAGS) --mode=uninstall rm -f $(SOLIBDIR)/loudmouth.la |
|
95 $(LIBTOOL) $(LTFLAGS) --mode=uninstall rm -f $(SOLIBDIR)/glib.la |
|
96 rm -f $(LUALIBDIR)/lm.lua |
|
97 |
|
98 clean: |
|
99 $(LIBTOOL) $(LTFLAGS) --mode=clean rm -f $(TARGETS) $(LMOBJECTS) $(GLIBOBJECTS) $(DOCS) |
|
100 |