source: subversion/applications/utils/coastcheck/Makefile

Last change on this file was 9899, checked in by martinvoosterhout, 11 years ago

Move the shapefile opening code out of the main function to make it a bit
easier to read and less duplication. Also bump version to 0.12 to indicate
completion of features.

File size: 1.7 KB
Line 
1PACKAGE:=coast2shp
2VERSION:=0.12
3SVN:=$(shell date +%Y%m%d)
4
5CC=gcc
6#PROFILE=-pg
7
8CFLAGS += -g -O2 -Wall -Wextra -std=c99 $(PROFILE)
9CFLAGS += $(shell xml2-config --cflags)
10CFLAGS += '-DVERSION="$(VERSION)-$(SVN)"'
11
12LDFLAGS-coast2shp += -g $(shell xml2-config --libs) 
13LDFLAGS-coast2shp += -lbz2 -lproj
14LDFLAGS-osm2coast += $(shell xml2-config --libs) -lbz2
15LDFLAGS += -lshp -lpthread -lm $(PROFILE)
16
17ifneq ($(wildcard /usr/local/lib/libtcmalloc.so),)
18  LDFLAGS-coast2shp += -ltcmalloc
19endif
20
21SRCS:=$(wildcard *.c)
22OBJS:=$(SRCS:.c=.o)
23DEPS:=$(SRCS:.c=.d)
24
25APPS:=coast2shp closeshp osm2coast
26
27.PHONY: all clean $(PACKAGE).spec
28
29all: $(APPS)
30
31clean: 
32        rm -f $(APPS) $(OBJS) $(DEPS)
33        rm -f $(PACKAGE)-*.tar.bz2
34
35%.d: %.c
36        @set -e; rm -f $@; \
37        $(CC) -MM $(CFLAGS) $< > $@.$$$$; \
38        sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
39        rm -f $@.$$$$
40
41-include $(DEPS)
42
43coast2shp: coast2shp.o input.o keyvals.o rb.o
44        $(CC) -o $@ $^ $(LDFLAGS-coast2shp) $(LDFLAGS)
45
46closeshp: closeshp.o
47        $(CC) -o $@ $^ $(LDFLAGS)
48       
49osm2coast: osm2coast.o input.o
50        $(CC) -o $@ $^ $(LDFLAGS-osm2coast) $(LDFLAGS)
51
52%.o: %.c
53        $(CC) -c $(CFLAGS) -o $@ $<
54
55$(PACKAGE).spec: $(PACKAGE).spec.in
56        sed -e "s/@PACKAGE@/$(PACKAGE)/g; s/@VERSION@/$(VERSION)/g; s/@SVN@/$(SVN)/g;" $^ > $@
57
58$(PACKAGE)-$(VERSION)-$(SVN).tar.bz2: $(PACKAGE).spec
59        rm -fR tmp
60        mkdir -p tmp/coast2shp
61        cp -p Makefile *.[ch] *.cpp readme.txt coast2shp.spec* coast2shp-svn.sh tmp/coast2shp
62        cp -p coast2shp.spec tmp/
63        tar cjf $@ -C tmp .
64        rm -fR tmp
65
66rpm: $(PACKAGE)-$(VERSION)-$(SVN).tar.bz2
67        rpmbuild -ta $^
68
69closeshp.o: closeshp.c
70coast2shp.o: coast2shp.c osmtypes.h keyvals.h input.h rb.h
71input.o: input.c input.h
72keyvals.o: keyvals.c keyvals.h
73osm2coast.o: osm2coast.c input.h
74rb.o: rb.c rb.h
Note: See TracBrowser for help on using the repository browser.