Skip to content

Commit

Permalink
Second attempt at libtool usage. Seems better to me now.
Browse files Browse the repository at this point in the history
PostGIS clients still all use the static version of the library.
Libraries are not installed by default.
[RT-SIGTA]

git-svn-id: http://svn.osgeo.org/postgis/trunk@7744 b70326c6-7e19-0410-871a-916f4a2858ee
  • Loading branch information
Sandro Santilli committed Aug 13, 2011
1 parent 9041b17 commit f3db965
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 35 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ if test "x$RASTER" = "xraster"; then dnl # {
dnl ================================================
POSTGIS_SRCDIR=`$PWDREGRESS`
LIBLWGEOM_CFLAGS="-I${POSTGIS_SRCDIR}/liblwgeom"
LIBLWGEOM_LDFLAGS="${POSTGIS_SRCDIR}/liblwgeom/liblwgeom.a"
LIBLWGEOM_LDFLAGS="${POSTGIS_SRCDIR}/liblwgeom/.libs/liblwgeom.a"
LIBPGCOMMON_CFLAGS="-I${POSTGIS_SRCDIR}/libpgcommon"
LIBPGCOMMON_LDFLAGS="${POSTGIS_SRCDIR}/libpgcommon/libpgcommon.a"

Expand Down
8 changes: 4 additions & 4 deletions doc/html/image_src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ $(IMAGES_RESIZED): ../images/%.png: %.wkt generator styles.conf
convert $@ -resize 100x100 $@

# Build the main executable
generator: ../../../liblwgeom/liblwgeom.a $(OBJS)
$(CC) -o $@ $(OBJS) ../../../liblwgeom/liblwgeom.a -lm $(CUNIT_LDFLAGS)
generator: ../../../liblwgeom/.libs/liblwgeom.a $(OBJS)
$(CC) -o $@ $(OBJS) ../../../liblwgeom/.libs/liblwgeom.a -lm $(CUNIT_LDFLAGS)

# Build liblwgeom
../../../liblwgeom/liblwgeom.a:
make -C ../../../liblwgeom liblwgeom.a
../../../liblwgeom/.libs/liblwgeom.a:
make -C ../../../liblwgeom liblwgeom.la

# Clean target
clean:
Expand Down
46 changes: 22 additions & 24 deletions liblwgeom/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
INSTALL = $(SHELL) ../install-sh
LIBTOOL = @LIBTOOL@

SONAME = liblwgeom.so.@POSTGIS_MAJOR_VERSION@
SOVER = @POSTGIS_MAJOR_VERSION@.@POSTGIS_MINOR_VERSION@.@POSTGIS_MICRO_VERSION@


Expand Down Expand Up @@ -84,33 +84,33 @@ SA_OBJS = \
NM_OBJS = \
lwspheroid.o

OBJS = $(SA_OBJS) $(NM_OBJS)
LT_SA_OBJS = $(SA_OBJS:.o=.lo)
LT_NM_OBJS = $(NM_OBJS:.o=.lo)
LT_OBJS = $(LT_SA_OBJS) $(LT_NM_OBJS)

SA_HEADERS = \
liblwgeom.h \
liblwgeom_internal.h \
libtgeom.h \
lwgeom_geos.h

all: liblwgeom.a
all: liblwgeom.la

# nothing to install or uninstall
install uninstall:

install-liblwgeom: liblwgeom.so liblwgeom.a
$(INSTALL) liblwgeom.so $(DESTDIR)$(libdir)/liblwgeom.so.$(SOVER)
$(INSTALL) liblwgeom.a $(DESTDIR)$(libdir)/liblwgeom.a
@echo "Remember to run ldconfig"
install-liblwgeom: liblwgeom.la
$(LIBTOOL) --mode=install $(INSTALL) liblwgeom.la $(libdir)/liblwgeom.la
$(LIBTOOL) --mode=finish $(libdir)

uninstall-liblwgeom:
rm -f $(DESTDIR)$(libdir)/liblwgeom.so.$(SOVER)
rm -f $(DESTDIR)$(libdir)/liblwgeom.a
$(LIBTOOL) --mode=uninstall rm -f $(libdir)/liblwgeom.la

liblwgeom.a: $(SA_OBJS) $(NM_OBJS) $(SA_HEADERS)
ar rs liblwgeom.a $(SA_OBJS) $(NM_OBJS)
#liblwgeom.a: $(SA_OBJS) $(NM_OBJS) $(SA_HEADERS)
#ar rs liblwgeom.a $(SA_OBJS) $(NM_OBJS)

liblwgeom.so: $(OBJS) $(SA_HEADERS)
$(CC) -shared -Wl,-soname,$(SONAME) -o $@ $(OBJS) $(LDFLAGS)
liblwgeom.la: $(LT_OBJS) $(SA_HEADERS)
$(LIBTOOL) --tag=CC --mode=link $(CC) -rpath $(libdir) $(LT_OBJS) -release $(SOVER) $(LDFLAGS) -o $@

maintainer-clean: clean
rm -f lwin_wkt_lex.c
Expand All @@ -119,28 +119,26 @@ maintainer-clean: clean

clean:
$(MAKE) -C cunit clean
rm -f $(OBJS)
rm -f liblwgeom.a
rm -f liblwgeom.so
rm -f $(LT_OBJS)
rm -f liblwgeom.la
rm -rf .libs

# Nothing specific in distclean (will be done by clean)
distclean:

check: liblwgeom.a
check: liblwgeom.la
make -C cunit check

# Command to build each of the .o files
$(SA_OBJS): %.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
# Command to build each of the .lo files
$(LT_SA_OBJS): %.lo: %.c
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) -c -o $@ $<

# Command to build each of the .o files
$(NM_OBJS): %.o: %.c
$(CC) $(CFLAGS) $(NUMERICFLAGS) -c -o $@ $<
$(LT_NM_OBJS): %.lo: %.c
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(NUMERICFLAGS) -c -o $@ $<

# Generate WKT parser from Flex/Yacc inputs
lwin_wkt_parse.c: lwin_wkt_parse.y
$(YACC) -o'$@' -d $^

# $(YACC) --debug --verbose -o'$@' -d $<
# $(YACC) -o'$@' -d $^

Expand Down
4 changes: 2 additions & 2 deletions liblwgeom/cunit/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ check: cu_tester
endif

# Build the main unit test executable
cu_tester: ../liblwgeom.a $(OBJS)
$(CC) -o $@ $(OBJS) ../liblwgeom.a -lm $(CUNIT_LDFLAGS) $(LDFLAGS)
cu_tester: ../.libs/liblwgeom.a $(OBJS)
$(CC) -o $@ $(OBJS) ../.libs/liblwgeom.a -lm $(CUNIT_LDFLAGS) $(LDFLAGS)

# Command to build each of the .o files
$(OBJS): %.o: %.c
Expand Down
2 changes: 1 addition & 1 deletion loader/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ICONV_LDFLAGS=@ICONV_LDFLAGS@
ICONV_CFLAGS=@ICONV_CFLAGS@

# liblwgeom
LIBLWGEOM=../liblwgeom/liblwgeom.a
LIBLWGEOM=../liblwgeom/.libs/liblwgeom.a

# GTK includes and libraries
GTK_CFLAGS = @GTK_CFLAGS@ @IGE_MAC_CFLAGS@
Expand Down
2 changes: 1 addition & 1 deletion loader/cunit/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ PGSQL_FE_CPPFLAGS=@PGSQL_FE_CPPFLAGS@
PGSQL_FE_LDFLAGS=@PGSQL_FE_LDFLAGS@

# liblwgeom
LIBLWGEOM=../../liblwgeom/liblwgeom.a
LIBLWGEOM=../../liblwgeom/.libs/liblwgeom.a

# iconv flags
ICONV_LDFLAGS=@ICONV_LDFLAGS@
Expand Down
4 changes: 2 additions & 2 deletions postgis/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ OBJS=$(PG_OBJS)
# older version of PostGIS, rather than with the static liblwgeom.a
# supplied with newer versions of PostGIS
PG_CPPFLAGS += @CPPFLAGS@ -I../liblwgeom -I../libpgcommon
SHLIB_LINK = ../libpgcommon/libpgcommon.a ../liblwgeom/liblwgeom.a @SHLIB_LINK@
SHLIB_LINK = ../libpgcommon/libpgcommon.a ../liblwgeom/.libs/liblwgeom.a @SHLIB_LINK@

# Extra files to remove during 'make clean'
EXTRA_CLEAN=$(SQL_OBJS)
Expand Down Expand Up @@ -101,7 +101,7 @@ endif

# Make all PostGIS objects depend upon liblwgeom, so that if an underlying
# change is made, a PostGIS rebuild is triggered.
$(PG_OBJS): ../liblwgeom/liblwgeom.a ../libpgcommon/libpgcommon.a
$(PG_OBJS): ../liblwgeom/.libs/liblwgeom.a ../libpgcommon/libpgcommon.a

# Borrow the $libdir substitution from PGXS but customise by adding the version number
%.sql: %.sql.in
Expand Down

0 comments on commit f3db965

Please sign in to comment.