F1rush/Makefile

64 lines
1.2 KiB
Makefile
Raw Permalink Normal View History

2017-01-29 10:19:46 +01:00
#!/usr/bin/make -f
# INCLUDE CONFIGURATION
include $(CURDIR)/Makefile.config
# DEDUCED VARS
ALLOBJ = $(patsubst %,$(OBJDIR)/%.o,$(SRC) $(IMG))
ALLINC = $(INC:%=$(INCDIR)/%)
2017-01-29 10:19:46 +01:00
# RULES
## Make it all (default rule)
all: $(NAME).g1a
## Compile sprites
$(OBJDIR)/%.bmp.o: $(IMGDIR)/%.bmp
fxconv $< -o $@ -n $(patsubst %.bmp,img_%,$(notdir $<))
2017-01-29 10:19:46 +01:00
## Make the object directory
$(OBJDIR):
mkdir -p $(OBJDIR)
## Make an object file out of an ASM source file
$(OBJDIR)/%.s.o: $(SRCDIR)/%.s
2017-01-29 10:19:46 +01:00
$(AS) -c -o $@ $<
## Make an object file out of a C source file
$(OBJDIR)/%.c.o: $(SRCDIR)/%.c $(ALLINC)
2017-01-29 10:19:46 +01:00
$(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:
2017-01-29 15:45:06 +01:00
$(RM) $(OBJDIR)
2017-01-29 10:19:46 +01:00
$(RM) $(NAME).elf
$(RM) $(NAME).bin
## Clean up everything
mrproper: clean
$(RM) $(NAME).g1a
fclean: mrproper
## Remake
re: fclean all
## Send to calc
send:
2017-01-31 20:26:51 +01:00
$(SENDR) send $(NAME).g1a -f
2017-01-29 10:19:46 +01:00
## Phuneral phuture ?
.PHONY: all clean fclean mrproper re send
# END OF FILE