Skip to content

Instantly share code, notes, and snippets.

@fd0
Created January 19, 2014 14:17
Show Gist options
  • Save fd0/8505585 to your computer and use it in GitHub Desktop.
Save fd0/8505585 to your computer and use it in GitHub Desktop.
TARGETS=$(patsubst %.S,%,$(wildcard *.S))
TARGETS_BIN=$(patsubst %,%.bin,$(TARGETS))
TARGETS_LST=$(patsubst %,%.lst,$(TARGETS))
TARGETS_HEX=$(patsubst %,%.hexdump,$(TARGETS))
AS=msp430-as
OBJCOPY=msp430-objcopy
OBJDUMP=msp430-objdump
.PHONY: all clean clean-all
all: $(TARGETS) $(TARGETS_BIN) $(TARGETS_LST) $(TARGETS_HEX)
%: %.S
$(AS) -o $@ $<
%.bin: %
$(OBJCOPY) -O binary $< $@
%.lst: %
$(OBJDUMP) -D $< > $@
%.hexdump: %.bin
xxd -p -c 256 $< > $@
clean: clean-all
clean-all:
rm -f $(TARGETS) $(TARGETS_BIN) $(TARGETS_LST) $(TARGETS_HEX)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment