Open FreddieAkeroyd opened 1 month ago
Have converted to draft as though it works on windows it doesn't on linux. The problem is that '
does not work on windows but using "
means the perl variables $
get interpreted by the linux shell. Tried adding \
which makes it work on linux but then stops working on windows. Could get round this by putting the perl code in a separate file rather than using -e
but maybe there is some cleverer quoting that can be done
It might be possible to do something like
ifeq ($(strip $(OS_CLASS)),WIN32)
QUOTE="
else
QUOTE='
endif
$(COMMON_DIR)/siteEnvVars.substitutions: $(EPICS_BASE)/configure/CONFIG_SITE_ENV
@echo Expanding siteEnvVars.substitutions from CONFIG_SITE_ENV....
@echo file iocEnvVar.template> $@
@echo {>> $@
@echo pattern>> $@
@echo { ENVNAME, ENVVAR, ENVTYPE }>> $@
@perl -n -e $(QUOTE)$$m = s/^EPICS_([A-Z_]*).*/{$${1}, EPICS_$${1}, epics}/; print $$_ if $$m;$(QUOTE) < $< >> $@
@echo }>> $@
though I am not sure this is much better... 😄
Well it makes it clear what we are trying to do at least, I am happy to go with that if you are - thanks
Unless you think putting the s/
command into a separate file for perl to execute from Make is cleaner
Surely it would be simpler to use a stand-alone Perl script to do the whole job of generating the siteEnvVars.substitutions
file? There'd be no need to mess around with the $(QUOTE)
variable, and the Perl code would also be easier to read and modify. That might even fix the Base-3.14 build failure, but I haven't looked at that properly to be sure.
Oh no more perl scripts
😄
Anyhow, I think you are correct in this case that a standalone script is easier; this is a pretty simple parsing, but the solution is better.
Windows does not have
sed
so change to useperl
that is already needed for building EPICSSee epics-modules/iocStats#62