author | Tero Marttila <terom@fixme.fi> |
Sun, 15 Mar 2009 23:24:21 +0200 | |
changeset 58 | 65bd90f94f4e |
parent 56 | 942370000450 |
permissions | -rw-r--r-- |
0 | 1 |
# default is test |
2 |
ifndef MODE |
|
3 |
MODE = test |
|
4 |
endif |
|
5 |
||
6 |
ifeq ($(MODE), debug) |
|
7 |
MODE_CFLAGS = -g -DDEBUG_ENABLED |
|
8 |
else ifeq ($(MODE), dev) |
|
9 |
MODE_CFLAGS = -g |
|
10 |
else ifeq ($(MODE), test) |
|
11 |
MODE_CFLAGS = -g -DINFO_DISABLED |
|
12 |
else ifeq ($(MODE), release) |
|
13 |
MODE_CFLAGS = -DINFO_DISABLED -O2 |
|
14 |
endif |
|
15 |
||
25
56367df4ce5b
add irc_net module, and fix Makefile CFLAGS, add -Wextra
Tero Marttila <terom@fixme.fi>
parents:
23
diff
changeset
|
16 |
FIXED_CFLAGS = -Wall -Wextra -std=gnu99 |
0 | 17 |
|
2
a834f0559939
working SSL using gnutls - a bit of a painful process
Tero Marttila <terom@fixme.fi>
parents:
1
diff
changeset
|
18 |
# libevent |
9
4c4c906cc649
add sock_stream_callbacks and ev_base
Tero Marttila <terom@fixme.fi>
parents:
8
diff
changeset
|
19 |
LIBEVENT_CFLAGS = -I/home/terom/opt/include |
4c4c906cc649
add sock_stream_callbacks and ev_base
Tero Marttila <terom@fixme.fi>
parents:
8
diff
changeset
|
20 |
LIBEVENT_LDFLAGS = -L/home/terom/opt/lib -levent_core |
2
a834f0559939
working SSL using gnutls - a bit of a painful process
Tero Marttila <terom@fixme.fi>
parents:
1
diff
changeset
|
21 |
|
a834f0559939
working SSL using gnutls - a bit of a painful process
Tero Marttila <terom@fixme.fi>
parents:
1
diff
changeset
|
22 |
# GnuTLS stuff |
a834f0559939
working SSL using gnutls - a bit of a painful process
Tero Marttila <terom@fixme.fi>
parents:
1
diff
changeset
|
23 |
GNUTLS_NAME = "gnutls" |
a834f0559939
working SSL using gnutls - a bit of a painful process
Tero Marttila <terom@fixme.fi>
parents:
1
diff
changeset
|
24 |
GNUTLS_CFLAGS = $(shell pkg-config ${GNUTLS_NAME} --cflags) |
a834f0559939
working SSL using gnutls - a bit of a painful process
Tero Marttila <terom@fixme.fi>
parents:
1
diff
changeset
|
25 |
GNUTLS_LDFLAGS = $(shell pkg-config ${GNUTLS_NAME} --libs) |
a834f0559939
working SSL using gnutls - a bit of a painful process
Tero Marttila <terom@fixme.fi>
parents:
1
diff
changeset
|
26 |
|
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
27 |
# evsql stuff |
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
28 |
EVSQL_CFLAGS = |
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
29 |
EVSQL_LDFLAGS = -levsql -lpq |
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
30 |
|
40
51678c7eae03
add sock_test module and some basic initial tests
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
31 |
BIN_NAMES = nexus test |
0 | 32 |
BIN_PATHS = $(addprefix bin/,$(BIN_NAMES)) |
33 |
||
34 |
# modules |
|
35 |
module_objs = $(patsubst src/%.c,obj/%.o,$(wildcard src/$(1)/*.c)) |
|
36 |
||
56
942370000450
compiling, working, but still ugly module code
Tero Marttila <terom@fixme.fi>
parents:
55
diff
changeset
|
37 |
CORE_OBJS = obj/error.o obj/log.o |
1
cf0e1bb6bcab
a fancy socket abstraction layer, with TCP, next, SSL. Also, .hgignore
Tero Marttila <terom@fixme.fi>
parents:
0
diff
changeset
|
38 |
SOCK_OBJS = obj/sock.o obj/sock_tcp.o |
40
51678c7eae03
add sock_test module and some basic initial tests
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
39 |
SOCK_TEST_OBJS = obj/sock_test.o |
2
a834f0559939
working SSL using gnutls - a bit of a painful process
Tero Marttila <terom@fixme.fi>
parents:
1
diff
changeset
|
40 |
SOCK_GNUTLS_OBJS = obj/sock_gnutls.o |
8
be88e543c8ff
split off line_proto, and make sock_stream_error return a const error_info
Tero Marttila <terom@fixme.fi>
parents:
6
diff
changeset
|
41 |
LINEPROTO_OBJS = obj/line_proto.o |
56
942370000450
compiling, working, but still ugly module code
Tero Marttila <terom@fixme.fi>
parents:
55
diff
changeset
|
42 |
IRC_OBJS = obj/irc_line.o obj/irc_conn.o obj/irc_net.o obj/irc_chan.o obj/chain.o obj/irc_cmd.o obj/irc_proto.o obj/irc_client.o |
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
53
diff
changeset
|
43 |
NEXUS_OBJS = obj/signals.o obj/module.o |
23
542c73d07d3c
add a simple irc_log module (with evsql code) that joins a channel and log_info's PRIVMSGs
Tero Marttila <terom@fixme.fi>
parents:
21
diff
changeset
|
44 |
IRC_LOG_OBJS = obj/irc_log.o |
1
cf0e1bb6bcab
a fancy socket abstraction layer, with TCP, next, SSL. Also, .hgignore
Tero Marttila <terom@fixme.fi>
parents:
0
diff
changeset
|
45 |
|
0 | 46 |
# XXX: not yet there |
47 |
#CORE_OBJS = obj/lib/log.o obj/lib/signals.o |
|
48 |
||
49 |
# first target |
|
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
53
diff
changeset
|
50 |
all: ${BIN_PATHS} modules/irc_log.so |
0 | 51 |
|
52 |
# binaries |
|
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
53
diff
changeset
|
53 |
bin/nexus: ${CORE_OBJS} ${SOCK_OBJS} ${SOCK_GNUTLS_OBJS} ${LINEPROTO_OBJS} ${IRC_OBJS} ${IRC_LOG_OBJS} ${NEXUS_OBJS} |
0 | 54 |
|
40
51678c7eae03
add sock_test module and some basic initial tests
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
55 |
bin/test: ${CORE_OBJS} ${SOCK_OBJS} ${SOCK_GNUTLS_OBJS} ${SOCK_TEST_OBJS} ${LINEPROTO_OBJS} ${IRC_OBJS} |
51678c7eae03
add sock_test module and some basic initial tests
Tero Marttila <terom@fixme.fi>
parents:
37
diff
changeset
|
56 |
|
56
942370000450
compiling, working, but still ugly module code
Tero Marttila <terom@fixme.fi>
parents:
55
diff
changeset
|
57 |
modules/irc_log.so: ${CORE_OBJS} |
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
53
diff
changeset
|
58 |
|
0 | 59 |
# computed |
56
942370000450
compiling, working, but still ugly module code
Tero Marttila <terom@fixme.fi>
parents:
55
diff
changeset
|
60 |
CFLAGS = ${MODE_CFLAGS} ${FIXED_CFLAGS} ${LIBEVENT_CFLAGS} ${GNUTLS_CFLAGS} ${EVSQL_CFLAGS} -fpic |
942370000450
compiling, working, but still ugly module code
Tero Marttila <terom@fixme.fi>
parents:
55
diff
changeset
|
61 |
LDFLAGS = ${LIBEVENT_LDFLAGS} ${GNUTLS_LDFLAGS} ${EVSQL_LDFLAGS} -Wl,--export-dynamic |
0 | 62 |
|
2
a834f0559939
working SSL using gnutls - a bit of a painful process
Tero Marttila <terom@fixme.fi>
parents:
1
diff
changeset
|
63 |
# XXX: is this valid? |
a834f0559939
working SSL using gnutls - a bit of a painful process
Tero Marttila <terom@fixme.fi>
parents:
1
diff
changeset
|
64 |
CPPFLAGS = ${CFLAGS} |
a834f0559939
working SSL using gnutls - a bit of a painful process
Tero Marttila <terom@fixme.fi>
parents:
1
diff
changeset
|
65 |
|
a834f0559939
working SSL using gnutls - a bit of a painful process
Tero Marttila <terom@fixme.fi>
parents:
1
diff
changeset
|
66 |
# names for src/ |
0 | 67 |
SRC_PATHS = $(wildcard src/*.c) $(wildcard src/*/*.c) |
68 |
SRC_NAMES = $(patsubst src/%,%,$(SRC_PATHS)) |
|
69 |
SRC_DIRS = $(dir $(SRC_NAMES)) |
|
70 |
||
71 |
# other targets |
|
72 |
clean : |
|
73 |
-rm obj/*.o obj/*/*.o |
|
74 |
-rm bin/* |
|
75 |
-rm build/deps/*.d build/deps/*/*.d |
|
76 |
||
77 |
clean-deps: |
|
78 |
-rm build/deps/*/*.d |
|
79 |
-rm build/deps/*.d |
|
80 |
||
81 |
#obj-dirs: |
|
82 |
# python build/make_obj_dirs.py $(BIN_PATHS) |
|
83 |
||
84 |
build/deps/%.d : src/%.c |
|
85 |
@set -e; rm -f $@; \ |
|
86 |
$(CC) -MM -MT __ $(CPPFLAGS) $< > $@.$$$$; \ |
|
87 |
sed 's,__[ :]*,obj/$*.o $@ : ,g' < $@.$$$$ > $@; \ |
|
88 |
rm -f $@.$$$$ |
|
89 |
||
90 |
include $(SRC_NAMES:%.c=build/deps/%.d) |
|
91 |
||
25
56367df4ce5b
add irc_net module, and fix Makefile CFLAGS, add -Wextra
Tero Marttila <terom@fixme.fi>
parents:
23
diff
changeset
|
92 |
|
56367df4ce5b
add irc_net module, and fix Makefile CFLAGS, add -Wextra
Tero Marttila <terom@fixme.fi>
parents:
23
diff
changeset
|
93 |
# XXX: removed $(CPPFLAGS) |
0 | 94 |
obj/%.o : src/%.c |
56
942370000450
compiling, working, but still ugly module code
Tero Marttila <terom@fixme.fi>
parents:
55
diff
changeset
|
95 |
$(CC) -c $(CFLAGS) $< -o $@ |
0 | 96 |
|
97 |
bin/% : obj/%.o |
|
98 |
$(CC) $(LDFLAGS) $+ $(LOADLIBES) $(LDLIBS) -o $@ |
|
99 |
||
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
53
diff
changeset
|
100 |
modules/%.so : obj/%.o |
56
942370000450
compiling, working, but still ugly module code
Tero Marttila <terom@fixme.fi>
parents:
55
diff
changeset
|
101 |
$(CC) -shared -Wl,-soname,$(notdir $@) -o $@ $+ -lc |
55
6f7f6ae729d0
'working' modules code, and convert irc_log to use said interface, but we've hit the limits on our Makefile, and the compiled module doesn't really work
Tero Marttila <terom@fixme.fi>
parents:
53
diff
changeset
|
102 |
|
0 | 103 |
# documentation |
104 |
DOXYGEN_PATH = /usr/bin/doxygen |
|
105 |
DOXYGEN_CONF_PATH = doc/doxygen.conf |
|
106 |
DOXYGEN_OUTPUT_FILE = doc/html/index.html |
|
107 |
||
108 |
docs : |
|
109 |
${DOXYGEN_PATH} ${DOXYGEN_CONF_PATH} |
|
110 |