#!/usr/bin/make -f # INCLUDE CONFIGURATION include $(CURDIR)/Makefile.config # DEDUCED VARS ALLOBJ = $(patsubst %,$(OBJDIR)/%.o,$(SRC) $(IMG) $(FONT)) ALLINC = $(INC:%=$(INCDIR)/%) # RULES ## Make it all (default rule) all: $(NAME).g1a ## Make the object directory $(OBJDIR): mkdir -p $(OBJDIR) ## Compile sprites $(OBJDIR)/%.bmp.o: $(IMGDIR)/%.bmp fxconv -image $< -o $@ -n $(basename $(notdir $<)) ## Compile fonts $(OBJDIR)/%.bmp.o: $(FONTDIR)/%.bmp fxconv -font $< -o $@ -n $(basename $(notdir $<)) ## Make an object file out of an ASM source file $(OBJDIR)/%.s.o: $(SRCDIR)/%.s $(AS) -c -o $@ $< ## Make an object file out of a C source file $(OBJDIR)/%.c.o: $(SRCDIR)/%.c $(ALLINC) $(CC) -c -o $@ $< $(CFLAGS) ## Make the ELF file $(NAME).elf: $(OBJDIR) $(ALLOBJ) $(LD) -o $@ $(ALLOBJ) $(LFLAGS) ## Make the BIN file $(NAME).bin: $(NAME).elf $(OBJCPY) -R .comment -R .bss -R '$$iop' -O binary $< $@ ## Make the G1A file $(NAME).g1a: $(NAME).bin $(WRAPR) $< -o $(NAME).g1a -i $(ICON) @stat -c "Build finished -- output size is %s bytes." $(NAME).g1a ## Clean up your mess clean: $(RM) $(OBJDIR) $(RM) $(NAME).elf $(RM) $(NAME).bin ## Clean up everything fclean: clean $(RM) $(NAME).g1a $(RM) $(NAME).txt dump: $(OBJDUMP) -d $(NAME).elf > $(NAME).txt @stat -c "Dump file -- dump file put in %n ." $(NAME).txt ## Remake re: fclean all ## Send to calc send: $(SENDR) send $(NAME).g1a -f ## Phuneral phuture ? .PHONY: all clean fclean dump re send # END OF FILE