forked from OSGeo/gdal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile.vc
277 lines (237 loc) · 6.93 KB
/
makefile.vc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
GDAL_ROOT = .
!INCLUDE nmake.opt
!IF !DEFINED(PROJ_INCLUDE)
!ERROR PROJ_INCLUDE should be defined. PROJ >= 6 is a required dependency
!ENDIF
##############################################################################
# The following determines whether we are linking all the OGR formats
# into the DLL, or only the minimum spatial reference related stuff required
# for a raster-gdal build.
#OGR_BASE_INCLUDE = /INCLUDE:_OCTNewCoordinateTransformation@8 \
# /INCLUDE:_OSRValidate@4 \
# /INCLUDE:_OGR_G_GetPointCount@4
OGR_BASE_INCLUDE = /INCLUDE:$(SYM_PREFIX)OSRValidate \
/INCLUDE:$(SYM_PREFIX)OGR_G_GetPointCount
OGR_OBJ = ogr\ogrsf_frmts\ogrsf_frmts.lib ogr\ogr.lib
OGR_INCLUDE = $(OGR_BASE_INCLUDE) \
/INCLUDE:$(SYM_PREFIX)OGRRegisterAll
!IFDEF INCLUDE_GNM_FRMTS
CPPFLAGS = $(CPPFLAGS) -DGNM_ENABLED
!ENDIF
!IF DEFINED(STDCALL) && !DEFINED(WIN64)
BASE_INCLUDE = /INCLUDE:_GDALSimpleImageWarp@36 \
/INCLUDE:_GDALReprojectImage@48 \
/INCLUDE:_GDALComputeMedianCutPCT@32 \
/INCLUDE:_GDALDitherRGB2PCT@28 \
/INCLUDE:_OCTNewCoordinateTransformation@8
!ELSE
BASE_INCLUDE = /INCLUDE:$(SYM_PREFIX)GDALSimpleImageWarp \
/INCLUDE:$(SYM_PREFIX)GDALReprojectImage \
/INCLUDE:$(SYM_PREFIX)GDALComputeMedianCutPCT \
/INCLUDE:$(SYM_PREFIX)GDALDitherRGB2PCT \
/INCLUDE:$(SYM_PREFIX)OCTNewCoordinateTransformation
!ENDIF
APPS_OBJ = apps\commonutils.obj apps\gdalinfo_lib.obj apps\gdal_translate_lib.obj apps\gdalwarp_lib.obj apps\ogr2ogr_lib.obj \
apps\gdaldem_lib.obj apps\nearblack_lib.obj apps\gdal_grid_lib.obj apps\gdal_rasterize_lib.obj apps\gdalbuildvrt_lib.obj \
apps\gdalmdiminfo_lib.obj apps\gdalmdimtranslate_lib.obj
LIBOBJ = port\*.obj gcore\*.obj alg\*.obj frmts\o\*.obj $(OGR_OBJ) gnm\*.obj gnm\gnm_frmts\o\*.obj third_party\o\*.obj $(APPS_OBJ)
LIB_DEPENDS = port_dir core_dir ogr_dir gnm_dir third_party_dir frmts_dir appslib-target
DISTDIR = gdal_$(VERSION)
!IF "$(DLLBUILD)" == "1"
TARGET_LIB = dll
PLUGIN_TARGET = plugin_dir
!ELSE
TARGET_LIB = staticlib
!ENDIF
DEFAULT_TARGETS =
default: $(TARGET_LIB) $(PLUGIN_TARGET) apps_dir
@echo;Starting with GDAL 3.5, the nmake build system is deprecated in favor of the CMake build system. The nmake build system will be completely removed in GDAL 3.6
# Batch commands to clean main build output are stored in a macro so they can be reused by different
# targets in an inline temporary batch file.
#
# We want them to run before creating a DLL or static LIB file, but if they were in a target then
# that target would have to be a dependency of dll or staticlib and would always have to run, making
# the dependent targets "out-of-date".
#
# We don't want to re-link the whole DLL just because we tried to delete a static LIB that didn't
# exist. We also don't want to install a stale DLL in a static build, so we'll remove main build
# output before creating main build output, but not as a target dependency.
CLEAN_MAIN_BUILD_OUTPUT_CMDS = \
@SETLOCAL EnableExtensions^
if exist $(GDAL_LIB_NAME) del $(GDAL_LIB_NAME)^
if exist $(GDAL_DLL) del $(GDAL_DLL)^
if exist $(GDAL_DLL).manifest del $(GDAL_DLL).manifest^
if exist *.ilk del *.ilk
staticlib: $(LIB_DEPENDS)
call <<clean_main_build_output.bat
$(CLEAN_MAIN_BUILD_OUTPUT_CMDS)
<<
lib /nologo /out:$(GDAL_LIB_NAME) $(LIBOBJ) $(EXTERNAL_LIBS)
appslib-target:
cd apps
$(MAKE) /f makefile.vc appslib
cd ..
clean:
call <<clean_main_build_output.bat
$(CLEAN_MAIN_BUILD_OUTPUT_CMDS)
<<
if exist $(GDAL_PDB) del $(GDAL_PDB)
cd port
$(MAKE) /f makefile.vc clean
cd ..
cd gcore
$(MAKE) /f makefile.vc clean
cd ..
cd alg
$(MAKE) /f makefile.vc clean
cd ..
cd frmts
$(MAKE) /f makefile.vc clean
cd ..
cd ogr
$(MAKE) /f makefile.vc allclean
cd ..
cd third_party
$(MAKE) /f makefile.vc clean
cd ..
cd gnm
$(MAKE) /f makefile.vc allclean
cd ..
cd apps
$(MAKE) /f makefile.vc clean
cd ..
cd swig
$(MAKE) /f makefile.vc clean
cd ..
generate_gdal_version_h:
cd gcore
$(MAKE) /f makefile.vc gdal_version.h
cd ..
port_dir:
@echo;Starting with GDAL 3.5, the nmake build system is deprecated in favor of the CMake build system. The nmake build system will be completely removed in GDAL 3.6
cd port
$(MAKE) /f makefile.vc
cd ..
ogr_min:
cd ogr
$(MAKE) /f makefile.vc ogr.lib
cd ..
core_dir: port_dir generate_gdal_version_h
cd gcore
$(MAKE) /f makefile.vc
cd ..\alg
$(MAKE) /f makefile.vc
cd ..
frmts_dir: generate_gdal_version_h
cd frmts
$(MAKE) /f makefile.vc
cd ..
plugin_dir: dll
cd frmts
$(MAKE) /f makefile.vc plugindirs
cd ..
!IFDEF INCLUDE_OGR_FRMTS
cd ogr\ogrsf_frmts
$(MAKE) /f makefile.vc plugindirs
cd ..\..
!ENDIF
apps_dir: $(TARGET_LIB)
cd apps
$(MAKE) /f makefile.vc
cd ..
ogr_dir: port_dir generate_gdal_version_h
cd frmts/iso8211
$(MAKE) /f makefile.vc
cd ..\sdts
$(MAKE) /f makefile.vc
cd ..\..\ogr
$(MAKE) /f makefile.vc ogr.lib frmts
cd ..
gnm_dir: ogr_dir
cd gnm
$(MAKE) /f makefile.vc gnm.lib frmts
cd ..
third_party_dir: port_dir
cd third_party
$(MAKE) /f makefile.vc
cd ..
lib_dist: default
if not exist $(DISTDIR) mkdir $(DISTDIR)
copy .\port\*.h .\$(DISTDIR)
copy .\gcore\*.h .\$(DISTDIR)
copy .\ogr\*.h .\$(DISTDIR)
copy $(GDAL_LIB_NAME) .\$(DISTDIR)
copy $(GDAL_DLL) .\$(DISTDIR)
copy $(GDAL_PDB) .\$(DISTDIR)
$(GDAL_DLL): $(LIB_DEPENDS)
call <<clean_main_build_output.bat
$(CLEAN_MAIN_BUILD_OUTPUT_CMDS)
<<
link /nologo /dll $(OGR_INCLUDE) $(BASE_INCLUDE) $(LIBOBJ) \
$(EXTERNAL_LIBS) gcore\Version.res \
/out:$(GDAL_DLL) /implib:$(GDAL_LIB_NAME) $(LINKER_FLAGS)
if exist $(GDAL_DLL).manifest mt -manifest $(GDAL_DLL).manifest -outputresource:$(GDAL_DLL);2
dll: $(GDAL_DLL)
# build using cygwin
docs:
!IFDEF HTMLDIR
make PYTHONHOME= -C doc html
!ENDIF
bindings:
-for %d in ( $(BINDINGS) ) do \
cd swig \
&& $(MAKE) /f makefile.vc %d \
&& cd .. \
|| exit 1
bindings_install:
-for %d in ( $(BINDINGS) ) do \
cd swig \
&& $(MAKE) /f makefile.vc %d_install \
&& cd .. \
|| exit 1
bindings_clean:
cd swig \
&& $(MAKE) /f makefile.vc clean \
&& cd .. \
|| exit 1
install: default docs
-mkdir $(BINDIR)
-mkdir $(DATADIR)
if exist $(GDAL_DLL) $(INSTALL) $(GDAL_DLL) $(BINDIR)
cd frmts
$(MAKE) /f makefile.vc plugins-install
cd ..\apps
$(MAKE) /f makefile.vc install
cd ..
$(INSTALL) data\*.* $(DATADIR)
$(INSTALL) LICENSE.TXT $(DATADIR)
!IFDEF HTMLDIR
-mkdir $(HTMLDIR)
xcopy /S /Y doc\build\html $(HTMLDIR)
!ENDIF
!IFDEF INCLUDE_OGR_FRMTS
cd ogr\ogrsf_frmts
$(MAKE) /f makefile.vc plugins-install
cd ..\..
!ENDIF
libinstall: $(GDALLIB)
-mkdir $(LIBDIR)
copy %|feF $(LIBDIR)
if exist $(GDAL_PDB) copy $(GDAL_PDB) $(LIBDIR)
devinstall: install libinstall
-mkdir $(INCDIR)
copy port\*.h $(INCDIR)
copy gcore\*.h $(INCDIR)
copy alg\*.h $(INCDIR)
copy ogr\*.h $(INCDIR)
copy frmts\mem\memdataset.h $(INCDIR)
copy frmts\vrt\*.h $(INCDIR)
!IFDEF INCLUDE_OGR_FRMTS
copy ogr\ogrsf_frmts\*.h $(INCDIR)
!ENDIF
!IFDEF INCLUDE_GNM_FRMTS
copy gnm\gnm.h $(INCDIR)
copy gnm\gnm_api.h $(INCDIR)
copy gnm\gnmgraph.h $(INCDIR)
!ENDIF
copy apps\gdal_utils.h $(INCDIR)