[GRASS-SVN] r33469 - grass/trunk/swig/python

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Sep 16 04:54:05 EDT 2008


Author: glynn
Date: 2008-09-16 04:54:05 -0400 (Tue, 16 Sep 2008)
New Revision: 33469

Modified:
   grass/trunk/swig/python/Makefile
   grass/trunk/swig/python/python_grass7.i
Log:
Use a variable for the module name
Correct the name of the dynamic library (has leading underscore)
Add $(GMATHLIB) (some of the functions declared in gis.h are actually
 defined in the gmath library)
Add dependencies for %_wrap.c
Add Python version of G_gisinit()


Modified: grass/trunk/swig/python/Makefile
===================================================================
--- grass/trunk/swig/python/Makefile	2008-09-16 08:51:15 UTC (rev 33468)
+++ grass/trunk/swig/python/Makefile	2008-09-16 08:54:05 UTC (rev 33469)
@@ -3,32 +3,44 @@
 include $(MODULE_TOPDIR)/include/Make/Lib.make
 include $(MODULE_TOPDIR)/include/Make/Doxygen.make
 
+LIB_NAME = python_grass7
+
 CFLAGS=-c -fpic -I. $(ARCH_INC) $(GDALCFLAGS) $(PYTHONCFLAGS)
 
-LDFLAGS=-shared -L$(ARCH_LIBDIR) $(GDALLIBS) $(PYTHONLDFLAGS) $(VECTLIB) $(IMAGERYLIB) $(GISLIB)
+LDFLAGS=-shared -L$(ARCH_LIBDIR) $(GDALLIBS) $(PYTHONLDFLAGS) $(VECTLIB) $(IMAGERYLIB) $(GMATHLIB) $(GISLIB)
 
 # TODO: build the NumPtr module. See NumPtr/README.GRASS
 #SUBDIRS = NumPtr
 #include $(MODULE_TOPDIR)/include/Make/Dir.make
 
-default: python_grass7.so numptr
+default: _$(LIB_NAME).so numptr
 
 clean:
-	-rm -f *.o *.so python_grass7_wrap.c python_grass7.pyc python_grass7.py
+	-rm -f *.o *.so $(LIB_NAME)_wrap.c $(LIB_NAME).pyc $(LIB_NAME).py
 
-python_grass7_wrap.c: python_grass7.i
+$(LIB_NAME)_wrap.c: $(LIB_NAME).i
 	$(SWIG) $(ARCH_INC) -python -shadow $<
 
 
-python_grass7_wrap.o: python_grass7_wrap.c
+$(LIB_NAME)_wrap.o: $(LIB_NAME)_wrap.c
 	$(CC) $(CFLAGS) $(INCLUDE_DIRS) $<
 
-python_grass7.so: python_grass7_wrap.o
-	$(LD) $(LDFLAGS) $< -o _python_grass7.so
+_$(LIB_NAME).so: $(LIB_NAME)_wrap.o
+	$(LD) $(LDFLAGS) $< -o _$(LIB_NAME).so
 
 numptr:
 	$(MAKE) -C NumPtr
 
+.PHONY: numptr
+
 # doxygen:
 DOXNAME=
 DOXINPUT=grasspython.dox
+
+$(LIB_NAME)_wrap.c: $(ARCH_INCDIR)/gis.h
+$(LIB_NAME)_wrap.c: $(ARCH_INCDIR)/gisdefs.h
+$(LIB_NAME)_wrap.c: $(ARCH_INCDIR)/imagery.h
+$(LIB_NAME)_wrap.c: $(ARCH_INCDIR)/imagedefs.h
+$(LIB_NAME)_wrap.c: $(ARCH_INCDIR)/Vect.h
+$(LIB_NAME)_wrap.c: $(ARCH_INCDIR)/vect/dig_structs.h
+$(LIB_NAME)_wrap.c: $(ARCH_INCDIR)/vect/dig_defines.h

Modified: grass/trunk/swig/python/python_grass7.i
===================================================================
--- grass/trunk/swig/python/python_grass7.i	2008-09-16 08:51:15 UTC (rev 33468)
+++ grass/trunk/swig/python/python_grass7.i	2008-09-16 08:54:05 UTC (rev 33469)
@@ -32,3 +32,8 @@
 %include "grass/vect/dig_structs.h"
 %include "grass/vect/dig_defines.h"
 
+%pythoncode %{
+def G_gisinit(pgm):
+    G__gisinit(GIS_H_VERSION, pgm)
+
+%}



More information about the grass-commit mailing list