forked from gameblabla/altra64
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
executable file
·61 lines (47 loc) · 1.83 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#
# Copyright (c) 2017 The Altra64 project contributors
# See LICENSE file in the project root for full license information.
#
ROOTDIR = $(N64_INST)
GCCN64PREFIX = $(ROOTDIR)/bin/mips64-elf-
CHKSUM64PATH = $(ROOTDIR)/bin/chksum64
MKDFSPATH = $(ROOTDIR)/bin/mkdfs
N64TOOL = $(ROOTDIR)/bin/n64tool
HEADERNAME = header.ed64
HEADERTITLE = "ED64Plus OS"
SRCDIR = ./src
INCDIR = ./inc
RESDIR = ./res
OBJDIR = ./obj
BINDIR = ./bin
TOOLSDIR = ./tools
LINK_FLAGS = -O3 -L$(ROOTDIR)/lib -L$(ROOTDIR)/mips64-elf/lib -ldragon -lyaml -lmad -lmikmod -lc -lm -ldragonsys -lnosys $(LIBS) -Tn64ld.x
PROG_NAME = OS64P
CFLAGS = -std=gnu99 -march=vr4300 -mtune=vr4300 -O3 -I$(INCDIR) -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
SOURCES := $(wildcard $(SRCDIR)/*.c)
OBJECTS = $(SOURCES:$(SRCDIR)/%.c=$(OBJDIR)/%.o)
$(PROG_NAME).v64: $ $(PROG_NAME).elf $(PROG_NAME).dfs
$(OBJCOPY) $(BINDIR)/$(PROG_NAME).elf $(BINDIR)/$(PROG_NAME).bin -O binary
rm -f $(BINDIR)/$(PROG_NAME).v64
$(N64TOOL) -l 4M -t $(HEADERTITLE) -h $(RESDIR)/$(HEADERNAME) -o $(BINDIR)/$(PROG_NAME).v64 $(BINDIR)/$(PROG_NAME).bin -s 1M $(BINDIR)/$(PROG_NAME).dfs
$(CHKSUM64PATH) $(BINDIR)/$(PROG_NAME).v64
$(PROG_NAME).elf : $(OBJECTS)
@mkdir -p $(BINDIR)
$(LD) -o $(BINDIR)/$(PROG_NAME).elf $(OBJECTS) $(LINK_FLAGS)
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.c
@mkdir -p $(OBJDIR)
$(CC) $(CFLAGS) -c $< -o $@
copy: $(PROG_NAME).v64
sh $(TOOLSDIR)/upload.sh
$(PROG_NAME).dfs:
$(MKDFSPATH) $(BINDIR)/$(PROG_NAME).dfs $(RESDIR)/filesystem/
all: $(PROG_NAME).v64
debug: $(PROG_NAME).v64
debug: SET_DEBUG=-DDEBUG
clean:
rm -f $(BINDIR)/*.v64 $(BINDIR)/*.elf $(OBJDIR)/*.o $(BINDIR)/*.bin $(BINDIR)/*.dfs