MCU:=24FJ256DA206 IDIR=. ODIR=build CC:=xc16-gcc CFLAGS:=\ -Wall\ -I$(IDIR)\ -mcpu=$(MCU)\ -msmart-io=1\ -Wl,--script=p$(MCU).gld\ -Wl,--gc-sections\ -Wl,--stack=16\ -Wl,--heap=16384\ -Wl,--local-stack\ -Wl,--check-sections\ -Wl,--data-init\ -Wl,--pack-data\ -Wl,--handles\ -Wl,--isr\ -Wl,--no-gc-sections\ -Wl,--fill-upper=0\ -Wl,--stackguard=16\ -Wl,--no-force-link\ -Wl,--smart-io BIN2HEX:=xc16-bin2hex _HEX:=main.hex HEX:=$(patsubst %,$(ODIR)/%,$(_HEX)) _DEPS:=\ init.h\ t6963c_specific.h\ t6963c/t6963c.h\ t6963c/terminal.h\ fuspel/interpreter/code.h\ fuspel/interpreter/eval.h\ fuspel/interpreter/lex.h\ fuspel/interpreter/log.h\ fuspel/interpreter/mem.h\ fuspel/interpreter/parse.h\ fuspel/interpreter/print.h\ fuspel/interpreter/syntax.h DEPS:=$(patsubst %,$(IDIR)/%,$(_DEPS)) _OBJ:=main.o $(subst .h,.o,$(_DEPS)) OBJ:=$(patsubst %,$(ODIR)/%,$(_OBJ)) _ASM:=$(subst .o,.s,$(_OBJ)) ASM:=$(patsubst %,$(ODIR)/%,$(_ASM)) .PHONY: all all_hex all_assembly clean all: all_hex all_hex: $(HEX) all_assembly: $(ASM) $(ODIR)/%.hex: $(ODIR)/%.out $(BIN2HEX) $< $(ODIR)/%.out: $(OBJ) $(CC) -o $@ $^ $(CFLAGS)\ -Wl,-Map -Wl,$(ODIR)/$(notdir $(basename $@)).map $(ODIR)/%.o: %.c $(DEPS) mkdir -p $(dir $@) $(CC) -c -o $@ $< $(CFLAGS) $(ODIR)/%.s: %.c mkdir -p $(dir $@) $(CC) -S -o $@ $< $(CFLAGS) clean: $(RM) -r $(ODIR)