#!/usr/bin/make -f # INCLUDE CONFIGURATION include $(CURDIR)/Makefile.cfg # DEDUCED VARS ALLOBJ = $(SRC:%=$(OBJDIR)/%.o) ALLINC = $(INC:%=$(INCDIR)/%.h) # RULES ## Make it all (default rule) all: $(NAME).g1a ## Make the object directory $(OBJDIR): mkdir -p $(OBJDIR) ## Make an object file out of an ASM source file $(OBJDIR)/%.o: $(SRCDIR)/%.s $(AS) -c -o $@ $< ## Make an object file out of a C source file $(OBJDIR)/%.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 @stat -c "Build finished -- output size is %s bytes." $(NAME).g1a ## Clean up your mess clean: $(RM) $(ALLOBJ) $(RM) $(NAME).elf $(RM) $(NAME).bin ## Clean up everything mrproper: clean $(RM) $(NAME).g1a fclean: mrproper ## Remake re: fclean all ## Send to calc send: @if [ ! -f $(NAME).g1a ]; then \ echo "Please make before sending."; \ else $(SENDR) SEND $(NAME).g1a $(NAME).g1a fls0; \ fi ## Phuneral phuture ? .PHONY: all clean fclean mrproper re send # END OF FILE