really generate the shared library correctly

This commit is contained in:
naddy 2013-03-22 18:10:59 +00:00
parent 5e9390ccc3
commit 398591c503
4 changed files with 32 additions and 12 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.2 2013/03/11 11:23:54 espie Exp $
# $OpenBSD: Makefile,v 1.3 2013/03/22 18:10:59 naddy Exp $
COMMENT = finite-state compiler and C library
DISTNAME = foma-0.9.16alpha
PKGNAME = ${DISTNAME:S/alpha//}
REVISION = 0
SHARED_LIBS += foma 0.0 # 0.9.16

View File

@ -1,19 +1,31 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2012/10/20 04:34:32 bentley Exp $
$OpenBSD: patch-Makefile,v 1.2 2013/03/22 18:10:59 naddy Exp $
Generate shared libraries correctly.
--- Makefile.orig Wed Dec 14 00:28:25 2011
+++ Makefile Fri Oct 12 23:56:56 2012
@@ -57,7 +57,7 @@ libfoma: $(SHAREDLIBV)
$(SHAREDLIBV): $(LIBOBJS)
--- Makefile.orig Tue Dec 13 21:28:25 2011
+++ Makefile Fri Mar 22 19:09:25 2013
@@ -18,6 +18,7 @@ FLOOKUPLDFLAGS = libfoma.a -lz
CFLAGS = -O3 -Wall -D_GNU_SOURCE -std=c99 -fvisibility=hidden -fPIC
FOMAOBJS = foma.o stack.o iface.o lex.interface.o
LIBOBJS = int_stack.o define.o determinize.o apply.o rewrite.o lexcread.o topsort.o flags.o minimize.o reverse.o extract.o sigma.o io.o structures.o constructions.o coaccessible.o utf8.o spelling.o dynarray.o mem.o stringhash.o trie.o lex.lexc.o lex.yy.o lex.cmatrix.o regex.tab.o
+SHLIBOBJS = $(LIBOBJS:.o=.so)
all: libfoma foma flookup cgflookup
@@ -54,10 +55,10 @@ LIBS = $(SHAREDLIBV) $(STATICLIB)
libfoma: $(SHAREDLIBV)
-$(SHAREDLIBV): $(LIBOBJS)
+$(SHAREDLIBV): $(LIBOBJS) $(SHLIBOBJS)
$(AR) $(ARFLAGS) $(STATICLIB) $(LIBOBJS)
$(RANLIB) $(STATICLIB)
- $(CC) $(CFLAGS) -shared -Wl,$(DFLAG),$(SHAREDLIBM) -o $(SHAREDLIBV) $(LIBOBJS) $(LDFLAGS)
+ $(CC) $(CFLAGS) -shared -o $(SHAREDLIBV) $(LIBOBJS) $(LDFLAGS)
+ $(CC) $(CFLAGS) -shared -o $(SHAREDLIBV) $(SHLIBOBJS) $(LDFLAGS)
install: foma libfoma
-@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
@@ -71,9 +71,6 @@ install: foma libfoma
@@ -71,14 +72,15 @@ install: foma libfoma
cd $(libdir); chmod 755 $(LIBS); \
if test -f $(libdir)/$(SHAREDLIB); then rm $(libdir)/$(SHAREDLIB); fi
if test -f $(libdir)/$(SHAREDLIBM); then rm $(libdir)/$(SHAREDLIBM); fi
@ -23,3 +35,12 @@ Generate shared libraries correctly.
$(OBJS): foma.h
.c.o:
$(CC) $(CFLAGS) -c $< -o $@
+
+.SUFFIXES: .so
+.c.so:
+ $(CC) $(CFLAGS) -fPIC -c $< -o $@
lex.yy.c: regex.l regex.tab.h
$(LEX) regex.l

View File

@ -1,2 +0,0 @@
@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2012/10/20 04:34:32 bentley Exp $
@lib lib/libfoma.so.${LIBfoma_VERSION}

View File

@ -1,8 +1,8 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2012/10/20 04:34:32 bentley Exp $
%%SHARED%%
@comment $OpenBSD: PLIST,v 1.2 2013/03/22 18:10:59 naddy Exp $
@bin bin/cgflookup
@bin bin/flookup
@bin bin/foma
include/fomalib.h
include/fomalibconf.h
lib/libfoma.a
@lib lib/libfoma.so.${LIBfoma_VERSION}