01pkg1a: pkg1.[ch] plus usepkg1.c, making libpkg1.so shared library

Suppose we start by writing a plain C file called pkg1.c (in this dir)
containing a bunch of functions of varying types:

Then we generate the matching modular header file pkg1.h (also here)

Then we add a simple program usepkg1.c that imports pkg1
and uses those functions.

Then we add a Makefile to build pkg1 as a shared library.  It compiles
all our C code using gcc's -fPIC (position independent code flag):

  CC		=	gcc
  CFLAGS	=	-Wall -fPIC

then it creates a shared library libpkg1.so from pkg1.o:

  libpkg1.so:	pkg1.o
	$(CC) -shared -Wl,-soname,libpkg1.so -o libpkg1.so pkg1.o

then finally we link libpkg1.so with usepkg1.o:

  usepkg1:	usepkg1.o libpkg1.so
	$(CC) -o usepkg1 usepkg1.o -L. -lpkg1

Now, compile everything:

  make

I tried running the executable:

  ./usepkg1 

and saw the confusing:

  ./usepkg1: error while loading shared libraries: libpkg1.so: cannot open shared object file: No such file or directory

To see why, use the "ldd" tool to see the missing shared library:

  ldd usepkg1
  linux-vdso.so.1 =>  ...
  libpkg1.so => not found
  libc.so.6 => ...
  /lib64/ld-linux-x86-64.so.2 ...

To fix this, you have to tell the runtime linker to search
the current directory for shared libraries:

Bash/sh users:
	export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"

csh users:
	setenv LD_LIBRARY_PATH ".:$LD_LIBRARY_PATH"

To check, use the "ldd" tool to see:

  ldd usepkg1

  linux-vdso.so.1 =>  ...
  libpkg1.so => ./libpkg1.so (0x00007fd5566d6000)
  libc.so.6 => ...
  /lib64/ld-linux-x86-64.so.2 ...

Now run it as normal:

  ./usepkg1

