1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
#PREFIX = /usr/local
#CFLAGS = -g -Wall -fPIC
#CFLAGS = -g -DUSE_CPL
#CC = g++
LIBOBJ = shpopen.o dbfopen.o safileio.o shptree.o
SHPBIN = shpcreate shpadd shpdump shprewind dbfcreate dbfadd dbfdump \
shptreedump
#LINKOPT = /usr/local/lib/libdbmalloc.a
#CFLAGS = -g
default: all
all: $(SHPBIN) shptest lib
shpopen.o: shpopen.c shapefil.h
$(CC) $(CFLAGS) -c shpopen.c
shptree.o: shptree.c shapefil.h
$(CC) $(CFLAGS) -c shptree.c
dbfopen.o: dbfopen.c shapefil.h
$(CC) $(CFLAGS) -c dbfopen.c
safileio.o: shapefil.h
$(CC) $(CFLAGS) -c safileio.c
shpcreate: shpcreate.c .libs/libshp.so
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) shpcreate.c $(LINKOPT) -o shpcreate .libs/libshp.so
shpadd: shpadd.c .libs/libshp.so
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) shpadd.c $(LINKOPT) -o shpadd .libs/libshp.so
shpdump: shpdump.c .libs/libshp.so
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) shpdump.c $(LINKOPT) -o shpdump .libs/libshp.so
shprewind: shprewind.c .libs/libshp.so
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) shprewind.c $(LINKOPT) -o shprewind .libs/libshp.so
dbfcreate: dbfcreate.c .libs/libshp.so
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) dbfcreate.c $(LINKOPT) -o dbfcreate .libs/libshp.so
dbfadd: dbfadd.c .libs/libshp.so
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) dbfadd.c $(LINKOPT) -o dbfadd .libs/libshp.so
dbfdump: dbfdump.c .libs/libshp.so
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) dbfdump.c $(LINKOPT) -o dbfdump .libs/libshp.so
shptest: shptest.c .libs/libshp.so
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) shptest.c $(LINKOPT) -o shptest .libs/libshp.so
shputils: shputils.c .libs/libshp.so
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) shputils.c $(LINKOPT) -o shputils .libs/libshp.so
shptreedump: shptreedump.c .libs/libshp.so
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) shptreedump.c $(LINKOPT) \
-o shptreedump .libs/libshp.so
clean:
rm -f *.o shptest $(SHPBIN) libshp.a
rm -rf *.lo *.la .libs
test: test2 test3
#
# Note this stream only works if example data is accessable.
# Fetch ftp://gdal.velocet.ca/pub/outgoing/shape_eg_data.zip
#
test1:
@./stream1.sh > s1.out
@if test "`diff s1.out stream1.out`" = '' ; then \
echo "******* Stream 1 Succeeded *********"; \
rm s1.out; \
else \
echo "******* Stream 1 Failed *********"; \
diff s1.out stream1.out; \
fi
test2:
@./stream2.sh > s2.out
@if test "`diff s2.out stream2.out`" = '' ; then \
echo "******* Stream 2 Succeeded *********"; \
rm s2.out; \
rm test*.s??; \
else \
echo "******* Stream 2 Failed *********"; \
diff s2.out stream2.out; \
fi
test3:
@./makeshape.sh > s3.out
@if test "`diff s3.out stream3.out`" = '' ; then \
echo "******* Stream 3 Succeeded *********"; \
rm s3.out; \
rm test.*; \
else \
echo "******* Stream 3 Failed *********"; \
diff s3.out stream3.out; \
fi
bin_install: $(SHPBIN)
cp $(SHPBIN) $(PREFIX)/bin
install: lib_install bin_install
# -----------------------------------------------------------------------------
# The following is contributed by Jan-Oliver Wagner, and should allow for
# creating shared libraries on most platforms with gcc, and libtool installed.
SHPLIB_VERSION=1.3.0
LIBSHP_VERSION=2.0.0 # still once to be changed manually (see for 1:1:0), sorry
lib: .libs/libshp.so
.libs/libshp.so:
libtool --mode=compile gcc -DPACKAGE=\"libshp\" -DVERSION=\"$(SHPLIB_VERSION)\" -DSTDC_HEADERS=1 -I. $(CPPFLAGS) $(CFLAGS) -c shpopen.c
libtool --mode=compile gcc -DPACKAGE=\"libshp\" -DVERSION=\"$(SHPLIB_VERSION)\" -DSTDC_HEADERS=1 -I. $(CPPFLAGS) $(CFLAGS) -c shptree.c
libtool --mode=compile gcc -DPACKAGE=\"libshp\" -DVERSION=\"$(SHPLIB_VERSION)\" -DSTDC_HEADERS=1 -I. $(CPPFLAGS) $(CFLAGS) -c dbfopen.c
libtool --mode=compile gcc -DPACKAGE=\"libshp\" -DVERSION=\"$(SHPLIB_VERSION)\" -DSTDC_HEADERS=1 -I. $(CPPFLAGS) $(CFLAGS) -c safileio.c
libtool --mode=link gcc $(CFLAGS) $(LDFLAGS) -o libshp.la -rpath /usr/lib -version-info 2:0:0 shpopen.lo shptree.lo dbfopen.lo safileio.lo
lib_install:
cp .libs/libshp.la .libs/libshp.lai
/bin/sh ./mkinstalldirs /usr/local/lib
libtool --mode=install /usr/bin/install -c libshp.la /usr/local/lib/libshp.la
/usr/bin/install -c .libs/libshp.so.$(LIBSHP_VERSION) /usr/local/lib/libshp.so.$(LIBSHP_VERSION)
(cd /usr/local/lib && rm -f libshp.so.1 && ln -s libshp.so.$(LIBSHP_VERSION) libshp.so.1)
(cd /usr/local/lib && rm -f libshp.so && ln -s libshp.so.$(LIBSHP_VERSION) libshp.so)
chmod +x /usr/local/lib/libshp.so.$(LIBSHP_VERSION)
/usr/bin/install -c .libs/libshp.la /usr/local/lib/libshp.la
/usr/bin/install -c .libs/libshp.a /usr/local/lib/libshp.a
ranlib /usr/local/lib/libshp.a
chmod 644 /usr/local/lib/libshp.a
/bin/sh ./mkinstalldirs /usr/local/include/libshp
/usr/bin/install -c -m 644 shapefil.h /usr/local/include/libshp/shapefil.h
|