HydroVish.inc
# Define a gmake function to encode paths in URL format
space=${} # defining a space
encode=$(subst $(space),+,$(subst :,%3A,$(subst \,%2F,$(subst /,%2F,$(1)))))
# Specify path to HydroVish.exe here.
HydroVish.exe=C:/Users/$(USERNAME)/AirborneHydroMapping/HydroVish/bin/win64/HydroVish.exe
HydroVish=QUERY_STRING="$(call encode,$1&Action=Process)" $(HydroVish.exe)
# Use this output folder to determine the directory from the make target $@
OutputFolder=$(abspath $(dir $@))
# Defining a make function to convert SDC files to F5
# Parameters:
# $1 .... gridname
SDCtoF5=$(call HydroVish,InputFiles=$<&Nutrition::gridname=$1&Output Folder=$(OutputFolder)&Nutrition=SDC to F5)
# Parameters:
# $1...coordinate system
$(warning TODO: Support the remaining parameters)
#
ScannerToWorldCoordinates=$(call HydroVish,InputFiles=$<&Nutrition::coordinate system of trajectory=$1&Output Folder=$(OutputFolder)&Nutrition=Scanner Coordinates to World Coordinates)
export REQUEST_METHOD=GET
HydroVish.rules
# Pattern Rules to convert each SDC file, setting the QUERY_STRING environment variable as part of the rule
%.f5: $(InputDir)/%.sdc | $(HydroVish.exe)
$(call SDCtoF5,$(gridname))
%.f5.world: %.f5
$(call ScannerToWorldCoordinates,$(CoordinateSystem))
@touch $@
clean:
$(RM) *.f5 *.world
define NoHydroVishInstalled.message
*** ERROR ***
HydroVish was not installed in its default path $(HydroVish.exe) .
Please re-install HydroVish using the default settings or edit HydroVish.inc .
Alternatively, you may also specify the path on the makefile command line, for instance:
$(MAKE) -j HydroVish.exe=$HOME/vish/bin/arch-x86_64-w64-mingw32-Optimize/HydroVish.exe
endef
$(HydroVish.exe):
$(error $(NoHydroVishInstalled.message))
Makefile
InputDir=C:/Users/$(USER)/AirborneHydroMapping/HydroVish/data/SampleData/FWF
gridname=TestData
CoordinateSystem=UTM North
#
# Generate the list of output files from all SDC files in the input directory.
# The only parameter to specify is the InputDir and the (optional) gridname
#
FilesConvertedFromSDC=$(subst .sdc,.f5,$(notdir $(wildcard $(InputDir)/*.sdc)))
FilesInWorldCoordinates=$(subst .f5,.f5.world,$(FilesConvertedFromSDC))
Result: $(FilesInWorldCoordinates)
#
# https://www.thinkplexx.com/learn/howto/build-chain/make-based/prevent-gnu-make-from-always-removing-files-it-says-things-like-rm-or-removing-intermediate-files
#
.SECONDARY: $(FilesConvertedFromSDC)
#
# Placing function definitions in its own include file
#
include HydroVish.inc
#
# Also placing rules in its own include file,
# all of those rules are project-independent
#
include HydroVish.rules