patch-Makefile 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. $OpenBSD: patch-Makefile,v 1.3 2017/05/12 14:38:18 benoit Exp $
  2. Generate shared libraries correctly.
  3. Index: Makefile
  4. --- Makefile.orig
  5. +++ Makefile
  6. @@ -18,6 +18,7 @@ FLOOKUPLDFLAGS = libfoma.a -lz
  7. CFLAGS = -O3 -Wall -D_GNU_SOURCE -std=c99 -fvisibility=hidden -fPIC
  8. FOMAOBJS = foma.o stack.o iface.o lex.interface.o
  9. 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
  10. +SHLIBOBJS = $(LIBOBJS:.o=.so)
  11. all: libfoma foma flookup cgflookup
  12. @@ -64,10 +65,10 @@ LIBS = $(SHAREDLIBV) $(STATICLIB)
  13. libfoma: $(SHAREDLIBV)
  14. -$(SHAREDLIBV): $(LIBOBJS)
  15. +$(SHAREDLIBV): $(LIBOBJS) $(SHLIBOBJS)
  16. $(AR) $(ARFLAGS) $(STATICLIB) $(LIBOBJS)
  17. $(RANLIB) $(STATICLIB)
  18. - $(CC) $(CFLAGS) -shared -Wl,$(DFLAG),$(SHAREDLIBM) -o $(SHAREDLIBV) $(LIBOBJS) $(LDFLAGS)
  19. + $(CC) $(CFLAGS) -shared -o $(SHAREDLIBV) $(SHLIBOBJS) $(LDFLAGS)
  20. install: foma libfoma
  21. -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
  22. @@ -81,14 +82,15 @@ install: foma libfoma
  23. cd $(libdir); chmod 755 $(LIBS); \
  24. if test -f $(libdir)/$(SHAREDLIB); then rm $(libdir)/$(SHAREDLIB); fi
  25. if test -f $(libdir)/$(SHAREDLIBM); then rm $(libdir)/$(SHAREDLIBM); fi
  26. - cd $(libdir); ln -s $(SHAREDLIBV) $(SHAREDLIB); cd $(libdir); \
  27. - ln -s $(SHAREDLIBV) $(SHAREDLIBM); (ldconfig || true) \
  28. - >/dev/null 2>&1; \
  29. $(OBJS): foma.h
  30. .c.o:
  31. $(CC) $(CFLAGS) -c $< -o $@
  32. +
  33. +.SUFFIXES: .so
  34. +.c.so:
  35. + $(CC) $(CFLAGS) -fPIC -c $< -o $@
  36. lex.yy.c: regex.l regex.tab.h
  37. $(LEX) regex.l