author | Tero Marttila <terom@qmsk.net> |
Fri, 03 Oct 2014 21:11:40 +0300 | |
changeset 154 | e9eef49f4d57 |
parent 132 | 0260aeca943c |
child 155 | cda90b8d94b8 |
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} |
132
0260aeca943c
cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents:
122
diff
changeset
|
24 |
DIST_DEPS = |
0260aeca943c
cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents:
122
diff
changeset
|
25 |
DIST_RESOURCES = README pngtile/ static/ bin/ |
0 | 26 |
|
132
0260aeca943c
cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents:
122
diff
changeset
|
27 |
all: depend lib/libpngtile.so bin/pngtile |
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 |
|
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
37 |
bin/pngtile : \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
38 |
build/obj/pngtile/main.o \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
39 |
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
|
40 |
|
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
41 |
bin/pngtile-static : \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
42 |
build/obj/pngtile/main.o \ |
fa21919d105f
support for profiling - although it's absolutely useless here
Tero Marttila <terom@fixme.fi>
parents:
95
diff
changeset
|
43 |
lib/libpngtile.a |
2 | 44 |
|
0 | 45 |
SRC_PATHS = $(wildcard src/*/*.c) |
46 |
SRC_NAMES = $(patsubst src/%,%,$(SRC_PATHS)) |
|
47 |
SRC_DIRS = $(dir $(SRC_NAMES)) |
|
48 |
||
49 |
.PHONY : dirs clean depend dist |
|
50 |
||
118 | 51 |
dist-clean : clean dirs |
52 |
||
0 | 53 |
dirs: |
30 | 54 |
mkdir -p bin lib dist |
0 | 55 |
mkdir -p $(SRC_DIRS:%=build/deps/%) |
132
0260aeca943c
cleanup readme, drop pypngtile bits from Makefile, fixup setup.py for pypngtile
Tero Marttila <terom@paivola.fi>
parents:
122
diff
changeset
|
56 |
mkdir -p $(SRC_DIRS:%=build/obj/%) |
0 | 57 |
|
58 |
clean: |
|
118 | 59 |
rm -f build/obj/*/*.o build/deps/*/*.d |
122 | 60 |
rm -f bin/pngtile bin/pngtile-static lib/*.so lib/*.a |
61 |
rm -f */.*.swp */*/.*.swp |
|
0 | 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 |
|
120
3c153e82e862
make dist depend on python.c, and add pypngtile.so to all...
Tero Marttila <terom@fixme.fi>
parents:
119
diff
changeset
|
98 |
dist: $(DIST_DEPS) |
118 | 99 |
rm -rf dist/$(DIST_NAME) |
0 | 100 |
mkdir -p dist/$(DIST_NAME) |
118 | 101 |
cp -rv Makefile $(DIST_RESOURCES) src/ include/ dist/$(DIST_NAME)/ |
102 |
make -C dist/$(DIST_NAME) dist-clean |
|
0 | 103 |
tar -C dist -czvf dist/$(DIST_NAME).tar.gz $(DIST_NAME) |
104 |
@echo "*** Output at dist/$(DIST_NAME).tar.gz" |
|
105 |