diff --git a/Makefile b/Makefile index b82616e..69b2b05 100644 --- a/Makefile +++ b/Makefile @@ -6,31 +6,41 @@ HEADERPATH = $(ROOTDIR)/lib N64TOOL = $(ROOTDIR)/bin/n64tool HEADERNAME = header +SRCDIR = ./src +RESDIR = ./res +OBJDIR = ./obj +BINDIR = ./bin LINK_FLAGS = -O1 -L$(ROOTDIR)/lib -L$(ROOTDIR)/mips64-elf/lib -ldragon -lmikmod -lmad -lyaml -lc -lm -ldragonsys -lnosys $(LIBS) -Tn64ld.x PROG_NAME = OS64 -CFLAGS = -std=gnu99 -march=vr4300 -mtune=vr4300 -O1 -I./inc -I$(ROOTDIR)/include -I$(ROOTDIR)/mips64-elf/include -lpthread -lrt -D_REENTRANT -DUSE_TRUETYPE $(SET_DEBUG) +CFLAGS = -std=gnu99 -march=vr4300 -mtune=vr4300 -O1 -I./inc -I$(SRCDIR) -I$(ROOTDIR)/include -I$(ROOTDIR)/mips64-elf/include -lpthread -lrt -D_REENTRANT -DUSE_TRUETYPE $(SET_DEBUG) ASFLAGS = -mtune=vr4300 -march=vr4300 CC = $(GCCN64PREFIX)gcc AS = $(GCCN64PREFIX)as LD = $(GCCN64PREFIX)ld OBJCOPY = $(GCCN64PREFIX)objcopy -OBJS = menu.o everdrive.o fat.o disk.o mem.o sys.o ini.o strlib.o utils.o sram.o stb_image.o chksum64.o mp3.o +#SOURCES := menu.c everdrive.c fat.c disk.c mem.c sys.c ini.c strlib.c utils.c sram.c stb_image.c chksum64.c mp3.c +#SOURCES := $(wildcard $(SRCDIR)/*.c) +#OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o) +OBJECTS = menu.o everdrive.o fat.o disk.o mem.o sys.o ini.o strlib.o utils.o sram.o stb_image.o chksum64.o mp3.o $(PROG_NAME).v64: $(PROG_NAME).elf $(PROG_NAME).dfs - $(OBJCOPY) $(PROG_NAME).elf $(PROG_NAME).bin -O binary - rm -f $(PROG_NAME).v64 - $(N64TOOL) -l 4M -t "EverDrive OS" -h ./res/header.ed64 -o $(PROG_NAME).v64 $(PROG_NAME).bin -s 1M $(PROG_NAME).dfs - $(CHKSUM64PATH) $(PROG_NAME).v64 + $(OBJCOPY) $(BINDIR)/$(PROG_NAME).elf $(BINDIR)/$(PROG_NAME).bin -O binary + rm -f $(BINDIR)/$(PROG_NAME).v64 + $(N64TOOL) -l 4M -t "EverDrive OS" -h $(RESDIR)/header.ed64 -o $(BINDIR)/$(PROG_NAME).v64 $(BINDIR)/$(PROG_NAME).bin -s 1M $(BINDIR)/$(PROG_NAME).dfs + $(CHKSUM64PATH) $(BINDIR)/$(PROG_NAME).v64 -$(PROG_NAME).elf : $(OBJS) - $(LD) -o $(PROG_NAME).elf $(OBJS) $(LINK_FLAGS) +$(PROG_NAME).elf : $(OBJECTS) + $(LD) -o $(BINDIR)/$(PROG_NAME).elf $(OBJECTS) $(LINK_FLAGS) + +#$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c + #@$(CC) $(CFLAGS) -c $< -o $@ copy: $(PROG_NAME).v64 sh upload.sh $(PROG_NAME).dfs: - $(MKDFSPATH) $(PROG_NAME).dfs ./res/filesystem/ + $(MKDFSPATH) $(BINDIR)/$(PROG_NAME).dfs $(RESDIR)/filesystem/ all: $(PROG_NAME).v64 @@ -39,4 +49,4 @@ debug: $(PROG_NAME).v64 debug: SET_DEBUG=-DDEBUG clean: - rm -f *.v64 *.elf *.o *.bin *.dfs + rm -f $(BINDIR)/*.v64 $(BINDIR)/*.elf *.o $(OBJDIR)/*.o $(BINDIR)/*.bin $(BINDIR)/*.dfs