2017-10-06 09:48:52 -04:00
|
|
|
#
|
|
|
|
# Copyright (c) 2017 The Altra64 project contributors
|
|
|
|
# See LICENSE file in the project root for full license information.
|
|
|
|
#
|
|
|
|
|
2014-06-29 01:10:11 -04:00
|
|
|
ROOTDIR = $(N64_INST)
|
|
|
|
GCCN64PREFIX = $(ROOTDIR)/bin/mips64-elf-
|
|
|
|
CHKSUM64PATH = $(ROOTDIR)/bin/chksum64
|
|
|
|
MKDFSPATH = $(ROOTDIR)/bin/mkdfs
|
|
|
|
N64TOOL = $(ROOTDIR)/bin/n64tool
|
2016-09-09 19:13:21 -04:00
|
|
|
|
|
|
|
HEADERNAME = header.ed64
|
|
|
|
HEADERTITLE = "EverDrive OS"
|
2014-06-29 01:10:11 -04:00
|
|
|
|
2016-09-07 20:18:35 -04:00
|
|
|
SRCDIR = ./src
|
2017-10-06 10:26:20 -04:00
|
|
|
INCDIR = ./inc
|
2016-09-07 20:18:35 -04:00
|
|
|
RESDIR = ./res
|
|
|
|
OBJDIR = ./obj
|
|
|
|
BINDIR = ./bin
|
2016-09-09 19:13:21 -04:00
|
|
|
TOOLSDIR = ./tools
|
2014-06-29 01:10:11 -04:00
|
|
|
|
2019-08-21 01:21:43 -04:00
|
|
|
LINK_FLAGS = -O1 -L$(ROOTDIR)/lib -L$(ROOTDIR)/mips64-elf/lib -ldragon -lmad -lyaml -lc -lm -ldragonsys -lnosys $(LIBS) -Tn64.ld
|
2016-09-07 17:38:04 -04:00
|
|
|
PROG_NAME = OS64
|
2017-10-06 10:26:20 -04:00
|
|
|
CFLAGS = -std=gnu99 -march=vr4300 -mtune=vr4300 -O1 -I$(INCDIR) -I$(ROOTDIR)/include -I$(ROOTDIR)/mips64-elf/include -lpthread -lrt -D_REENTRANT -DUSE_TRUETYPE $(SET_DEBUG)
|
2014-06-29 01:10:11 -04:00
|
|
|
ASFLAGS = -mtune=vr4300 -march=vr4300
|
|
|
|
CC = $(GCCN64PREFIX)gcc
|
|
|
|
AS = $(GCCN64PREFIX)as
|
|
|
|
LD = $(GCCN64PREFIX)ld
|
|
|
|
OBJCOPY = $(GCCN64PREFIX)objcopy
|
2016-09-09 19:13:21 -04:00
|
|
|
|
|
|
|
SOURCES := $(wildcard $(SRCDIR)/*.c)
|
|
|
|
OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
|
2014-06-29 01:10:11 -04:00
|
|
|
|
2016-09-09 19:13:21 -04:00
|
|
|
$(PROG_NAME).v64: $ $(PROG_NAME).elf $(PROG_NAME).dfs
|
2016-09-07 20:18:35 -04:00
|
|
|
$(OBJCOPY) $(BINDIR)/$(PROG_NAME).elf $(BINDIR)/$(PROG_NAME).bin -O binary
|
|
|
|
rm -f $(BINDIR)/$(PROG_NAME).v64
|
2016-09-09 19:13:21 -04:00
|
|
|
$(N64TOOL) -l 4M -t $(HEADERTITLE) -h $(RESDIR)/$(HEADERNAME) -o $(BINDIR)/$(PROG_NAME).v64 $(BINDIR)/$(PROG_NAME).bin -s 1M $(BINDIR)/$(PROG_NAME).dfs
|
2016-09-07 20:18:35 -04:00
|
|
|
$(CHKSUM64PATH) $(BINDIR)/$(PROG_NAME).v64
|
2014-06-29 01:10:11 -04:00
|
|
|
|
2016-09-07 20:18:35 -04:00
|
|
|
$(PROG_NAME).elf : $(OBJECTS)
|
2016-09-09 19:13:21 -04:00
|
|
|
@mkdir -p $(BINDIR)
|
2016-09-07 20:18:35 -04:00
|
|
|
$(LD) -o $(BINDIR)/$(PROG_NAME).elf $(OBJECTS) $(LINK_FLAGS)
|
|
|
|
|
2016-09-09 19:13:21 -04:00
|
|
|
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
|
|
|
|
@mkdir -p $(OBJDIR)
|
|
|
|
$(CC) $(CFLAGS) -c $< -o $@
|
2014-06-29 01:10:11 -04:00
|
|
|
|
|
|
|
copy: $(PROG_NAME).v64
|
2016-09-09 19:13:21 -04:00
|
|
|
sh $(TOOLSDIR)/upload.sh
|
2014-06-29 01:10:11 -04:00
|
|
|
|
2016-09-07 17:38:04 -04:00
|
|
|
$(PROG_NAME).dfs:
|
2016-09-07 20:18:35 -04:00
|
|
|
$(MKDFSPATH) $(BINDIR)/$(PROG_NAME).dfs $(RESDIR)/filesystem/
|
2014-06-29 01:10:11 -04:00
|
|
|
|
|
|
|
all: $(PROG_NAME).v64
|
|
|
|
|
2016-09-07 17:11:50 -04:00
|
|
|
debug: $(PROG_NAME).v64
|
|
|
|
|
|
|
|
debug: SET_DEBUG=-DDEBUG
|
|
|
|
|
2014-06-29 01:10:11 -04:00
|
|
|
clean:
|
2016-09-09 19:13:21 -04:00
|
|
|
rm -f $(BINDIR)/*.v64 $(BINDIR)/*.elf $(OBJDIR)/*.o $(BINDIR)/*.bin $(BINDIR)/*.dfs
|