--- Makefile.orig 2011-07-24 12:32:26.000000000 +0800 +++ Makefile 2013-10-13 21:38:40.590435497 +0800 @@ -1,16 +1,19 @@ -PREFIX = /usr/local -CFLAGS = -g -Wall -fPIC +PREFIX ?= /usr/local +CFLAGS += -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 + shptreedump shputils shptest default: all -all: $(SHPBIN) shptest lib +all: $(SHPBIN) lib contrib_tools + +contrib_tools: + (cd contrib/; ${MAKE} %%PROJ%% all; cd ..) shpopen.o: shpopen.c shapefil.h $(CC) $(CFLAGS) -c shpopen.c @@ -98,16 +101,21 @@ lib: libshp.a + $(CC) -shared -Wl,-soname,libshp.so.1 -o libshp.so.1 $(LDFLAGS) dbfopen.o safileio.o shpopen.o shptree.o libshp.a: $(LIBOBJ) ar r libshp.a $(LIBOBJ) lib_install: libshp.a - cp libshp.a $(PREFIX)/lib - cp shapefil.h $(PREFIX)/include + $(BSD_INSTALL_DATA) shapefil.h $(DESTDIR)$(PREFIX)/include/ + $(BSD_INSTALL_DATA) libshp.a $(DESTDIR)$(PREFIX)/lib/ + $(BSD_INSTALL_LIB) libshp.so.1 $(DESTDIR)$(PREFIX)/lib/ bin_install: $(SHPBIN) - cp $(SHPBIN) $(PREFIX)/bin + $(BSD_INSTALL_PROGRAM) $(SHPBIN) $(DESTDIR)$(PREFIX)/bin/ + +contrib_install: + (cd contrib/; ${MAKE} %%PROJ%% install; cd ..) -install: lib_install bin_install +install: lib_install bin_install contrib_install