From: ewt Date: Thu, 20 Jun 1996 00:56:50 +0000 (+0000) Subject: added rules for building shared libs X-Git-Tag: 0-1~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=792a1c27df9fce03c28cf6ee97ca7ed28e857b87;p=thirdparty%2Fnewt.git added rules for building shared libs --- diff --git a/Makefile b/Makefile index 557f208..4e498e2 100644 --- 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)