2017-04-10 17:50:10 +02:00
|
|
|
|
#!/usr/bin/make -f
|
|
|
|
|
# INCLUDE CONFIGURATION
|
|
|
|
|
include $(CURDIR)/Makefile.config
|
|
|
|
|
|
|
|
|
|
# DEDUCED VARS
|
2017-05-02 20:54:48 +02:00
|
|
|
|
ALLOBJ = $(patsubst %,$(OBJDIR)/%.o,$(SRC) $(FONT) $(IMG))
|
2017-04-10 17:50:10 +02:00
|
|
|
|
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 $< -o $@ -n $(patsubst %.bmp,img_%,$(notdir $<))
|
|
|
|
|
|
|
|
|
|
## Compile fonts
|
|
|
|
|
$(OBJDIR)/%.bmp.o: $(FONTDIR)/%.bmp
|
2017-04-11 18:41:47 +02:00
|
|
|
|
fxconv $< -o $@ -n $(basename $(notdir $<)) --font
|
2017-04-10 17:50:10 +02:00
|
|
|
|
|
|
|
|
|
## 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
|