Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. MODULE_TOPDIR = ../..
  2. PACKAGE = "grasslibs"
  3. include $(MODULE_TOPDIR)/include/Make/Other.make
  4. include $(MODULE_TOPDIR)/include/Make/Compile.make
  5. include $(MODULE_TOPDIR)/include/Make/Doxygen.make
  6. # substitute OSX arch flags for python
  7. ifneq ($(MACOSX_ARCHS),)
  8. CFLAGS := $(subst $(MACOSX_ARCHS),,$(CFLAGS)) $(MACOSX_ARCHS_PYTHON)
  9. LDFLAGS := $(subst $(MACOSX_ARCHS),,$(LDFLAGS)) $(MACOSX_ARCHS_PYTHON)
  10. endif
  11. # doxygen:
  12. DOXNAME=
  13. DOXINPUT=grasspython.dox
  14. MODULES = utils date grass raster math proj imagery vector display stats \
  15. dbmi g3d arraystats cluster trans vedit
  16. date_LIBS = $(DATETIMELIB)
  17. grass_LIBS = $(GISLIB)
  18. raster_LIBS = $(RASTERLIB)
  19. math_LIBS = $(GMATHLIB)
  20. proj_LIBS = $(GPROJLIB)
  21. imagery_LIBS = $(IMAGERYLIB)
  22. vector_LIBS = $(VECTLIB)
  23. display_LIBS = $(DISPLAYLIB)
  24. stats_LIBS = $(STATSLIB)
  25. dbmi_LIBS = $(DBMILIB)
  26. g3d_LIBS = $(G3DLIB)
  27. arraystats_LIBS = $(ARRAYSTATSLIB)
  28. cluster_LIBS = $(CLUSTERLIB)
  29. trans_LIBS = $(TRANSLIB)
  30. vedit_LIBS = $(VEDITLIB)
  31. vector_wrap_c_FLAGS = $(VECT_INC) $(VECT_CFLAGS) $(GEOSCFLAGS)
  32. vedit_wrap_c_FLAGS = $(VECT_INC) $(VECT_CFLAGS)
  33. proj_wrap_c_FLAGS = $(PROJINC) $(GDALCFLAGS)
  34. EXTRA_SWIG = ../include/python/my_typemaps.i ../include/python/common.i
  35. SWIGFLAGS = $(INC) -I../include/python -outdir .
  36. EXTRA_CFLAGS = $(PYMOD_CFLAGS)
  37. EXTRA_CLEAN_FILES := $(foreach M,$(MODULES),$(M)_wrap.o $(M)_wrap.c $(M).pyc $(M).py _$(M).so)
  38. CLEAN_SUBDIRS = NumPtr
  39. ifneq ($(MINGW),)
  40. SWIGFLAGS += -D__MINGW32__
  41. EXTRA_LIBS = $(INTLLIB)
  42. endif
  43. include $(MODULE_TOPDIR)/include/Make/Python.make
  44. PYDIR = $(ETC)/python
  45. GDIR = $(PYDIR)/grass
  46. DSTDIR = $(GDIR)/lib
  47. LIBFILES := $(patsubst %,$(DSTDIR)/_%.so,$(MODULES))
  48. PYFILES := $(patsubst %,$(DSTDIR)/%.py,$(MODULES) __init__)
  49. PYCFILES := $(patsubst %,$(DSTDIR)/%.pyc,$(MODULES) __init__)
  50. LLIBFILES := $(patsubst %,_%.so,$(MODULES))
  51. WRAPFILES := $(patsubst %,%_wrap.c,$(MODULES))
  52. LPYFILES := $(patsubst %,%.py,$(MODULES))
  53. default:
  54. $(MAKE) $(DSTDIR)
  55. $(MAKE) $(LLIBFILES) $(WRAPFILES) $(LPYFILES) $(LIBFILES) $(PYFILES) $(PYCFILES)
  56. %_wrap.c %.py: ../include/%.i $(EXTRA_SWIG)
  57. $(SWIG) $(SWIGFLAGS) -python -o $*_wrap.c -module $* -shadow $<
  58. %_wrap.c %.py: ../include/python/%.i $(EXTRA_SWIG)
  59. $(SWIG) $(SWIGFLAGS) -python -o $*_wrap.c -module $* -shadow $<
  60. $(PYDIR):
  61. $(MKDIR) $@
  62. $(GDIR): | $(PYDIR)
  63. $(MKDIR) $@
  64. $(DSTDIR): | $(GDIR)
  65. $(MKDIR) $@
  66. $(DSTDIR)/_%.so: _%.so | $(DSTDIR)
  67. $(INSTALL) $< $@
  68. $(DSTDIR)/%.py: %.py | $(DSTDIR)
  69. $(INSTALL_DATA) $< $@
  70. numptr:
  71. $(MAKE) -C NumPtr
  72. .PHONY: numptr
  73. .SECONDARY: $(patsubst %,%.py,$(MODULES))
  74. .SECONDARY: $(patsubst %,%_wrap.c,$(MODULES))
  75. .SECONDARY: $(patsubst %,$(OBJDIR)/%_wrap.o,$(MODULES))
  76. .SECONDARY: $(patsubst %,_%.so,$(MODULES))
  77. date_wrap.c: $(GISBASE)/include/grass/datetime.h
  78. date_wrap.c: $(GISBASE)/include/grass/P_datetime.h
  79. grass_wrap.c: $(GISBASE)/include/grass/gis.h
  80. grass_wrap.c: $(GISBASE)/include/grass/gisdefs.h
  81. raster_wrap.c: $(GISBASE)/include/grass/raster.h
  82. math_wrap.c: $(GISBASE)/include/grass/gmath.h
  83. proj_wrap.c: $(GISBASE)/include/grass/gprojects.h
  84. imagery_wrap.c: $(GISBASE)/include/grass/imagedefs.h
  85. imagery_wrap.c: $(GISBASE)/include/grass/imagery.h
  86. vector_wrap.c: $(GISBASE)/include/grass/vector.h
  87. vector_wrap.c: $(GISBASE)/include/grass/vect/dig_defines.h
  88. vector_wrap.c: $(GISBASE)/include/grass/vect/dig_structs.h
  89. display_wrap.c: $(GISBASE)/include/grass/display.h
  90. stats_wrap.c: $(GISBASE)/include/grass/stats.h
  91. dbmi_wrap.c: $(GISBASE)/include/grass/dbmi.h
  92. dbmi_wrap.c: $(GISBASE)/include/grass/proto_dbmi.h
  93. g3d_wrap.c: $(GISBASE)/include/grass/G3d.h
  94. arraystats_wrap.c: $(GISBASE)/include/grass/arraystats.h
  95. cluster_wrap.c: $(GISBASE)/include/grass/cluster.h
  96. trans_wrap.c: $(GISBASE)/include/grass/transform.h
  97. vedit_wrap.c: $(GISBASE)/include/grass/vedit.h