Grass.make 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. #########################################################################
  2. # Variable names
  3. # xxxINCDIR directory(ies) including header files (example: /usr/include)
  4. # xxxINC cc option(s) for include directory (example: -I/usr/inlude)
  5. # xxxLIBDIR directory(ies) containing library (example: /usr/lib)
  6. # xxxLIBPATH cc option for library directory (example: -L/usr/lib)
  7. # xxx_LIBNAME library name (example: gis)
  8. # xxxLIB full static library path
  9. # (example: /home/abc/grass63/dist.i686-pc-linux-gnu/lib/libgis.a)
  10. # xxxDEP dependency
  11. #
  12. # GRASS_xxx GRASS specific (without ARCH_xxx)
  13. #
  14. # ARCH_xxx platform specific dirs (without GRASS_xxx)
  15. #
  16. # _xxx GRASS_xxx + ARCH_xxx
  17. #
  18. # ALLxxx all known for GRASS make system
  19. #
  20. #########################################################################
  21. RELDIR := $(subst $(GRASS_HOME)/,,$(CURDIR))
  22. # GRASS global directories and constants
  23. # platform specific dirs
  24. ARCH_DISTDIR = $(GRASS_HOME)/dist.$(ARCH)
  25. ARCH_BINDIR = $(GRASS_HOME)/bin.$(ARCH)
  26. GISBASE = $(ARCH_DISTDIR)
  27. ERRORLOG = $(GRASS_HOME)/error.log
  28. # include dirs
  29. ARCH_INCDIR = $(ARCH_DISTDIR)/include/grass
  30. INC = -I$(ARCH_DISTDIR)/include -I$(GISBASE)/include
  31. VECT_INC = $(PQINCPATH)
  32. # libraries
  33. ARCH_LIBDIR = $(ARCH_DISTDIR)/lib
  34. BASE_LIBDIR = $(GISBASE)/lib
  35. LIBPATH = -L$(ARCH_LIBDIR) -L$(BASE_LIBDIR)
  36. # object dir
  37. OBJDIR = OBJ.$(ARCH)
  38. LIB_RUNTIME_DIR = $(GISBASE)/lib
  39. RUN_GISRC = $(GISBASE)/demolocation/.grassrc$(GRASS_VERSION_MAJOR)$(GRASS_VERSION_MINOR)
  40. #########################################################################
  41. # these define the various directories which contain GRASS programs
  42. # or files used by GRASS programs
  43. BIN = $(ARCH_DISTDIR)/bin
  44. DRIVERDIR = $(ARCH_DISTDIR)/driver
  45. DBDRIVERDIR = $(ARCH_DISTDIR)/driver/db
  46. DOCSDIR = $(ARCH_DISTDIR)/docs
  47. ETC = $(ARCH_DISTDIR)/etc
  48. GUIDIR = $(ARCH_DISTDIR)/gui
  49. HTMLDIR = $(ARCH_DISTDIR)/docs/html
  50. SCRIPTDIR = $(ARCH_DISTDIR)/scripts
  51. MSG_DIR = $(ARCH_DISTDIR)/etc/msgs
  52. MO_DIR = $(ARCH_DISTDIR)/locale
  53. UTILSDIR = $(ARCH_DISTDIR)/utils
  54. FONTDIR = $(ARCH_DISTDIR)/fonts
  55. GRASS_VERSION_NUMBER = $(GRASS_VERSION_MAJOR).$(GRASS_VERSION_MINOR).$(GRASS_VERSION_RELEASE)
  56. GRASS_LIB_VERSION_NUMBER = $(GRASS_VERSION_MAJOR).$(GRASS_VERSION_MINOR)
  57. GRASS_NAME = grass
  58. ##################### other #############################################
  59. COMPILE_FLAGS_C = $(CPPFLAGS) $(CFLAGS) $(INCLUDE_DIRS) $(INC)
  60. COMPILE_FLAGS_CXX = $(CPPFLAGS) $(CXXFLAGS) $(INCLUDE_DIRS) $(INC)
  61. LDFLAGS = $(LIBPATH) $(LINK_FLAGS) $(LD_SEARCH_FLAGS)
  62. VECT_CFLAGS = $(GDALCFLAGS) $(GEOSCFLAGS)
  63. # Object with _fmode which must be linked to each executable on Windows
  64. ifdef MINGW
  65. FMODE_OBJ = $(BASE_LIBDIR)/fmode.o
  66. # if fmode.o causes trouble, try:
  67. # FMODE_OBJ = /lib/binmode.o
  68. MANIFEST_OBJ = $(OBJDIR)/$(basename $(notdir $@)).manifest.res
  69. MANIFEST = internal
  70. endif
  71. # lexical analyzer and default options
  72. LFLAGS =
  73. # parser generator and default options
  74. YFLAGS = -d -v
  75. MANSECT = 1
  76. MANBASEDIR = $(ARCH_DISTDIR)/docs/man
  77. MANDIR = $(MANBASEDIR)/man$(MANSECT)
  78. HTML2MAN = VERSION_NUMBER=$(GRASS_VERSION_NUMBER) $(GISBASE)/utils/g.html2man.py
  79. GDAL_LINK = $(USE_GDAL)
  80. GDAL_DYNAMIC = 1
  81. DEPFILE = depend.mk
  82. ##################### library switches ##################################
  83. libs = \
  84. ARRAYSTATS:arraystats \
  85. BASIC:basic \
  86. BITMAP:bitmap \
  87. BTREE:btree \
  88. BTREE2:btree2 \
  89. CAIRODRIVER:cairodriver \
  90. CALC:calc \
  91. CDHC:cdhc \
  92. CCMATH:ccmath \
  93. CLUSTER:cluster \
  94. COORCNV:coorcnv \
  95. DATETIME:datetime \
  96. DBDIALOG:dbdialog \
  97. DBMIBASE:dbmibase \
  98. DBMICLIENT:dbmiclient \
  99. DBMIDRIVER:dbmidriver \
  100. DBSTUBS:dbstubs \
  101. DIG2:dig2 \
  102. DIG:dig \
  103. DISPLAY:display \
  104. DLG:dlg \
  105. DRIVER:driver \
  106. DSPF:dspf \
  107. RASTER3D:g3d \
  108. GIS:gis \
  109. GMATH:gmath \
  110. GPDE:gpde \
  111. GPROJ:gproj \
  112. GRAPH:dgl \
  113. HTMLDRIVER:htmldriver \
  114. IBTREE:ibtree \
  115. ICON:icon \
  116. IMAGERY:imagery \
  117. INTERPDATA:interpdata \
  118. INTERPFL:interpfl \
  119. IORTHO:iortho \
  120. ISMAP:ismap \
  121. LIA:lia \
  122. LIDAR:lidar \
  123. LINKM:linkm \
  124. LOCK:lock \
  125. LRS:lrs \
  126. MANAGE:manage \
  127. NVIZ:nviz \
  128. OGSF:ogsf \
  129. OPTRI:optri \
  130. PNGDRIVER:pngdriver \
  131. PSDRIVER:psdriver \
  132. QTREE:qtree \
  133. RASTER:raster \
  134. RLI:rli \
  135. ROWIO:rowio \
  136. RTREE:rtree \
  137. SEGMENT:segment \
  138. SHAPE:shape \
  139. SIM:sim \
  140. SITES:sites \
  141. SOS:sos \
  142. SQLP:sqlp \
  143. STATS:stats \
  144. SYMB:symb \
  145. TEMPORAL:temporal \
  146. VECTOR:vector \
  147. VEDIT:vedit \
  148. NETA:neta \
  149. XDISPLAY:xdisplay \
  150. XGD:xgd \
  151. XGI:xgi \
  152. XPM:xpm \
  153. IOSTREAM:iostream
  154. ARRAYSTATSDEPS = $(GISLIB) $(MATHLIB)
  155. BITMAPDEPS = $(LINKMLIB)
  156. BTREE2DEPS = $(GISLIB)
  157. CAIRODRIVERDEPS = $(DRIVERLIB) $(GISLIB) $(CAIROLIB) $(FCLIB) $(ICONVLIB)
  158. CALCDEPS = $(RASTERLIB) $(GISLIB) $(MATHLIB)
  159. CDHCDEPS = $(MATHLIB)
  160. CLUSTERDEPS = $(IMAGERYLIB) $(RASTERLIB) $(GISLIB) $(MATHLIB)
  161. DBMIBASEDEPS = $(GISLIB)
  162. DBMICLIENTDEPS = $(DBMIBASELIB) $(GISLIB)
  163. DBMIDRIVERDEPS = $(DBMIBASELIB) $(DBSTUBSLIB) $(GISLIB)
  164. DBSTUBSDEPS = $(DBMIBASELIB) $(GISLIB)
  165. DIG2DEPS = $(GISLIB) $(RTREELIB) $(MATHLIB)
  166. DISPLAYDEPS = $(HTMLDRIVERLIB) $(PNGDRIVERLIB) $(PSDRIVERLIB) $(DRIVERLIB) $(RASTERLIB) $(GISLIB) $(MATHLIB)
  167. DRIVERDEPS = $(GISLIB) $(FTLIB) $(ICONVLIB) $(MATHLIB)
  168. DSPFDEPS = $(GISLIB)
  169. FORMDEPS = $(DBMILIB) $(GISLIB)
  170. RASTER3DDEPS = $(RASTERLIB) $(GISLIB)
  171. GISDEPS = $(DATETIMELIB) $(ZLIBLIBPATH) $(ZLIB) $(BZIP2LIBPATH) $(BZIP2LIB) $(ZSTDLIBPATH) $(ZSTDLIB) $(INTLLIB) $(REGEXLIBPATH) $(REGEXLIB) $(ICONVLIB) $(PTHREADLIBPATH) $(PTHREADLIB) $(MATHLIB)
  172. GMATHDEPS = $(GISLIB) $(FFTWLIB) $(LAPACKLIB) $(BLASLIB) $(CCMATHLIB) $(OMPLIBPATH) $(OMPLIB)
  173. GPDEDEPS = $(RASTER3DLIB) $(RASTERLIB) $(GISLIB) $(GMATHLIB) $(OMPLIBPATH) $(OMPLIB) $(MATHLIB)
  174. GPROJDEPS = $(GISLIB) $(GDALLIBS) $(PROJLIB) $(MATHLIB)
  175. HTMLDRIVERDEPS = $(DRIVERLIB) $(GISLIB) $(MATHLIB)
  176. IMAGERYDEPS = $(GISLIB) $(MATHLIB) $(RASTERLIB) $(VECTORLIB)
  177. INTERPFLDEPS = $(BITMAPLIB) $(DBMILIB) $(GMATHLIB) $(INTERPDATALIB) $(QTREELIB) $(VECTORLIB) $(RASTERLIB) $(GISLIB) $(MATHLIB)
  178. #IORTHODEPS = $(IMAGERYLIB) $(GISLIB)
  179. IOSTREAMDEPS = $(GISLIB)
  180. LIDARDEPS = $(VECTORLIB) $(DBMILIB) $(GMATHLIB) $(RASTERLIB) $(SEGMENTLIB) $(GISLIB) $(MATHLIB)
  181. LRSDEPS = $(DBMILIB) $(GISLIB)
  182. MANAGEDEPS = $(VECTORLIB) $(GISLIB)
  183. NVIZDEPS = $(OGSFLIB) $(GISLIB) $(OPENGLLIB)
  184. OGSFDEPS = $(BITMAPLIB) $(RASTER3DLIB) $(VECTORLIB) $(DBMILIB) $(RASTERLIB) $(GISLIB) $(TIFFLIBPATH) $(TIFFLIB) $(OPENGLLIB) $(OPENGLULIB) $(MATHLIB)
  185. PNGDRIVERDEPS = $(DRIVERLIB) $(GISLIB) $(PNGLIB) $(MATHLIB)
  186. PSDRIVERDEPS = $(DRIVERLIB) $(GISLIB) $(MATHLIB)
  187. RASTERDEPS = $(GISLIB) $(GPROJLIB) $(MATHLIB)
  188. RLIDEPS = $(RASTERLIB) $(GISLIB) $(MATHLIB)
  189. ROWIODEPS = $(GISLIB)
  190. RTREEDEPS = $(GISLIB) $(MATHLIB)
  191. SEGMENTDEPS = $(GISLIB)
  192. SIMDEPS = $(VECTORLIB) $(RASTERLIB)
  193. SITESDEPS = $(VECTORLIB) $(DBMILIB) $(GISLIB) $(DATETIMELIB)
  194. STATSDEPS = $(RASTERLIB) $(GISLIB) $(MATHLIB)
  195. SYMBDEPS = $(GISLIB) $(MATHLIB)
  196. TEMPORALDEPS = $(DBMILIB) $(GISLIB) $(DATETIMELIB)
  197. VECTORDEPS = $(DBMILIB) $(GRAPHLIB) $(DIG2LIB) $(LINKMLIB) $(RTREELIB) $(GISLIB) $(GEOSLIBS) $(GDALLIBS) $(MATHLIB) $(BTREE2LIB) $(GPROJLIB) $(RASTERLIB) $(PQLIBPATH) $(PQLIB)
  198. VEDITDEPS = $(VECTORLIB) $(DBMILIB) $(GISLIB) $(MATHLIB)
  199. NETADEPS = $(VECTORLIB) $(DBMILIB) $(GISLIB)
  200. ifneq ($(USE_X11),)
  201. CAIRODRIVERDEPS += $(XLIBPATH) $(XLIB) $(XEXTRALIBS)
  202. endif
  203. ifneq ($(USE_CAIRO),)
  204. DISPLAYDEPS += $(CAIRODRIVERLIB)
  205. endif
  206. ifneq ($(GDAL_LINK),)
  207. ifneq ($(GDAL_DYNAMIC),)
  208. ifneq ($(MINGW),)
  209. RASTERDEPS += -lkernel32
  210. else
  211. RASTERDEPS += $(DLLIB)
  212. endif
  213. else
  214. RASTERDEPS += $(GDALLIBS)
  215. endif
  216. endif
  217. ifeq ($(OPENGL_WINDOWS),1)
  218. NVIZDEPS += -lgdi32
  219. OGSFDEPS += -lgdi32
  220. endif
  221. ifneq ($(OPENGL_X11),)
  222. NVIZDEPS += $(XLIBPATH) $(XLIB) $(XEXTRALIBS)
  223. endif
  224. ifeq ($(GRASS_LIBRARY_TYPE),stlib)
  225. NEED_DEPS = 1
  226. LIB_PREFIX = $(STLIB_PREFIX)
  227. LIB_SUFFIX = $(STLIB_SUFFIX)
  228. else
  229. LIB_PREFIX = $(SHLIB_PREFIX)
  230. LIB_SUFFIX = $(SHLIB_SUFFIX)
  231. endif
  232. define lib_rules
  233. $(1)_LIBNAME = grass_$(2).$(GRASS_LIB_VERSION_NUMBER)
  234. ifneq ($(NEED_DEPS),)
  235. $(1)LIB = -l$$($(1)_LIBNAME) $$($(1)DEPS)
  236. else
  237. $(1)LIB = -l$$($(1)_LIBNAME)
  238. endif
  239. ifneq ($(1),IOSTREAM)
  240. $(1)DEP = $$(BASE_LIBDIR)/$$(LIB_PREFIX)$$($(1)_LIBNAME)$$(LIB_SUFFIX)
  241. else
  242. $(1)DEP = $$(BASE_LIBDIR)/$$(STLIB_PREFIX)$$($(1)_LIBNAME)$$(STLIB_SUFFIX)
  243. endif
  244. endef
  245. $(foreach lib,$(libs),$(eval $(call lib_rules,$(firstword $(subst :, ,$(lib))),$(lastword $(subst :, ,$(lib))))))
  246. ifneq ($(MINGW),)
  247. GISLIB += $(INTLLIB)
  248. endif
  249. DBMILIB = $(DBMICLIENTLIB) $(DBMIBASELIB) $(DBMIEXTRALIB)
  250. GEOMLIB = $(OPTRILIB) $(SOSLIB) $(LIALIB) $(BASICLIB)
  251. DBMIDEPS = $(DBMICLIENTDEPS) $(DBMIBASEDEPS)
  252. GEOMDEPS = $(OPTRIDEPS) $(SOSDEPS) $(LIADEPS) $(BASICDEPS)