You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Makefile 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/make -f
  2. # INCLUDE CONFIGURATION
  3. include $(CURDIR)/Makefile.config
  4. # DEDUCED VARS
  5. ALLOBJ = $(patsubst %,$(OBJDIR)/%.o,$(SRC) $(IMG) $(FONT))
  6. ALLINC = $(INC:%=$(INCDIR)/%)
  7. # RULES
  8. ## Make it all (default rule)
  9. all: $(NAME).g1a
  10. ## Make the object directory
  11. $(OBJDIR):
  12. mkdir -p $(OBJDIR)
  13. ## Compile sprites
  14. $(OBJDIR)/%.bmp.o: $(IMGDIR)/%.bmp
  15. fxconv -image $< -o $@ -n $(basename $(notdir $<))
  16. ## Compile fonts
  17. $(OBJDIR)/%.bmp.o: $(FONTDIR)/%.bmp
  18. fxconv -font $< -o $@ -n $(basename $(notdir $<))
  19. ## Make an object file out of an ASM source file
  20. $(OBJDIR)/%.s.o: $(SRCDIR)/%.s
  21. $(AS) -c -o $@ $<
  22. ## Make an object file out of a C source file
  23. $(OBJDIR)/%.c.o: $(SRCDIR)/%.c $(ALLINC)
  24. $(CC) -c -o $@ $< $(CFLAGS)
  25. ## Make the ELF file
  26. $(NAME).elf: $(OBJDIR) $(ALLOBJ)
  27. $(LD) -o $@ $(ALLOBJ) $(LFLAGS)
  28. ## Make the BIN file
  29. $(NAME).bin: $(NAME).elf
  30. $(OBJCPY) -R .comment -R .bss -R '$$iop' -O binary $< $@
  31. ## Make the G1A file
  32. $(NAME).g1a: $(NAME).bin
  33. $(WRAPR) $< -o $(NAME).g1a -i $(ICON)
  34. @stat -c "Build finished -- output size is %s bytes." $(NAME).g1a
  35. ## Clean up your mess
  36. clean:
  37. $(RM) $(OBJDIR)
  38. $(RM) $(NAME).elf
  39. $(RM) $(NAME).bin
  40. ## Clean up everything
  41. fclean: clean
  42. $(RM) $(NAME).g1a
  43. $(RM) $(NAME).txt
  44. dump:
  45. $(OBJDUMP) -d $(NAME).elf > $(NAME).txt
  46. @stat -c "Dump file -- dump file put in %n ." $(NAME).txt
  47. ## Remake
  48. re: fclean all
  49. ## Send to calc
  50. send:
  51. $(SENDR) send $(NAME).g1a -f
  52. ## Phuneral phuture ?
  53. .PHONY: all clean fclean dump re send
  54. # END OF FILE