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.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/usr/bin/make -f
  2. # INCLUDE CONFIGURATION
  3. include $(CURDIR)/Makefile.cfg
  4. # DEDUCED VARS
  5. ALLOBJ = $(SRC:%=$(OBJDIR)/%.o)
  6. ALLINC = $(INC:%=$(INCDIR)/%.h)
  7. # RULES
  8. ## Make it all (default rule)
  9. all: $(NAME).g1a
  10. ## Make the object directory
  11. $(OBJDIR):
  12. mkdir -p $(OBJDIR)
  13. ## Make an object file out of an ASM source file
  14. $(OBJDIR)/%.o: $(SRCDIR)/%.s
  15. $(AS) -c -o $@ $<
  16. ## Make an object file out of a C source file
  17. $(OBJDIR)/%.o: $(SRCDIR)/%.c $(ALLINC)
  18. $(CC) -c -o $@ $< $(CFLAGS)
  19. ## Make the ELF file
  20. $(NAME).elf: $(OBJDIR) $(ALLOBJ)
  21. $(LD) -o $@ $(ALLOBJ) $(LFLAGS)
  22. ## Make the BIN file
  23. $(NAME).bin: $(NAME).elf
  24. $(OBJCPY) -R .comment -R .bss -R '$$iop' -O binary $< $@
  25. ## Make the G1A file
  26. $(NAME).g1a: $(NAME).bin
  27. $(WRAPR) $< -o $(NAME).g1a
  28. @stat -c "Build finished -- output size is %s bytes." $(NAME).g1a
  29. ## Clean up your mess
  30. clean:
  31. $(RM) $(ALLOBJ)
  32. $(RM) $(NAME).elf
  33. $(RM) $(NAME).bin
  34. ## Clean up everything
  35. mrproper: clean
  36. $(RM) $(NAME).g1a
  37. fclean: mrproper
  38. ## Remake
  39. re: fclean all
  40. ## Send to calc
  41. send:
  42. @if [ ! -f $(NAME).g1a ]; then \
  43. echo "Please make before sending."; \
  44. else $(SENDR) SEND $(NAME).g1a $(NAME).g1a fls0; \
  45. fi
  46. ## Phuneral phuture ?
  47. .PHONY: all clean fclean mrproper re send
  48. # END OF FILE