default: all #---------- general definitions etc. ---------- TARGETS += $(foreach i, $(PICNOS), idlocs$i.hex noncode$i.hex) MORSE_INCLUDE ?= common.inc INCLUDES += ../iwjpictest/insn-aliases.inc morse+auto.inc INCLUDES += $(addsuffix +vars.fin, $(VARSFILES)) INCLUDES += $(addsuffix +vars.inc, $(VARSFILES)) include ../common.make include ../pic.make #---------- bizarre macro arrangements for $(PROGRAMS) ---------- define define_prog TARGETS += $(1)+code.hex $(1)+program.hex $(1)+program.map $(1)+program.disasm TARGETS += $$(foreach i, $$(PICNOS), $(1)+entire$$i.hex) $(1)_CODEHEX= $$(foreach panel, $$(XCODEN_$(1)), $(1)+$$(panel).hex) \ $$(foreach panel, $$(XCODE1_$(1)), $$(panel).hex) $(1)+code.hex: $$(HEXMERGER) $(1)+program.hex $$($(1)_CODEHEX) $$(MERGEHEX) $(1)+entire%.hex: $$(HEXMERGER) $(1)+program.hex $$($(1)_CODEHEX) idlocs%.hex config.hex $$(MERGEHEX) $(1)+program.hex: $(1).o $$(OBJS_$(prog)) $$(LIBS) $$(LINK) endef define define_directasm $(1).hex: $(1).asm $$(INCLUDES) $$(ASSEMBLE) $$< endef define makesubmakefile set -e; d=.submakefile.new; rm -f $$d; for f in "$$@";do echo "$$f" >>$$d; done -- $(foreach prog, $(PROGRAMS), $(call define_prog,$(prog))) $(foreach da, idlocs% config %+morse %+pindata blank%, $(call define_directasm,$(da))) endef .submakefile: $(CEBPIC)manypics.make Makefile : $(shell $(makesubmakefile)) ... generate .submakefile @mv -f $@.new $@ ifneq ($(MAKECMDGOALS),clean) include .submakefile endif blank0.asm blank2.asm blank4.asm blank6.asm: blank%.asm: $(CEBPIC)manypics.make echo >$@.new " org 0x$*000" echo >>$@.new " nop" echo >>$@.new " end" mv -f $@.new $@ #---------- targets ---------- all: $(TARGETS) noncode%.hex: $(HEXMERGER) idlocs%.hex config.hex $(MERGEHEX) morse+auto.inc: $(CEBPIC)morse-generator morse.messages ./$^ inc $o %+vars.inc: %.asm $(CEBPIC)manypics.make perl -ne ' \ BEGIN { print "; autogenerated - do not edit\n"; } \ next unless m/^\w+\s+equ\s+/; \ print $$_ or die $$!; \ ' <$< $o %+vars.fin: %.asm $(CEBPIC)manypics.make perl -ne ' \ BEGIN { print "; autogenerated - do not edit\n"; } \ next unless m/^(\w+)\s/; \ next if m/^\w+\s+(?:equ|udata|udata_acs)\s+/; \ print " extern $$1\n" or die $$!; \ ' <$< $o %+morse.asm: $(CEBPIC)morse-generator morse.messages %+program.map ./$^ asm -I$(MORSE_INCLUDE) $o %.map: %.hex @: idlocs%.asm: $(CEBPIC)make-idlocs ../layout/ours.wiring ./$^ $* >$@.new && mv -f $@.new $@ ours+pindata.asm: ../layout/ours+pindata.asm cp $< $@ manypic-clean: pic-clean rm -f idlocs*.asm *+morse.* morse+auto.inc blank[0246].* .PRECIOUS: idlocs%.asm morse+auto.inc %+morse.asm %+morse.hex %.map .PRECIOUS: %+vars.inc %+vars.fin