2016-05-15 14:00:40 +02:00
|
|
|
|
#!/usr/bin/make -f
|
|
|
|
|
# INCLUDE CONFIGURATION
|
2017-01-07 21:07:10 +01:00
|
|
|
|
include $(CURDIR)/Makefile.config
|
2016-05-14 22:19:51 +02:00
|
|
|
|
|
2016-05-15 14:00:40 +02:00
|
|
|
|
# DEDUCED VARS
|
2017-02-24 21:08:57 +01:00
|
|
|
|
ALLOBJ = $(patsubst %,$(OBJDIR)/%.o,$(SRC))
|
|
|
|
|
ALLINC = $(INC:%=$(INCDIR)/%)
|
2016-05-14 22:19:51 +02:00
|
|
|
|
|
2016-05-15 14:00:40 +02:00
|
|
|
|
# RULES
|
|
|
|
|
## Make it all (default rule)
|
|
|
|
|
all: $(NAME).g1a
|
2016-05-14 22:19:51 +02:00
|
|
|
|
|
2016-05-15 14:00:40 +02:00
|
|
|
|
## Make the object directory
|
|
|
|
|
$(OBJDIR):
|
|
|
|
|
mkdir -p $(OBJDIR)
|
2016-05-14 22:19:51 +02:00
|
|
|
|
|
2016-05-15 14:00:40 +02:00
|
|
|
|
## Make an object file out of an ASM source file
|
2017-02-24 21:08:57 +01:00
|
|
|
|
$(OBJDIR)/%.s.o: $(SRCDIR)/%.s
|
2016-05-15 14:00:40 +02:00
|
|
|
|
$(AS) -c -o $@ $<
|
2016-05-14 22:19:51 +02:00
|
|
|
|
|
2016-05-15 14:00:40 +02:00
|
|
|
|
## Make an object file out of a C source file
|
2017-02-24 21:08:57 +01:00
|
|
|
|
$(OBJDIR)/%.c.o: $(SRCDIR)/%.c $(ALLINC)
|
|
|
|
|
$(CC) -c -o $@ $< $(CFLAGS)
|
2016-05-14 22:19:51 +02:00
|
|
|
|
|
2016-05-15 14:00:40 +02:00
|
|
|
|
## Make the ELF file
|
|
|
|
|
$(NAME).elf: $(OBJDIR) $(ALLOBJ)
|
|
|
|
|
$(LD) -o $@ $(ALLOBJ) $(LFLAGS)
|
2016-05-14 22:19:51 +02:00
|
|
|
|
|
2016-05-15 14:00:40 +02:00
|
|
|
|
## Make the BIN file
|
|
|
|
|
$(NAME).bin: $(NAME).elf
|
2017-02-24 21:08:57 +01:00
|
|
|
|
$(OBJCPY) -R .comment -R .bss -R '$$iop' -O binary $< $@
|
2016-05-14 22:19:51 +02:00
|
|
|
|
|
2016-05-15 14:00:40 +02:00
|
|
|
|
## Make the G1A file
|
|
|
|
|
$(NAME).g1a: $(NAME).bin
|
2017-02-24 21:57:01 +01:00
|
|
|
|
$(WRAPR) $< -o $(NAME).g1a -i $(ICON)
|
2016-05-15 14:00:40 +02:00
|
|
|
|
@stat -c "Build finished -- output size is %s bytes." $(NAME).g1a
|
2016-05-14 22:19:51 +02:00
|
|
|
|
|
2016-05-15 14:00:40 +02:00
|
|
|
|
## Clean up your mess
|
|
|
|
|
clean:
|
2017-02-24 21:08:57 +01:00
|
|
|
|
$(RM) $(OBJDIR)
|
2016-05-15 14:00:40 +02:00
|
|
|
|
$(RM) $(NAME).elf
|
|
|
|
|
$(RM) $(NAME).bin
|
2016-05-14 22:19:51 +02:00
|
|
|
|
|
2016-05-15 14:00:40 +02:00
|
|
|
|
## Clean up everything
|
2017-02-24 21:08:57 +01:00
|
|
|
|
fclean: clean
|
2016-05-15 14:00:40 +02:00
|
|
|
|
$(RM) $(NAME).g1a
|
2017-02-24 21:08:57 +01:00
|
|
|
|
$(RM) $(NAME).txt
|
|
|
|
|
|
|
|
|
|
dump:
|
|
|
|
|
$(OBJDUMP) -d $(NAME).elf > $(NAME).txt
|
2017-02-25 11:29:24 +01:00
|
|
|
|
@stat -c "Dump file -- dump file put in %n ." $(NAME).txt
|
2016-05-14 22:19:51 +02:00
|
|
|
|
|
2016-05-15 14:00:40 +02:00
|
|
|
|
## Remake
|
|
|
|
|
re: fclean all
|
2016-05-14 22:19:51 +02:00
|
|
|
|
|
2016-05-15 14:00:40 +02:00
|
|
|
|
## Send to calc
|
|
|
|
|
send:
|
2017-02-24 21:08:57 +01:00
|
|
|
|
$(SENDR) send $(NAME).g1a -f
|
|
|
|
|
|
2016-05-15 14:00:40 +02:00
|
|
|
|
## Phuneral phuture ?
|
2017-02-24 21:08:57 +01:00
|
|
|
|
.PHONY: all clean fclean dump re send
|
2016-05-15 14:00:40 +02:00
|
|
|
|
# END OF FILE
|