wings/Makefile

71 lines
1.5 KiB
Makefile
Raw Permalink Normal View History

2017-04-17 16:55:21 +02:00
#!/usr/bin/make -f
# INCLUDE CONFIGURATION
include $(CURDIR)/Makefile.config
# DEDUCED VARS
2017-04-18 21:46:27 +02:00
ALLOBJ = $(patsubst %,$(OBJDIR)/%.o,$(SRC) $(IMG) $(FONT))
2017-04-17 16:55:21 +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
2017-07-30 15:20:33 +02:00
fxconv -image $< -o $@ -n $(basename $(notdir $<))
2017-04-17 16:55:21 +02:00
## Compile fonts
$(OBJDIR)/%.bmp.o: $(FONTDIR)/%.bmp
2017-07-30 15:20:33 +02:00
fxconv -font $< -o $@ -n $(basename $(notdir $<))
2017-04-17 16:55:21 +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