author | Tero Marttila <terom@fixme.fi> |
Wed, 27 Jan 2010 01:10:58 +0200 | |
changeset 124 | a5e66a48b959 |
parent 109 | acbe0086da3f |
child 114 | 6f4ac352009a |
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 |
75 | 23 |
DIST_NAME = pngtile-0.2 |
24 |
DIST_RESOURCES = README $(shell "echo python/*.{py,pyx}") |
|
0 | 25 |
|
74 | 26 |
all: depend lib/libpngtile.so bin/pngtile |
0 | 27 |
|
1
f3cde3db1fef
basic image/cache code compiles
Tero Marttila <terom@fixme.fi>
parents:
0
diff
changeset
|
28 |
lib/libpngtile.so : \ |
58 | 29 |
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
|
30 |
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
|
31 |
|
99
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
32 |
lib/libpngtile.a : \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
33 |
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
|
34 |
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
|
35 |
|
16
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
36 |
lib/pypngtile.so : \ |
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
37 |
lib/libpngtile.so |
0 | 38 |
|
99
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
39 |
bin/pngtile : \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
40 |
build/obj/pngtile/main.o \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
41 |
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
|
42 |
|
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
43 |
bin/pngtile-static : \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
44 |
build/obj/pngtile/main.o \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
45 |
lib/libpngtile.a |
2 | 46 |
|
0 | 47 |
SRC_PATHS = $(wildcard src/*/*.c) |
48 |
SRC_NAMES = $(patsubst src/%,%,$(SRC_PATHS)) |
|
49 |
SRC_DIRS = $(dir $(SRC_NAMES)) |
|
50 |
||
51 |
.PHONY : dirs clean depend dist |
|
52 |
||
53 |
dirs: |
|
30 | 54 |
mkdir -p bin lib dist |
0 | 55 |
mkdir -p $(SRC_DIRS:%=build/deps/%) |
56 |
mkdir -p $(SRC_DIRS:%=build/obj/%) |
|
57 |
||
58 |
clean: |
|
59 |
rm -f build/obj/*/*.o build/deps/*/*.d |
|
109
acbe0086da3f
fix make clean to not empty out bin
Tero Marttila <terom@fixme.fi>
parents:
99
diff
changeset
|
60 |
rm -f bin/{pngtile,pngtile-static} lib/libpngtile.{a,so} run/* |
0 | 61 |
rm -rf dist/* |
62 |
||
63 |
# .h dependencies |
|
64 |
depend: $(SRC_NAMES:%.c=build/deps/%.d) |
|
65 |
||
66 |
build/deps/%.d : src/%.c |
|
67 |
@set -e; rm -f $@; \ |
|
68 |
$(CC) -MM -MT __ $(CPPFLAGS) $< > $@.$$$$; \ |
|
69 |
sed 's,__[ :]*,build/obj/$*.o $@ : ,g' < $@.$$$$ > $@; \ |
|
70 |
rm -f $@.$$$$ |
|
71 |
||
72 |
include $(wildcard build/deps/*/*.d) |
|
73 |
||
74 |
# build (potential) library targets with specific cflags |
|
75 |
# XXX: just build everything with -fPIC? |
|
76 |
build/obj/shared/%.o : src/shared/%.c |
|
77 |
$(CC) -c -fPIC $(CPPFLAGS) $(CFLAGS) $< -o $@ |
|
78 |
||
19
ebcc49de97d0
implement pt_ctx threadpool and pt_image_tile_async
Tero Marttila <terom@fixme.fi>
parents:
18
diff
changeset
|
79 |
# XXX: hax in -pthread |
0 | 80 |
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
|
81 |
$(CC) -c -fPIC -pthread $(CPPFLAGS) $(CFLAGS) $< -o $@ |
0 | 82 |
|
83 |
# general binary objects |
|
84 |
build/obj/%.o : src/%.c |
|
85 |
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ |
|
86 |
||
87 |
# output binaries |
|
99
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
88 |
bin/% : |
0 | 89 |
$(CC) $(LDFLAGS) $+ $(LOADLIBES) $(LDLIBS) -o $@ |
90 |
||
91 |
# output libraries |
|
92 |
lib/lib%.so : |
|
93 |
$(CC) -shared $(LDFLAGS) $+ $(LOADLIBES) $(LDLIBS) -o $@ |
|
94 |
||
99
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
95 |
lib/lib%.a : |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
96 |
$(AR) rc $@ $+ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
97 |
|
16
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
98 |
build/pyx/%.c : src/py/%.pyx |
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
99 |
cython -o $@ $< |
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
100 |
|
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
101 |
build/obj/py/%.o : build/pyx/%.c |
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
102 |
$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@ |
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
103 |
|
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
104 |
lib/py%.so : build/obj/py/%.o |
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
105 |
$(CC) -shared $(LDFLAGS) $+ $(LOADLIBES) $(LDLIBS) -o $@ |
6e781cf3d459
move public headers to include/, python stuff to python/ sub-dir
Tero Marttila <terom@fixme.fi>
parents:
4
diff
changeset
|
106 |
|
0 | 107 |
dist: |
108 |
mkdir -p dist/$(DIST_NAME) |
|
29
88691556661f
include include in dist, more README
Tero Marttila <terom@fixme.fi>
parents:
27
diff
changeset
|
109 |
cp -rv Makefile $(DIST_RESOURCES) src/ include/ dist/$(DIST_NAME)/ |
0 | 110 |
rm dist/$(DIST_NAME)/src/*/.*.sw[op] |
111 |
make -C dist/$(DIST_NAME) dirs |
|
112 |
tar -C dist -czvf dist/$(DIST_NAME).tar.gz $(DIST_NAME) |
|
113 |
@echo "*** Output at dist/$(DIST_NAME).tar.gz" |
|
114 |