PREFIX?= /usr/local AR= /usr/bin/ar CC= /usr/bin/cc INSTALL= /usr/bin/install LN= /bin/ln RANLIB= /usr/bin/ranlib CFLAGS= -DPOSIX -O LDFLAGS= INST_INCDIR= $(PREFIX)/include INST_LIBDIR= $(PREFIX)/lib INST_MANDIR= $(PREFIX)/man SHLIB_VERSION = 1 SHLIB_CFLAGS = -fpic -DPIC SHLIB_LDFLAGS = -shared SHLIB_TGT = $(INST_LIBDIR)/libgetline.so.$(SHLIB_VERSION) SHLIB_TGT_SPEC = -Wl,-h$(SHLIB_TGT) all: libgetline.a libgetline.so.$(SHLIB_VERSION) # try this after installing to check the installed static library testgl: libgetline.a testgl.o $(CC) $(LDFLAGS) $(CFLAGS) -o testgl testgl.o -L$(INST_MANDIR) -lgetline testgl.o: testgl.c getline.h libgetline.a: getline.o $(AR) cr libgetline.a getline.o -$(RANLIB) libgetline.a getline.o: getline.c getline.h libgetline.so.1: getline.So $(CC) $(SHLIB_LDFLAGS) $(SHLIB_TGT_SPEC) -o libgetline.so.1 getline.So getline.So: getline.c getline.h $(CC) -c $(LDFLAGS) $(CFLAGS) $(SHLIB_CFLAGS) -o getline.So getline.c clean: rm -f testgl *.o *.So *.a *.so.1 install: [ -d $(INST_LIBDIR) ] || $(INSTALL) -d $(INST_LIBDIR) $(INSTALL) -c -g bin -o bin -m 644 libgetline.a libgetline.so.1 \ $(INST_LIBDIR) $(LN) -fs $(INST_LIBDIR)/libgetline.so.$(SHLIB_VERSION) \ $(INST_LIBDIR)/libgetline.so [ -d $(INST_MANDIR)/man3 ] || $(INSTALL) -d $(INST_MANDIR)/man3 $(INSTALL) -c -g bin -o bin -m 644 getline.3 $(INST_MANDIR)/man3 [ -d $(INST_INCDIR) ] || $(INSTALL) -d $(INST_INCDIR) $(INSTALL) -c -g bin -o bin -m 644 getline.h $(INST_INCDIR)