|
@@ -3,27 +3,51 @@ MODULE_TOPDIR = ../..
|
|
|
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) $(GMATHLIB) $(GISLIB)
|
|
|
+LDFLAGS=-shared -L$(ARCH_LIBDIR) $(GDALLIBS) $(PYTHONLDFLAGS)
|
|
|
+
|
|
|
+MODULES = grass math imagery vector proj raster display stats
|
|
|
|
|
|
+vector_LIBS = $(VECTLIB)
|
|
|
+imagery_LIBS = $(IMAGERYLIB)
|
|
|
+grass_LIBS = $(GISLIB)
|
|
|
+math_LIBS = $(GMATHLIB)
|
|
|
+proj_LIBS = $(GPROJLIB)
|
|
|
+raster_LIBS = $(RASTERLIB)
|
|
|
+display_LIBS = $(DISPLAYLIB)
|
|
|
+stats_LIBS = $(STATSLIB)
|
|
|
|
|
|
-EXTRA_CLEAN_FILES = $(LIB_NAME)_wrap.o _$(LIB_NAME).so $(LIB_NAME)_wrap.c $(LIB_NAME).pyc $(LIB_NAME).py
|
|
|
+EXTRA_CLEAN_FILES := $(foreach M,$(MODULES),$(M)_wrap.o $(M)_wrap.c $(M).pyc $(M).py)
|
|
|
CLEAN_SUBDIRS = NumPtr
|
|
|
|
|
|
-default: _$(LIB_NAME).so numptr
|
|
|
+DSTDIR = $(ARCH_DISTDIR)/etc/python/swig
|
|
|
+
|
|
|
+LIBFILES := $(patsubst %,$(DSTDIR)/_%.so,$(MODULES))
|
|
|
+PYFILES := $(patsubst %,$(DSTDIR)/%.py,$(MODULES))
|
|
|
+PYCFILES := $(patsubst %,$(DSTDIR)/%.pyc,$(MODULES))
|
|
|
+
|
|
|
+default: $(LIBFILES) $(PYFILES) $(DSTDIR)/__init__.pyc numptr
|
|
|
|
|
|
-%_wrap.c: %.i my_typemaps.i renames.i
|
|
|
+%_wrap.c %.py: %.i my_typemaps.i renames.i common.i
|
|
|
$(SWIG) $(ARCH_INC) -python -shadow $<
|
|
|
|
|
|
-%_wrap.o: %_wrap.c
|
|
|
- $(CC) $(CFLAGS) $(INCLUDE_DIRS) $<
|
|
|
+$(OBJDIR)/%_wrap.o: %_wrap.c
|
|
|
+ test -d $(OBJDIR) || $(MKDIR) -p $(OBJDIR)
|
|
|
+ $(CC) $(CFLAGS) $(INCLUDE_DIRS) -o $@ $<
|
|
|
+
|
|
|
+$(DSTDIR)/_%.so: $(OBJDIR)/%_wrap.o
|
|
|
+ test -d $(DSTDIR) || $(MKDIR) -p $(DSTDIR)
|
|
|
+ $(SHLIB_LD) -o $@ $(LDFLAGS) $^ $($*_LIBS)
|
|
|
+
|
|
|
+$(DSTDIR)/%.py: %.py
|
|
|
+ test -d $(DSTDIR) || $(MKDIR) -p $(DSTDIR)
|
|
|
+ $(INSTALL_DATA) $< $@
|
|
|
+
|
|
|
+$(DSTDIR)/%.pyc: $(DSTDIR)/%.py $(DSTDIR)/_%.so
|
|
|
+ cd $(DSTDIR) && echo "import $*" | python; true
|
|
|
|
|
|
-_%.so: %_wrap.o
|
|
|
- $(LD) $(LDFLAGS) $< -o $@
|
|
|
- # build bytecode .pyc file; ignore undefined symbol error
|
|
|
- echo "import $*" | python; true
|
|
|
+$(DSTDIR)/__init__.pyc: $(DSTDIR)/__init__.py $(LIBFILES) $(PYCFILES)
|
|
|
+ cd $(DSTDIR) && echo "import __init__" | python; true
|
|
|
|
|
|
numptr:
|
|
|
$(MAKE) -C NumPtr
|
|
@@ -34,10 +58,15 @@ numptr:
|
|
|
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
|
|
|
+display_wrap.c: $(ARCH_INCDIR)/display.h
|
|
|
+grass_wrap.c: $(ARCH_INCDIR)/gis.h
|
|
|
+grass_wrap.c: $(ARCH_INCDIR)/gisdefs.h
|
|
|
+imagery_wrap.c: $(ARCH_INCDIR)/imagedefs.h
|
|
|
+imagery_wrap.c: $(ARCH_INCDIR)/imagery.h
|
|
|
+math_wrap.c: $(ARCH_INCDIR)/gmath.h
|
|
|
+proj_wrap.c: $(ARCH_INCDIR)/gprojects.h
|
|
|
+raster_wrap.c: $(ARCH_INCDIR)/raster.h
|
|
|
+stats_wrap.c: $(ARCH_INCDIR)/stats.h
|
|
|
+vector_wrap.c: $(ARCH_INCDIR)/Vect.h
|
|
|
+vector_wrap.c: $(ARCH_INCDIR)/vect/dig_defines.h
|
|
|
+vector_wrap.c: $(ARCH_INCDIR)/vect/dig_structs.h
|