HydroVish.inc
# Define a gmake function to encode paths in URL format
#
space=${} # defining a space
encode=$(subst $(space),+,$(subst :,%3A,$(subst /,%2F,$(1))))
HydroVish=QUERY_STRING="$(call encode,$1&Action=Process)" ../../../bin/win64/HydroVish.exe
# Defining a make function to convert SDC files to F5
# Parameters:
# $1 .... gridname
SDCtoF5=$(call HydroVish,InputFiles=$<&Nutrition::gridname=$(gridname)&Output Folder=$(abspath $(dir $@))&Nutrition=SDC to F5)
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
$(call SDCtoF5,$(gridname))
clean:
$(RM) *.f5
Makefile
InputDir=C:/Users/$(USERNAME)/AirborneHydroMapping/HydroVish/data/SampleData/FWF
gridname=TestData
# 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
ResultFiles=$(subst .sdc,.f5,$(notdir $(wildcard $(InputDir)/*.sdc)))
Result: $(ResultFiles)
# 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