Routino SVN Repository Browser

Check out the latest version of Routino: svn co http://routino.org/svn/trunk routino

ViewVC logotype

Contents of /trunk/src/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 613 - (show annotations) (download)
Sat Jan 29 19:44:23 2011 UTC (14 years, 1 month ago) by amb
File size: 4903 byte(s)
Make dependency filename based on object file name (fixes overwriting problem
with slim versions).

1 # Source code Makefile
2 #
3 # Part of the Routino routing software.
4 #
5 # This file Copyright 2008-2011 Andrew M. Bishop
6 #
7 # This program is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU Affero General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Affero General Public License for more details.
16 #
17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #
20
21 # Web file paths
22
23 WEBDIR=../web/bin
24
25 # Compilation programs
26
27 CC=gcc
28 LD=gcc
29
30 LEX=flex
31
32 # Compilation program options
33
34 CFLAGS=-Wall -Wmissing-prototypes
35 #CFLAGS+= -Wextra -pedantic -std=c99
36 LDFLAGS=-lm -lc
37
38 CFLAGS+= -O3
39 #CFLAGS+= -O0 -g
40 #CFLAGS+= -pg
41 #CFLAGS+= --coverage
42
43 LDFLAGS+=
44 #LDFLAGS+= -pg -static
45 #LDFLAGS+= --coverage
46
47 LEXFLAGS=
48
49 # Required to use stdio with files > 2GiB on 32-bit system.
50
51 FLAGS64=-D_FILE_OFFSET_BITS=64
52
53 # Compilation targets
54
55 C=$(wildcard *.c)
56 D=$(foreach f,$(C),$(addprefix .deps/,$(addsuffix .d,$(basename $f))))
57
58 EXE=planetsplitter planetsplitter-slim router router-slim filedumper filedumper-slim tagmodifier
59
60 ########
61
62 all : $(EXE)
63 -@[ -d $(WEBDIR) ] && \
64 for file in $(EXE); do \
65 if [ ! -f $(WEBDIR)/$$file ] || [ $$file -nt $(WEBDIR)/$$file ]; then \
66 echo cp $$file $(WEBDIR) ;\
67 cp -f $$file $(WEBDIR) ;\
68 fi ;\
69 done
70 @cd xml && $(MAKE) CC="$(CC)" LD="$(LD)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
71
72 ########
73
74 PLANETSPLITTER_OBJ=planetsplitter.o \
75 nodesx.o segmentsx.o waysx.o relationsx.o superx.o \
76 ways.o types.o \
77 files.o logging.o \
78 results.o queue.o sorting.o \
79 xmlparse.o tagging.o osmparser.o
80
81 planetsplitter : $(PLANETSPLITTER_OBJ)
82 $(LD) $(PLANETSPLITTER_OBJ) -o $@ $(LDFLAGS)
83
84 ########
85
86 PLANETSPLITTER_SLIM_OBJ=planetsplitter-slim.o \
87 nodesx-slim.o segmentsx-slim.o waysx-slim.o relationsx-slim.o superx-slim.o \
88 ways.o types.o \
89 files.o logging.o \
90 results.o queue.o sorting.o \
91 xmlparse.o tagging.o osmparser.o
92
93 planetsplitter-slim : $(PLANETSPLITTER_SLIM_OBJ)
94 $(LD) $(PLANETSPLITTER_SLIM_OBJ) -o $@ $(LDFLAGS)
95
96 ########
97
98 ROUTER_OBJ=router.o \
99 nodes.o segments.o ways.o relations.o types.o fakes.o \
100 optimiser.o output.o \
101 files.o logging.o profiles.o xmlparse.o \
102 results.o queue.o translations.o
103
104 router : $(ROUTER_OBJ)
105 $(LD) $(ROUTER_OBJ) -o $@ $(LDFLAGS)
106
107 ########
108
109 ROUTER_SLIM_OBJ=router-slim.o \
110 nodes-slim.o segments-slim.o ways-slim.o relations-slim.o types.o fakes.o \
111 optimiser-slim.o output-slim.o \
112 files.o logging.o profiles.o xmlparse.o \
113 results.o queue.o translations.o
114
115 router-slim : $(ROUTER_SLIM_OBJ)
116 $(LD) $(ROUTER_SLIM_OBJ) -o $@ $(LDFLAGS)
117
118 ########
119
120 FILEDUMPER_OBJ=filedumper.o \
121 nodes.o segments.o ways.o relations.o types.o fakes.o \
122 visualiser.o \
123 files.o logging.o xmlparse.o
124
125 filedumper : $(FILEDUMPER_OBJ)
126 $(LD) $(FILEDUMPER_OBJ) -o $@ $(LDFLAGS)
127
128 ########
129
130 FILEDUMPER_SLIM_OBJ=filedumper-slim.o \
131 nodes-slim.o segments-slim.o ways-slim.o relations-slim.o types.o fakes.o \
132 visualiser-slim.o \
133 files.o logging.o xmlparse.o
134
135 filedumper-slim : $(FILEDUMPER_SLIM_OBJ)
136 $(LD) $(FILEDUMPER_SLIM_OBJ) -o $@ $(LDFLAGS)
137
138 ########
139
140 TAGMODIFIER_OBJ=tagmodifier.o \
141 files.o logging.o \
142 xmlparse.o tagging.o
143
144 tagmodifier : $(TAGMODIFIER_OBJ)
145 $(LD) $(TAGMODIFIER_OBJ) -o $@ $(LDFLAGS)
146
147 ########
148
149 xmlparse.c : xmlparse.l
150 $(LEX) $(LEXFLAGS) $<
151 -@mv lex.yy.c xmlparse.c
152 @echo Created xmlparse.c
153
154 ########
155
156 %.o : %.c
157 $(CC) -c $(CFLAGS) $(FLAGS64) -DSLIM=0 -DDATADIR=\"$(datadir)\" $< -o $@ -MMD -MP -MF $(addprefix .deps/,$(addsuffix .d,$(basename $@)))
158
159 %-slim.o : %.c
160 $(CC) -c $(CFLAGS) $(FLAGS64) -DSLIM=1 -DDATADIR=\"$(datadir)\" $< -o $@ -MMD -MP -MF $(addprefix .deps/,$(addsuffix .d,$(basename $@)))
161
162 ########
163
164 install: all
165 -[ -d $(DESTDIR)$(bindir) ] || mkdir -p $(DESTDIR)$(bindir)
166 @[ -d $(DESTDIR)$(bindir) ] && \
167 for file in $(EXE); do \
168 echo cp $$file $(DESTDIR)$(bindir) ;\
169 cp -f $$file $(DESTDIR)$(bindir) ;\
170 done
171
172 ########
173
174 clean:
175 rm -f *.o
176 rm -f *~
177 rm -f xmlparse.c
178 cd xml && $(MAKE) clean
179
180 ########
181
182 distclean: clean
183 -[ -d ../web/bin ] && cd ../web/bin/ && rm -f $(EXE)
184 -rm -f $(EXE)
185 -rm -f $(D)
186 -rm -fr .deps
187 cd xml && $(MAKE) distclean
188
189 ########
190
191 .deps : .FORCE
192 @[ -d .deps ] || mkdir $@
193
194 $(D) : .deps
195 @touch $@
196
197 include $(D)
198
199 ########
200
201 .FORCE :
202
203 ########
204
205 top=-top
206 include ../Makefile

Properties

Name Value
cvs:description Makefile.