2 # libn64/Makefile: Makefile for libn64.
4 # n64chain: A (free) open-source N64 development toolchain.
5 # Copyright 2014-16 Tyler J. Stachecki <stachecki.tyler@gmail.com>
7 # This file is subject to the terms and conditions defined in
8 # 'LICENSE', which is part of this source code package.
12 FIXPATH
= $(subst /,\
,$1)
19 AS
= $(call FIXPATH
,$(CURDIR
)/..
/tools
/bin
/mips64-elf-as
)
20 AR
= $(call FIXPATH
,$(CURDIR
)/..
/tools
/bin
/mips64-elf-gcc-ar
)
21 CC
= $(call FIXPATH
,$(CURDIR
)/..
/tools
/bin
/mips64-elf-gcc
)
23 CFLAGS
= -Wall
-Wextra
-pedantic
-std
=c99
-I.
-Iinclude
-Ipriv_include
24 OPTFLAGS
= -Os
-march
=vr4300
-mtune
=vr4300
-mabi
=eabi
-mgp32
-mlong32 \
25 -flto
-ffat-lto-objects
-ffunction-sections
-fdata-sections \
26 -G4
-mno-extern-sdata
-mgpopt
-mfix4300
-mbranch-likely
28 ASMFILES
= $(call FIXPATH
,\
32 os
/asm
/idle_thread.s \
37 CFILES
= $(call FIXPATH
,\
51 DEPFILES
= $(OBJFILES
:.o
=.d
)
57 @echo
$(call FIXPATH
,"Building: libn64/$@")
61 # Generic compilation/assembly targets.
64 @echo
$(call FIXPATH
,"Assembling: libn64/$<")
65 @
$(CC
) -x assembler-with-cpp
$(CFLAGS
) $(OPTFLAGS
) -MMD
-c
$< -o
$@
67 %.o
: %.c
include/syscall.h
68 @echo
$(call FIXPATH
,"Compiling: libn64/$<")
69 @
$(CC
) $(CFLAGS
) $(OPTFLAGS
) -MMD
-c
$< -o
$@
72 # Clean project target.
76 @echo
"Cleaning libn64..."
77 @
$(RM
) libn64.a
$(DEPFILES
) $(OBJFILES
)