This commit is contained in:
flo 2017-04-17 16:55:21 +02:00
commit 3cbe5bd731
7 changed files with 147 additions and 0 deletions

70
Makefile Executable file
View File

@ -0,0 +1,70 @@
#!/usr/bin/make -f
# INCLUDE CONFIGURATION
include $(CURDIR)/Makefile.config
# DEDUCED VARS
ALLOBJ = $(patsubst %,$(OBJDIR)/%.o,$(SRC) $(FONT) $(IMG))
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 $(basename $(notdir $<))
## Compile fonts
$(OBJDIR)/%.bmp.o: $(FONTDIR)/%.bmp
fxconv $< -o $@ -n $(basename $(notdir $<)) --font
## 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

50
Makefile.config Executable file
View File

@ -0,0 +1,50 @@
#!/usr/bin/make -f
# PROJECT INFORMATION
NAME = wings
ICON = misc/icon.bmp
LIB = gcc
## DIRECTORIES
SRCDIR = ./src
INCDIR = ./include
OBJDIR = ./obj
LIBDIR = ./lib
SCPTDIR = ./scripts
IMGDIR = ./img
FONTDIR = ./font
# TOOLCHAIN
## Directory maker
MD = mkdir -p
## File remover
RM = rm -f -r
## Assembler
AS = sh3eb-elf-as
## C compiler
CC = sh3eb-elf-gcc
CFLAGS = -m3 -mb -Os -nostdlib -Wall -Wextra -Wno-main -pedantic -std=c11 -I $(INCDIR) `fxsdk --cflags`
## Linker
LD = sh3eb-elf-gcc
LFLAGS = `fxsdk --cflags` `fxsdk --libs`
## Object copier
OBJCPY = sh3eb-elf-objcopy
## Object dump
OBJDUMP = sh3eb-elf-objdump
## G1A Wrapper
WRAPR = g1a-wrapper
## Sender
SENDR = p7
# SOURCES
SRC = $(notdir $(wildcard $(SRCDIR)/*.[cs]))
# INCLUDES
INC = $(notdir $(wildcard $(INCDIR)/*.h))
#IMAGE
IMG = $(notdir $(wildcard $(IMGDIR)/*.bmp))
# FONTS
FONT = $(notdir $(wildcard $(FONTDIR)/*.bmp))
# END OF FILE

BIN
img/plane.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 B

6
include/wings.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef WINGS
#define WINGS
#endif

BIN
misc/icon.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
obj/wings.c.o Normal file

Binary file not shown.

21
src/wings.c Normal file
View File

@ -0,0 +1,21 @@
#include "wings.h"
#include "display.h" // bopti.h => images // tales.h => fonts
#include "keyboard.h"
#include "stdio.h"
#include "stdlib.h"
extern image_t plane;
int main()
{
dimage(0, 0, &plane);
return 1;
}
void menu()
{
}