3
0
mirror of https://github.com/XboxDev/nxdk.git synced 2026-02-04 15:35:39 +00:00

Enable out-of-tree builds.

This commit is contained in:
Matt Borgerson
2016-01-01 23:09:15 -07:00
parent aa224c133b
commit 064643c79b
8 changed files with 74 additions and 75 deletions

4
.gitignore vendored
View File

@ -6,11 +6,7 @@
_*.cpp
_*.h
app/main.exe.manifest
app/ps.fp
app/vs.vp
bin/
default.iso
tools/cxbe/cxbe
tools/fp20compiler/fp20compiler
tools/vp20compiler/vp20compiler

View File

@ -1,23 +1,22 @@
LLDLINK = /usr/local/opt/llvm/bin/lld -flavor link
CC = /usr/local/opt/llvm/bin/clang
CXX = /usr/local/opt/llvm/bin/clang++
CGC = wine tools/cg/cgc.exe
CXBE = tools/cxbe/cxbe
VP20COMPILER = tools/vp20compiler/vp20compiler
FP20COMPILER = tools/fp20compiler/fp20compiler
EXTRACT_XISO = tools/extract-xiso/extract-xiso
CGC = wine $(NXDK_DIR)/tools/cg/cgc.exe
CXBE = $(NXDK_DIR)/tools/cxbe/cxbe
VP20COMPILER = $(NXDK_DIR)/tools/vp20compiler/vp20compiler
FP20COMPILER = $(NXDK_DIR)/tools/fp20compiler/fp20compiler
EXTRACT_XISO = $(NXDK_DIR)/tools/extract-xiso/extract-xiso
TOOLS = cxbe vp20compiler fp20compiler extract-xiso
CFLAGS = -target i386-pc-win32 -march=pentium3 \
-ffreestanding -nostdlib -fno-builtin -fno-exceptions \
-Ilib -Ilib/xboxrt
-ffreestanding -nostdlib -fno-builtin -fno-exceptions \
-I$(NXDK_DIR)/lib -I$(NXDK_DIR)/lib/xboxrt
SHADERINT =
SHADEROBJ =
INCLUDES =
SRCS =
ifeq ($(NXDK_DIR),)
NXDK_DIR = $(shell pwd)
endif
include lib/Makefile
include app/Makefile
include $(NXDK_DIR)/lib/Makefile
OBJS = $(SRCS:.c=.obj)
@ -26,42 +25,45 @@ all: default.iso
default.iso: bin/default.xbe
$(EXTRACT_XISO) -c bin $@
bin/default.xbe: app/main.exe
bin/default.xbe: main.exe
mkdir -p bin
$(CXBE) -OUT:bin/default.xbe -TITLE:0ldskoo1 app/main.exe
$(CXBE) -OUT:bin/default.xbe -TITLE:0ldskoo1 main.exe
app/main.exe: $(OBJS)
$(LLDLINK) -subsystem:windows -dll -out:'$@' -entry:XboxCRT lib/xboxkrnl/libxboxkrnl.lib $(OBJS)
main.exe: $(OBJS)
$(LLDLINK) -subsystem:windows -dll -out:'$@' \
-entry:XboxCRT $(NXDK_DIR)/lib/xboxkrnl/libxboxkrnl.lib $(OBJS)
%.obj: %.c ${INCLUDES}
%.obj: %.c $(INCLUDES)
$(CC) $(CFLAGS) -c -o '$@' '$<'
app/vs.vp: app/vs.cg
$(CGC) -profile vp20 -o '$@' '$<'
%.inl: %.vs.cg
$(CGC) -profile vp20 -o $@.$$$$ $< ; \
$(VP20COMPILER) $@.$$$$ > $@ ; \
rm -rf $@.$$$$
app/ps.fp: app/ps.cg
$(CGC) -profile fp20 -o '$@' '$<'
%.inl: %.ps.cg
$(CGC) -profile fp20 -o $@.$$$$ $< ; \
$(FP20COMPILER) $@.$$$$ > $@ ; \
rm -rf $@.$$$$
%.inl: %.vp
$(VP20COMPILER) '$<' > '$@'
#
# Tools
#
%.inl: %.fp
$(FP20COMPILER) '$<' > '$@'
tools: $(TOOLS)
cxbe:
$(MAKE) -C tools/cxbe
$(MAKE) -C $(NXDK_DIR)/tools/cxbe
vp20compiler:
$(MAKE) -C tools/vp20compiler
$(MAKE) -C $(NXDK_DIR)/tools/vp20compiler
fp20compiler:
$(MAKE) -C tools/fp20compiler
$(MAKE) -C $(NXDK_DIR)/tools/fp20compiler
extract-xiso:
$(MAKE) -C tools/extract-xiso
tools: cxbe vp20compiler fp20compiler extract-xiso
$(MAKE) -C $(NXDK_DIR)/tools/extract-xiso
.PHONY: clean tools cxbe vp20compiler fp20compiler extract-xiso
clean:
rm -f default.iso bin/default.xbe app/main.exe app/main.exe.manifest $(OBJS) $(SHADERINT) $(SHADEROBJ)
rm -f default.iso bin/default.xbe main.exe main.exe.manifest $(OBJS) $(SHADEROBJ)

View File

@ -36,8 +36,7 @@ Now you can compile your application and nxdk:
git submodule init
git submodule update
make tools
ln -s samples/0ldskoo1 app
make
make -C samples/0ldskoo1
Credits
-------

View File

@ -1,32 +1,32 @@
USB_SRCS := \
lib/usb/host/ohci-hcd.c \
lib/usb/core/message.c \
lib/usb/core/hcd.c \
lib/usb/core/hcd-pci.c \
lib/usb/core/hub.c \
lib/usb/core/usb.c \
lib/usb/core/config.c \
lib/usb/core/urb.c \
lib/usb/core/buffer_simple.c \
lib/usb/core/usb-debug.c \
lib/usb/sys/BootUSB.c \
lib/usb/sys/linuxwrapper.c \
lib/usb/sys/xpad.c \
lib/usb/sys/xremote.c \
lib/usb/sys/usbkey.c \
lib/usb/sys/usbmouse.c \
lib/usb/misc/misc.c \
lib/usb/misc/pci.c \
lib/usb/misc/malloc.c
$(NXDK_DIR)/lib/usb/host/ohci-hcd.c \
$(NXDK_DIR)/lib/usb/core/message.c \
$(NXDK_DIR)/lib/usb/core/hcd.c \
$(NXDK_DIR)/lib/usb/core/hcd-pci.c \
$(NXDK_DIR)/lib/usb/core/hub.c \
$(NXDK_DIR)/lib/usb/core/usb.c \
$(NXDK_DIR)/lib/usb/core/config.c \
$(NXDK_DIR)/lib/usb/core/urb.c \
$(NXDK_DIR)/lib/usb/core/buffer_simple.c \
$(NXDK_DIR)/lib/usb/core/usb-debug.c \
$(NXDK_DIR)/lib/usb/sys/BootUSB.c \
$(NXDK_DIR)/lib/usb/sys/linuxwrapper.c \
$(NXDK_DIR)/lib/usb/sys/xpad.c \
$(NXDK_DIR)/lib/usb/sys/xremote.c \
$(NXDK_DIR)/lib/usb/sys/usbkey.c \
$(NXDK_DIR)/lib/usb/sys/usbmouse.c \
$(NXDK_DIR)/lib/usb/misc/misc.c \
$(NXDK_DIR)/lib/usb/misc/pci.c \
$(NXDK_DIR)/lib/usb/misc/malloc.c
INCLUDES += \
$(wildcard lib/xboxkrnl/*.h) \
$(wildcard lib/xboxrt/*.h) \
$(wildcard lib/hal/*.h) \
$(wildcard lib/pbkit/*.h)
$(wildcard $(NXDK_DIR)/lib/xboxkrnl/*.h) \
$(wildcard $(NXDK_DIR)/lib/xboxrt/*.h) \
$(wildcard $(NXDK_DIR)/lib/hal/*.h) \
$(wildcard $(NXDK_DIR)/lib/pbkit/*.h)
SRCS += \
$(wildcard lib/xboxrt/*.c) \
$(wildcard lib/hal/*.c) \
$(wildcard lib/pbkit/*.c) \
$(wildcard $(NXDK_DIR)/lib/xboxrt/*.c) \
$(wildcard $(NXDK_DIR)/lib/hal/*.c) \
$(wildcard $(NXDK_DIR)/lib/pbkit/*.c) \
$(USB_SRCS)

View File

@ -1,10 +1,10 @@
SHADERINT += \
app/vs.vp \
app/ps.fp
SHADEROBJ = \
$(CURDIR)/vs.inl \
$(CURDIR)/ps.inl
SHADEROBJ += \
app/vs.inl \
app/ps.inl
INCLUDES = $(wildcard $(CURDIR)/*.h)
SRCS = $(wildcard $(CURDIR)/*.c)
NXDK_DIR = $(CURDIR)/../..
include $(NXDK_DIR)/Makefile
INCLUDES += $(wildcard app/*.h) $(SHADEROBJ)
SRCS += $(wildcard app/*.c)
$(CURDIR)/graphics.obj : $(SHADEROBJ)

View File

@ -1,2 +1,4 @@
INCLUDES += $(wildcard app/*.h)
SRCS += $(wildcard app/*.c)
INCLUDES += $(wildcard $(CURDIR)/*.h)
SRCS += $(wildcard $(CURDIR)/*.c)
NXDK_DIR = $(CURDIR)/../..
include $(NXDK_DIR)/Makefile