author | Tero Marttila <terom@fixme.fi> |
Wed, 15 Oct 2008 01:14:22 +0300 | |
changeset 28 | e944453ca924 |
parent 25 | 99a41f48e29b |
child 29 | 5de62ca9a5aa |
permissions | -rw-r--r-- |
1 | 1 |
LIBEVENT_PATH = ../libs/libevent-dev |
2 |
LIBFUSE_PATH = ../libs/libfuse-2.7.4 |
|
0 | 3 |
|
4 |
LIBRARY_PATHS = -L${LIBEVENT_PATH}/lib -L${LIBFUSE_PATH}/lib |
|
5 |
INCLUDE_PATHS = -I${LIBEVENT_PATH}/include -I${LIBFUSE_PATH}/include |
|
11 | 6 |
LDLIBS = -levent -lfuse -lpq |
0 | 7 |
|
28
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
8 |
ifdef DEBUG |
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
9 |
DEBUG_FLAGS = -DDEBUG_ENABLED |
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
10 |
else |
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
11 |
DEBUG_FLAGS = |
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
12 |
endif |
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
13 |
|
1 | 14 |
# XXX: ugh... use `pkg-config fuse` |
28
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
15 |
DEFINES = -D_FILE_OFFSET_BITS=64 ${DEBUG_FLAGS} |
0 | 16 |
MY_CFLAGS = -Wall -g -std=gnu99 |
17 |
||
24 | 18 |
BIN_NAMES = helloworld hello simple_hello evpq_test url_test dbfs |
19 | 19 |
BIN_PATHS = $(addprefix bin/,$(BIN_NAMES)) |
0 | 20 |
|
28
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
21 |
# complex modules |
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
22 |
EVSQL_OBJS = obj/evsql.o obj/evsql_util.o obj/evpq.o |
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
23 |
DBFS_OBJS = obj/dbfs/dbfs.o obj/dbfs/common.o obj/dbfs/core.o obj/dbfs/dirop.o obj/dirbuf.o |
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
24 |
|
11 | 25 |
# first target |
26 |
all: ${BIN_PATHS} |
|
27 |
||
28 |
# binaries |
|
1 | 29 |
bin/helloworld: |
7
3a603d755bcb
split off the dirbuf stuff into its own module
Tero Marttila <terom@fixme.fi>
parents:
6
diff
changeset
|
30 |
bin/hello: obj/evfuse.o obj/dirbuf.o obj/lib/log.o obj/lib/signals.o |
3a603d755bcb
split off the dirbuf stuff into its own module
Tero Marttila <terom@fixme.fi>
parents:
6
diff
changeset
|
31 |
bin/simple_hello: obj/evfuse.o obj/dirbuf.o obj/lib/log.o obj/lib/signals.o obj/simple.o |
11 | 32 |
bin/evpq_test: obj/evpq.o obj/lib/log.o |
15 | 33 |
bin/url_test: obj/lib/url.o obj/lib/lex.o obj/lib/log.o |
28
e944453ca924
split off dbfs components into a separate dir, improve dirop docs, error handling, etc
Tero Marttila <terom@fixme.fi>
parents:
25
diff
changeset
|
34 |
bin/dbfs: ${DBFS_OBJS} ${EVSQL_OBJS} obj/evfuse.o obj/lib/log.o obj/lib/signals.o |
0 | 35 |
|
36 |
# computed |
|
37 |
LDFLAGS = ${LIBRARY_PATHS} ${LIBRARY_LIST} |
|
11 | 38 |
CFLAGSX = ${DEFINES} ${MY_CFLAGS} |
39 |
CFLAGS = ${INCLUDE_PATHS} ${CFLAGSX} |
|
0 | 40 |
|
19 | 41 |
SRC_PATHS = $(wildcard src/*.c) $(wildcard src/*/*.c) |
0 | 42 |
SRC_NAMES = $(patsubst src/%,%,$(SRC_PATHS)) |
1 | 43 |
SRC_DIRS = $(dir $(SRC_NAMES)) |
0 | 44 |
|
11 | 45 |
# other targets |
0 | 46 |
clean : |
47 |
-rm obj/* bin/* |
|
48 |
||
11 | 49 |
#obj-dirs: |
50 |
# python build/make_obj_dirs.py $(BIN_PATHS) |
|
0 | 51 |
|
11 | 52 |
build/deps/%.d : src/%.c |
53 |
@set -e; rm -f $@; \ |
|
20
f0ef6d8880b4
fix build deps for subdirs of src
Tero Marttila <terom@fixme.fi>
parents:
19
diff
changeset
|
54 |
$(CC) -MM -MT __ $(CPPFLAGS) $< > $@.$$$$; \ |
f0ef6d8880b4
fix build deps for subdirs of src
Tero Marttila <terom@fixme.fi>
parents:
19
diff
changeset
|
55 |
sed 's,__[ :]*,obj/$*.o $@ : ,g' < $@.$$$$ > $@; \ |
11 | 56 |
rm -f $@.$$$$ |
57 |
||
58 |
include $(SRC_NAMES:%.c=build/deps/%.d) |
|
1 | 59 |
|
0 | 60 |
obj/%.o : src/%.c |
11 | 61 |
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ |
0 | 62 |
|
63 |
bin/% : obj/%.o |
|
1 | 64 |
$(CC) $(LDFLAGS) $+ $(LOADLIBES) $(LDLIBS) -o $@ |
0 | 65 |