aboutsummaryrefslogtreecommitdiff
path: root/examples/hello/makefile
diff options
context:
space:
mode:
authorJohn Wilbert M. Villamor <lameguy64@gmail.com>2020-01-06 09:39:20 +0800
committerJohn Wilbert M. Villamor <lameguy64@gmail.com>2020-01-06 09:39:20 +0800
commitc98ad0e7dbc48c928aaea0f78214c7ed6556417d (patch)
treebcbafb8547eceb867f342bfe504377e13a5533a9 /examples/hello/makefile
parent87ded2ccb9db9bf3b2ed40a0b02b663179d5868f (diff)
downloadpsn00bsdk-c98ad0e7dbc48c928aaea0f78214c7ed6556417d.tar.gz
Some minor updates, added CD-ROM library documentation
Diffstat (limited to 'examples/hello/makefile')
-rw-r--r--examples/hello/makefile39
1 files changed, 39 insertions, 0 deletions
diff --git a/examples/hello/makefile b/examples/hello/makefile
new file mode 100644
index 0000000..3350b85
--- /dev/null
+++ b/examples/hello/makefile
@@ -0,0 +1,39 @@
+include ../sdk-common.mk
+
+TARGET = hello.elf
+
+CFILES = $(notdir $(wildcard *.c))
+CPPFILES = $(notdir $(wildcard *.cpp))
+AFILES = $(notdir $(wildcard *.s))
+
+OFILES = $(addprefix build/,$(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(AFILES:.s=.o))
+
+INCLUDE +=
+LIBDIRS +=
+
+LIBS = -lpsxetc -lpsxgpu -lpsxgte -lpsxspu -lpsxapi -lc
+
+CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections
+CPPFLAGS = $(CFLAGS) -fno-exceptions
+AFLAGS = -g -msoft-float
+LDFLAGS = -g -Ttext=0x80010000 -gc-sections -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x
+
+CC = $(PREFIX)gcc
+CXX = $(PREFIX)g++
+AS = $(PREFIX)as
+LD = $(PREFIX)ld
+
+all: $(OFILES)
+ $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET)
+ elf2x -q $(TARGET)
+
+build/%.o: %.c
+ @mkdir -p $(dir $@)
+ $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@
+
+build/%.o: %.s
+ @mkdir -p $(dir $@)
+ $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@
+
+clean:
+ rm -rf build $(TARGET) $(TARGET:.elf=.exe)