Index: /trunk/psphot/Makefile.am
===================================================================
--- /trunk/psphot/Makefile.am	(revision 7503)
+++ /trunk/psphot/Makefile.am	(revision 7504)
@@ -3,3 +3,8 @@
 CLEANFILES = *.pyc *~ core core.*
 
-EXTRA_DIST = autogen.sh
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA= psphot.pc
+
+EXTRA_DIST = \
+	psphot.pc.in \
+	autogen.sh
Index: /trunk/psphot/configure.ac
===================================================================
--- /trunk/psphot/configure.ac	(revision 7503)
+++ /trunk/psphot/configure.ac	(revision 7504)
@@ -42,11 +42,13 @@
 
 dnl Set CFLAGS for build
-CFLAGS="${CFLAGS}"
-psphot_CFLAGS="-Wall -Werror -std=c99"
-AC_SUBST([psphot_CFLAGS])
+CFLAGS="${CFLAGS} -Wall -Werror -std=c99"
+
+AC_SUBST([PSPHOT_CFLAGS])
+AC_SUBST([PSPHOT_LIBS])
 
 AC_CONFIG_FILES([
   Makefile
   src/Makefile
+  psphot.pc
 ])
 
Index: /trunk/psphot/psphot.pc.in
===================================================================
--- /trunk/psphot/psphot.pc.in	(revision 7504)
+++ /trunk/psphot/psphot.pc.in	(revision 7504)
@@ -0,0 +1,10 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libpsphot
+Description: Pan-STARRS Photometry Library
+Version: @VERSION@
+Libs: -L${libdir} -lpsphot @PSPHOT_LIBS@
+Cflags: -I${includedir} @PSPHOT_CFLAGS@
Index: /trunk/psphot/src/Makefile.am
===================================================================
--- /trunk/psphot/src/Makefile.am	(revision 7503)
+++ /trunk/psphot/src/Makefile.am	(revision 7504)
@@ -1,9 +1,9 @@
 
 lib_LTLIBRARIES = libpsphot.la
-libpsphot_la_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(psphot_CFLAGS)
+libpsphot_la_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSPHOT_CFLAGS)
 # libpsphot_la_LDFLAGS = $(PSMODULE_LIBS) $(PSLIB_LIBS)
 
 bin_PROGRAMS = psphot
-psphot_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(psphot_CFLAGS)
+psphot_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PSPHOT_CFLAGS)
 psphot_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS)
 psphot_LDADD = libpsphot.la
@@ -17,5 +17,5 @@
 
 libpsphot_la_SOURCES = \
-	errorCodes.c		\
+	psphotErrorCodes.c	\
 	psphotModelGroupInit.c	\
 	psphotArguments.c	\
@@ -50,5 +50,6 @@
 
 include_HEADERS = \
-	psphot.h		
+	psphot.h \
+	psphotErrorCodes.h
 
 clean-local:
@@ -61,10 +62,10 @@
 # Error codes.
 #
-BUILT_SOURCES = psphotErrorCodes.h errorCodes.c
-CLEANFILES = psphotErrorCodes.h errorCodes.c
+BUILT_SOURCES = psphotErrorCodes.h psphotErrorCodes.c
+CLEANFILES = psphotErrorCodes.h psphotErrorCodes.c
 
-psphotErrorCodes.h : errorCodes.dat psphotErrorCodes.h.in
-	$(ERRORCODES) --data=errorCodes.dat --outdir=. psphotErrorCodes.h
+psphotErrorCodes.h : psphotErrorCodes.dat psphotErrorCodes.h.in
+	$(ERRORCODES) --data=psphotErrorCodes.dat --outdir=. psphotErrorCodes.h
 
-errorCodes.c : errorCodes.dat errorCodes.c.in psphotErrorCodes.h
-	$(ERRORCODES) --data=errorCodes.dat --outdir=. errorCodes.c
+psphotErrorCodes.c : psphotErrorCodes.dat psphotErrorCodes.c.in psphotErrorCodes.h
+	$(ERRORCODES) --data=psphotErrorCodes.dat --outdir=. psphotErrorCodes.c
Index: unk/psphot/src/errorCodes.c.in
===================================================================
--- /trunk/psphot/src/errorCodes.c.in	(revision 7503)
+++ 	(revision )
@@ -1,26 +1,0 @@
-/*
- * The line
-    { PSPHOT_ERR_$X{ErrorCode}, "$X{ErrorDescription}"},
- * (without the Xs)
- * will be replaced by values from errorCodes.dat
- */
-#include "pslib.h"
-#include "psphotErrorCodes.h"
-
-void psphotErrorRegister(void)
-{
-    static psErrorDescription errors[] = {
-       { PSPHOT_ERR_BASE, "First value we use; lower values belong to psLib" },
-       { PSPHOT_ERR_${ErrorCode}, "${ErrorDescription}"},
-    };
-    static int nerror = PSPHOT_ERR_NERROR - PSPHOT_ERR_BASE; // number of values in enum
-
-    for (int i = 0; i < nerror; i++) {
-       psErrorDescription *tmp = psAlloc(sizeof(psErrorDescription));
-       p_psMemSetPersistent(tmp, true);
-       *tmp = errors[i];
-       psErrorRegister(tmp, 1);
-       psFree(tmp);			/* it's on the internal list */
-    }
-    nerror = 0;			                // don't register more than once
-}
Index: unk/psphot/src/errorCodes.dat
===================================================================
--- /trunk/psphot/src/errorCodes.dat	(revision 7503)
+++ 	(revision )
@@ -1,11 +1,0 @@
-#
-# This file is used to generate pmErrorClasses.h
-#
-BASE = 512		First value we use; lower values belong to psLib
-UNKNOWN			Unknown PM error code
-NOT_IMPLEMENTED		Desired feature is not yet implemented
-ARGUMENTS		Incorrect arguments
-CONFIG			Problem in configure files
-FITS			Problem in FITS I/O
-FITS_WCS		Error interpreting FITS WCS information
-PHOTOM			Problem in photometry
Index: /trunk/psphot/src/psphotErrorCodes.c.in
===================================================================
--- /trunk/psphot/src/psphotErrorCodes.c.in	(revision 7504)
+++ /trunk/psphot/src/psphotErrorCodes.c.in	(revision 7504)
@@ -0,0 +1,26 @@
+/*
+ * The line
+    { PSPHOT_ERR_$X{ErrorCode}, "$X{ErrorDescription}"},
+ * (without the Xs)
+ * will be replaced by values from errorCodes.dat
+ */
+#include "pslib.h"
+#include "psphotErrorCodes.h"
+
+void psphotErrorRegister(void)
+{
+    static psErrorDescription errors[] = {
+       { PSPHOT_ERR_BASE, "First value we use; lower values belong to psLib" },
+       { PSPHOT_ERR_${ErrorCode}, "${ErrorDescription}"},
+    };
+    static int nerror = PSPHOT_ERR_NERROR - PSPHOT_ERR_BASE; // number of values in enum
+
+    for (int i = 0; i < nerror; i++) {
+       psErrorDescription *tmp = psAlloc(sizeof(psErrorDescription));
+       p_psMemSetPersistent(tmp, true);
+       *tmp = errors[i];
+       psErrorRegister(tmp, 1);
+       psFree(tmp);			/* it's on the internal list */
+    }
+    nerror = 0;			                // don't register more than once
+}
Index: /trunk/psphot/src/psphotErrorCodes.dat
===================================================================
--- /trunk/psphot/src/psphotErrorCodes.dat	(revision 7504)
+++ /trunk/psphot/src/psphotErrorCodes.dat	(revision 7504)
@@ -0,0 +1,11 @@
+#
+# This file is used to generate pmErrorClasses.h
+#
+BASE = 512		First value we use; lower values belong to psLib
+UNKNOWN			Unknown PM error code
+NOT_IMPLEMENTED		Desired feature is not yet implemented
+ARGUMENTS		Incorrect arguments
+CONFIG			Problem in configure files
+FITS			Problem in FITS I/O
+FITS_WCS		Error interpreting FITS WCS information
+PHOTOM			Problem in photometry
