makefile - chunhualiao/public-docs GitHub Wiki
conditional on rose-compiler's status
run a ROSE-based translator only if rose-compiler works first.
TIMEOUT=300s
$(OUTPUT_DIR)/rose_%.C: $(INPUT_DIR)/%.C $(TRANSLATOR)
mkdir -p $(dir $@)
ERR_LOG1=$(OUTPUT_DIR)/rose_$(notdir $<).err1; \
ERR_LOG2=$(OUTPUT_DIR)/rose_$(notdir $<).err2; \
timeout $(TIMEOUT) rose-compiler -c -I$(dir $(realpath $<)) -I$(ROSE_HOME)/include $< -rose:output $@ 2> $$ERR_LOG1 || \
{ echo "Compilation with rose-compiler failed for $<, see $$ERR_LOG"; touch $@; exit 0; } \
&& timeout $(TIMEOUT) ./$(TRANSLATOR) -c -I$(dir $(realpath $<)) -I$(ROSE_HOME)/include $< -rose:output $@ 2> $$ERR_LOG2 || \
{ echo "Translator failed for $<, see $$ERR_LOG"; exit 1; }