freebsd-ports/textproc/libcrm114/files/patch-Makefile
2014-08-24 19:43:33 +00:00

65 lines
2.1 KiB
Text

--- Makefile.orig 2010-05-07 02:14:55.000000000 +0800
+++ Makefile 2014-06-30 23:20:48.222507260 +0800
@@ -31,7 +31,7 @@
#CFLAGS += -O3 -DDO_INLINES
#
#GCC flags for debugging, no optimization
-CFLAGS += -g
+#CFLAGS += -g
#
#GCC and LD flags for debugging, no optimization, and profile for speed
#CFLAGS += -g -pg
@@ -45,6 +45,8 @@ CFLAGS += -g
CFLAGS += -std=c99 -pedantic -Wall -Wextra -Wpointer-arith -Wstrict-prototypes
#well, pretty carefully
CFLAGS += -Wno-sign-compare -Wno-overlength-strings
+# to build shared library
+CFLAGS += -fPIC
#These are optional.
@@ -97,8 +99,8 @@ crm114_strnhash.o \
crm114_util.o \
crm114_regex_tre.o
-
-all: test simple_demo
+# .tar.gz includes linux object files -- so clean first
+all: clean libcrm114.so test simple_demo
test: test.o libcrm114.a
$(CC) -o test $(LDFLAGS) -Wl,-M -Wl,--cref test.o libcrm114.a -ltre -lm >test.map
@@ -115,6 +117,24 @@ simple_demo.o: texts.h $(LIBHDRS)
libcrm114.a: $(LIBOBJS) Makefile
ar rc libcrm114.a $(LIBOBJS)
+# added for FreeBSD port patch
+libcrm114.so.0: $(LIBOBJS) Makefile
+ $(CC) -o libcrm114.so.0 -shared $(LIBOBJS)
+
+libcrm114.so: libcrm114.so.0
+ ln -fs libcrm114.so.0 libcrm114.so
+
+install: libcrm114.so.0
+ $(BSD_INSTALL_LIB) libcrm114.so.0 $(DESTDIR)$(PREFIX)/lib
+ ln -fs libcrm114.so.0 $(DESTDIR)$(PREFIX)/lib/libcrm114.so
+ $(BSD_INSTALL_DATA) crm114_config.h $(DESTDIR)$(PREFIX)/include
+ $(BSD_INSTALL_DATA) crm114_lib.h $(DESTDIR)$(PREFIX)/include
+ $(BSD_INSTALL_DATA) crm114_structs.h $(DESTDIR)$(PREFIX)/include
+ $(BSD_INSTALL_DATA) crm114_sysincludes.h $(DESTDIR)$(PREFIX)/include
+ install -d -m 755 $(DESTDIR)$(PREFIX)/share/doc/libcrm114
+ $(BSD_INSTALL_DATA) HOWTO.txt $(DESTDIR)$(PREFIX)/share/doc/libcrm114
+ $(BSD_INSTALL_DATA) simple_demo.c $(DESTDIR)$(PREFIX)/share/doc/libcrm114
+
$(LIBOBJS): $(LIBHDRS)
clean: clean_test clean_simple_demo clean_lib clean_profiling
@@ -126,7 +146,7 @@ clean_simple_demo:
rm -f simple_demo simple_demo.map simple_demo.o simple_demo_datablock.txt
clean_lib:
- rm -f libcrm114.a $(LIBOBJS)
+ rm -f libcrm114.a libcrm114.so $(LIBOBJS)
clean_profiling:
rm -f gmon.out *.gcov *.gcno *.gcda