]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
added rules for building shared libs
authorewt <ewt>
Thu, 20 Jun 1996 00:56:50 +0000 (00:56 +0000)
committerewt <ewt>
Thu, 20 Jun 1996 00:56:50 +0000 (00:56 +0000)
Makefile

index 557f2083cc0fd6c03d93c0415065741183f86f65..4e498e25a27032ec6223b33fb489c46655e93863 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -6,9 +6,13 @@ VERSION = 0.1
 PROGS = test
 OBJS = test.o
 LIBNEWT = libnewt.a
+LIBNEWTSH = libnewt.so.0.1
+LIBNEWTSONAME = libnewt.so.0
 LIBOBJS = newt.o button.o form.o checkbox.o entry.o label.o listbox.o \
           scrollbar.o textbox.o
 
+SHCFLAGS = -fPIC
+
 prefix = /usr
 includedir = $(prefix)/include
 libdir = $(prefix)/lib
@@ -17,6 +21,9 @@ libdir = $(prefix)/lib
 
 SOURCES = $(subst .o,.c,$(OBJS) $(LIBOBJS)) 
 
+SHAREDDIR = shared
+SHAREDOBJS = $(patsubst %,$(SHAREDDIR)/%, $(LIBOBJS))
+
 ifeq (.depend,$(wildcard .depend))
 TARGET=$(PROGS)
 else
@@ -42,12 +49,32 @@ clean:
 depend:
        $(CPP) $(CFLAGS) -M $(SOURCES) > .depend
 
-install:
+shareddir:
+       mkdir -p shared
+
+shared: shareddir $(LIBNEWTSH)
+
+$(LIBNEWTSH): $(SHAREDOBJS)
+       gcc -shared -o $(LIBNEWTSH) -Wl,-soname,$(LIBNEWTSONAME) $(SHAREDOBJS)
+
+$(SHAREDDIR)/%.o : %.c
+       $(CC) $(SHCFLAGS) -c $(CFLAGS) -o $@ $<
+
+$(SHAREDDIR)/newt.o: newt.c Makefile
+       $(CC) $(SHCFLAGS) $(CFLAGS) -DVERSION=\"$(VERSION)\" -c -o $@ $<
+
+
+install: $(LIBNEWT)
        install -m 755 -o 0 -g 0 -d $(libdir)
        install -m 755 -o 0 -g 0 -d $(includedir)
        install -m 644 -o 0 -g 0 newt.h $(includedir)
        install -m 644 -o 0 -g 0 $(LIBNEWT) $(libdir)
 
+install-sh: shared
+       install -m 755 -o 0 -g 0 $(LIBNEWTSH) $(libdir)
+       ln -s $(LIBNEWTSH) $(libdir)/libnewt.so
+       /sbin/ldconfig
+
 archive: 
        @rm -rf /tmp/newt-$(VERSION)
        @mkdir /tmp/newt-$(VERSION)