author | Tero Marttila <terom@fixme.fi> |
Sat, 10 Apr 2010 22:30:00 +0300 | |
branch | unscaled-coordinates |
changeset 128 | 66c95c2d212c |
parent 122 | 8e4ff23e33f5 |
child 132 | 0260aeca943c |
permissions | -rw-r--r-- |
0 | 1 |
# :set noexpandtab |
35 | 2 |
CFLAGS_ALL = -Wall -std=gnu99 |
95 | 3 |
LDFLAGS_ALL = |
35 | 4 |
CFLAGS_DBG = -g |
5 |
CFLAGS_REL = -O2 |
|
99
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
6 |
CFLAGS_PRF = -g -O2 -pg |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
7 |
LDFLAGS_PRF = -pg |
35 | 8 |
|
99
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
9 |
CFLAGS_SEL = ${CFLAGS_REL} |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
10 |
LDFLAGS_SEL = ${LDFLAGS_REL} |
0 | 11 |
|
12 |
# warnings, and use C99 with GNU extensions |
|
35 | 13 |
CFLAGS = ${CFLAGS_ALL} ${CFLAGS_SEL} |
95 | 14 |
LDFLAGS = ${LDFLAGS_ALL} ${LDFLAGS_SEL} |
0 | 15 |
|
16 |
# preprocessor flags |
|
16
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
17 |
CPPFLAGS = -Iinclude -Isrc/ |
0 | 18 |
|
1
f3cde3db1fef
basic image/cache code compiles
Tero Marttila <terom@fixme.fi>
parents:
0
diff
changeset
|
19 |
# libraries to use |
19
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
20 |
LOADLIBES = -lpng -lpthread |
1
f3cde3db1fef
basic image/cache code compiles
Tero Marttila <terom@fixme.fi>
parents:
0
diff
changeset
|
21 |
|
0 | 22 |
# output name |
119 | 23 |
DIST_NAME = pngtile-${shell hg id -i} |
120
3c153e82e862
make dist depend on python.c, and add pypngtile.so to all...
Tero Marttila <terom@fixme.fi>
parents:
119
diff
changeset
|
24 |
DIST_DEPS = python/pypngtile.c |
118 | 25 |
DIST_RESOURCES = README python/ pngtile/ static/ bin/ |
0 | 26 |
|
120
3c153e82e862
make dist depend on python.c, and add pypngtile.so to all...
Tero Marttila <terom@fixme.fi>
parents:
119
diff
changeset
|
27 |
all: depend lib/libpngtile.so bin/pngtile lib/pypngtile.so |
0 | 28 |
|
1
f3cde3db1fef
basic image/cache code compiles
Tero Marttila <terom@fixme.fi>
parents:
0
diff
changeset
|
29 |
lib/libpngtile.so : \ |
58 | 30 |
build/obj/lib/ctx.o build/obj/lib/image.o build/obj/lib/cache.o build/obj/lib/tile.o build/obj/lib/png.o build/obj/lib/error.o \ |
16
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
31 |
build/obj/shared/util.o build/obj/shared/log.o |
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
32 |
|
99
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
33 |
lib/libpngtile.a : \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
34 |
build/obj/lib/ctx.o build/obj/lib/image.o build/obj/lib/cache.o build/obj/lib/tile.o build/obj/lib/png.o build/obj/lib/error.o \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
35 |
build/obj/shared/util.o build/obj/shared/log.o |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
36 |
|
16
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
37 |
lib/pypngtile.so : \ |
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
38 |
lib/libpngtile.so |
0 | 39 |
|
99
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
40 |
bin/pngtile : \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
41 |
build/obj/pngtile/main.o \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
42 |
lib/libpngtile.so build/obj/shared/log.o |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
43 |
|
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
44 |
bin/pngtile-static : \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
45 |
build/obj/pngtile/main.o \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
46 |
lib/libpngtile.a |
2 | 47 |
|
0 | 48 |
SRC_PATHS = $(wildcard src/*/*.c) |
49 |
SRC_NAMES = $(patsubst src/%,%,$(SRC_PATHS)) |
|
50 |
SRC_DIRS = $(dir $(SRC_NAMES)) |
|
51 |
||
52 |
.PHONY : dirs clean depend dist |
|
53 |
||
118 | 54 |
dist-clean : clean dirs |
55 |
||
0 | 56 |
dirs: |
30 | 57 |
mkdir -p bin lib dist |
0 | 58 |
mkdir -p $(SRC_DIRS:%=build/deps/%) |
116 | 59 |
mkdir -p $(SRC_DIRS:%=build/obj/%) build/obj/python |
0 | 60 |
|
61 |
clean: |
|
118 | 62 |
rm -f build/obj/*/*.o build/deps/*/*.d |
122 | 63 |
rm -f bin/pngtile bin/pngtile-static lib/*.so lib/*.a |
118 | 64 |
rm -f pngtile/*.pyc |
122 | 65 |
rm -f */.*.swp */*/.*.swp |
0 | 66 |
|
67 |
# .h dependencies |
|
68 |
depend: $(SRC_NAMES:%.c=build/deps/%.d) |
|
69 |
||
70 |
build/deps/%.d : src/%.c |
|
71 |
@set -e; rm -f $@; \ |
|
72 |
$(CC) -MM -MT __ $(CPPFLAGS) $< > $@.$$$$; \ |
|
73 |
sed 's,__[ :]*,build/obj/$*.o $@ : ,g' < $@.$$$$ > $@; \ |
|
74 |
rm -f $@.$$$$ |
|
75 |
||
76 |
include $(wildcard build/deps/*/*.d) |
|
77 |
||
78 |
# build (potential) library targets with specific cflags |
|
79 |
# XXX: just build everything with -fPIC? |
|
80 |
build/obj/shared/%.o : src/shared/%.c |
|
81 |
$(CC) -c -fPIC $(CPPFLAGS) $(CFLAGS) $< -o $@ |
|
82 |
||
19
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
83 |
# XXX: hax in -pthread |
0 | 84 |
build/obj/lib/%.o : src/lib/%.c |
19
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
85 |
$(CC) -c -fPIC -pthread $(CPPFLAGS) $(CFLAGS) $< -o $@ |
0 | 86 |
|
87 |
# general binary objects |
|
88 |
build/obj/%.o : src/%.c |
|
89 |
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ |
|
90 |
||
91 |
# output binaries |
|
99
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
92 |
bin/% : |
0 | 93 |
$(CC) $(LDFLAGS) $+ $(LOADLIBES) $(LDLIBS) -o $@ |
94 |
||
95 |
# output libraries |
|
96 |
lib/lib%.so : |
|
97 |
$(CC) -shared $(LDFLAGS) $+ $(LOADLIBES) $(LDLIBS) -o $@ |
|
98 |
||
99
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
99 |
lib/lib%.a : |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
100 |
$(AR) rc $@ $+ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
101 |
|
115
e4628dea2126
keep .pyx -> .c in python/, separate build/obj/py/py*.o
Tero Marttila <terom@fixme.fi>
parents:
114
diff
changeset
|
102 |
python/%.c : python/%.pyx |
16
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
103 |
cython -o $@ $< |
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
104 |
|
116 | 105 |
build/obj/python/%.o : python/%.c |
115
e4628dea2126
keep .pyx -> .c in python/, separate build/obj/py/py*.o
Tero Marttila <terom@fixme.fi>
parents:
114
diff
changeset
|
106 |
$(CC) -c -fPIC -I/usr/include/python2.5 $(CPPFLAGS) $(CFLAGS) $< -o $@ |
16
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
107 |
|
116 | 108 |
lib/py%.so : build/obj/python/py%.o |
115
e4628dea2126
keep .pyx -> .c in python/, separate build/obj/py/py*.o
Tero Marttila <terom@fixme.fi>
parents:
114
diff
changeset
|
109 |
$(CC) -shared $(LDFLAGS) $+ $(LOADLIBES) $(LDLIBS) -o $@ |
16
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
110 |
|
120
3c153e82e862
make dist depend on python.c, and add pypngtile.so to all...
Tero Marttila <terom@fixme.fi>
parents:
119
diff
changeset
|
111 |
dist: $(DIST_DEPS) |
118 | 112 |
rm -rf dist/$(DIST_NAME) |
0 | 113 |
mkdir -p dist/$(DIST_NAME) |
118 | 114 |
cp -rv Makefile $(DIST_RESOURCES) src/ include/ dist/$(DIST_NAME)/ |
115 |
make -C dist/$(DIST_NAME) dist-clean |
|
0 | 116 |
tar -C dist -czvf dist/$(DIST_NAME).tar.gz $(DIST_NAME) |
117 |
@echo "*** Output at dist/$(DIST_NAME).tar.gz" |
|
118 |