diff options
Diffstat (limited to 'src/build/mkrules/beam.rules.mk')
-rw-r--r-- | src/build/mkrules/beam.rules.mk | 63 |
1 files changed, 52 insertions, 11 deletions
diff --git a/src/build/mkrules/beam.rules.mk b/src/build/mkrules/beam.rules.mk index d77cd94ef..8525d4d9c 100644 --- a/src/build/mkrules/beam.rules.mk +++ b/src/build/mkrules/beam.rules.mk @@ -24,33 +24,74 @@ # File: beam.rules.mk # Description: # Rules for running BEAM on C/C++/ASM files. +## +## NOTE, export BUILD_VERBOSE=1 to expose the BEAM invocation for debug. +## (export -n BUILD_VERBOSE to turn it back off) +## +## collect "real" BEAM errors into the *.beam files +## push parser errors to the *.parser files +## push stats (for debug) to *.stats files. + +BEAMOBJS = $(addprefix $(BEAMDIR)/, $(OBJS:.o=.beam)) $(BEAMDIR)/%.beam : %.C $(C2) " BEAM $(notdir $<)" - $(C1)$(BEAMCMD) $(INCFLAGS) $(CXXFLAGS) $(BEAMFLAGS) $< \ - --beam::complaint_file=$@ --beam::parser_file=/dev/null + @rm -f $@ $@.parser $@.stats + $(C1)$(BEAMCMD) $(INCFLAGS) -I . $(CXXFLAGS) $(BEAMFLAGS) \ + --beam::complaint_file=$@ \ + --beam::parser_file=$@.parser \ + --beam::stats_file=$@.stats \ + $< $(BEAMDIR)/%.beam : %.cc $(C2) " BEAM $(notdir $<)" - $(C1)$(BEAMCMD) $(INCFLAGS) $(CXXFLAGS) $(BEAMFLAGS) $< \ - --beam::complaint_file=$@ --beam::parser_file=/dev/null + @rm -f $@ $@.parser $@.stats + $(C1)$(BEAMCMD) $(INCFLAGS) -I . $(CXXFLAGS) $(BEAMFLAGS) \ + --beam::complaint_file=$@ \ + --beam::parser_file=$@.parser \ + --beam::stats_file=$@.stats \ + $< $(BEAMDIR)/%.beam : %.c $(C2) " BEAM $(notdir $<)" - $(C1)$(BEAMCMD) $(INCFLAGS) $(CXXFLAGS) $(BEAMFLAGS) $< \ - --beam::complaint_file=$@ --beam::parser_file=/dev/null + @rm -f $@ $@.parser $@.stats + $(C1)$(BEAMCMD) $(INCFLAGS) -I . $(CFLAGS) $(BEAMFLAGS) \ + --beam::complaint_file=$@ \ + --beam::parser_file=$@.parser \ + --beam::stats_file=$@.stats \ + $< $(BEAMDIR)/%.beam : %.S @echo Skipping ASM file: $< - -BEAMOBJS = $(addprefix $(BEAMDIR)/, $(OBJS:.o=.beam)) - beam: BEAM_PASS +## Run beam_configure for the C++ and C compilers. +## This outputs the config files to ./obj/beam, you have to copy them +## to the correct location. +## This only needs to be done when something in the build environment changes. +## See https://w3.eda.ibm.com/beam/beam_configure.html for documentation. +beamgen: + $(BEAMPATH)/bin/beam_configure $(firstword $(CXX_RAW)) \ + --cpp \ + --force \ + -o $(ROOTPATH)/src/build/beam/compiler_cpp_config.tcl \ + --compile_flag="$(wordlist 2, $(words $(CXX_RAW)), $(CXX_RAW)) $(CXXFLAGS)"\ + --verbose + $(BEAMPATH)/bin/beam_configure $(firstword $(CC_RAW)) \ + --c \ + --force \ + -o $(ROOTPATH)/src/build/beam/compiler_c_config.tcl \ + --compile_flag="$(wordlist 2, $(words $(CC_RAW)), $(CC_RAW)) $(CFLAGS)" \ + --verbose + .PHONY: make_beamdir make_beamdir: @mkdir -p $(BEAMDIR) -BEAM_PASS_PRE += make_beamdir -BEAM_PASS_BODY += $(BEAMOBJS) + +BEAM_PASS_PRE += make_beamdir +BEAM_PASS_BODY += $(BEAMOBJS) + +CLEAN_TARGETS += $(BEAMOBJS) $(BEAMOBJS:.beam=.beam.parser) \ + $(BEAMOBJS:.beam=.beam.stats) |