Skip to content

Commit

Permalink
iop Makefiles simplified
Browse files Browse the repository at this point in the history
All iop modules are now be compiled using the same compile and link
flags, much like the Makefile system in ps2sdk.
  • Loading branch information
rickgaiser committed Dec 5, 2020
1 parent df4bd01 commit 422fee7
Show file tree
Hide file tree
Showing 32 changed files with 56 additions and 506 deletions.
9 changes: 9 additions & 0 deletions modules/Rules.bin.make
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
all: $(IOP_BIN)

clean:
rm -f $(IOP_BIN) $(IOP_OBJS)

rebuild: clean all

run:
ps2client -t 1 execiop host:$(IOP_BIN)
11 changes: 6 additions & 5 deletions modules/Rules.make
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ IOP_INCS := $(IOP_INCS) -I$(PS2SDK)/iop/include -I$(PS2SDK)/common/include -Iinc
# C compiler flags
# -fno-builtin is required to prevent the GCC built-in functions from being included,
# for finer-grained control over what goes into each IRX.
IOP_CFLAGS := -D_IOP -fno-builtin -Os -G0 $(IOP_INCS) $(IOP_CFLAGS)
IOP_CFLAGS := -D_IOP -fno-builtin -Os -G0 -Wall -Werror $(IOP_INCS) $(IOP_CFLAGS)
# linker flags
IOP_LDFLAGS := -nostdlib $(IOP_LDFLAGS)
#IOP_LDFLAGS := -nostdlib -L$(PS2SDK)/iop/lib $(IOP_LDFLAGS)
IOP_LDFLAGS := -nostdlib -s $(IOP_LDFLAGS)

# Additional C compiler flags for GCC >=v5.3.0
# -msoft-float is to "remind" GCC/Binutils that the soft-float ABI is to be used. This is due to a bug, which
Expand All @@ -49,6 +48,8 @@ BIN2S = $(PS2SDK)/bin/bin2s
BIN2O = $(PS2SDK)/bin/bin2o

# Externally defined variables: IOP_BIN, IOP_OBJS, IOP_LIB
$(IOP_OBJS_DIR):
mkdir -p $(IOP_OBJS_DIR)

$(IOP_OBJS_DIR)%.o : %.c
$(IOP_CC) $(IOP_CFLAGS) -c $< -o $@
Expand All @@ -73,10 +74,10 @@ $(IOP_OBJS_DIR)%.o : %.tab
$(IOP_CC) $(IOP_CFLAGS) -I. -c $(IOP_OBJS_DIR)build-exports.c -o $@
-rm -f $(IOP_OBJS_DIR)build-exports.c

$(IOP_BIN) : $(IOP_OBJS)
$(IOP_BIN) : $(IOP_OBJS_DIR) $(IOP_OBJS)
echo " -$@"
$(IOP_CC) $(IOP_CFLAGS) -o $(IOP_BIN) $(IOP_OBJS) $(IOP_LDFLAGS) $(IOP_LIBS)

$(IOP_LIB) : $(IOP_OBJS)
$(IOP_LIB) : $(IOP_OBJS_DIR) $(IOP_OBJS)
echo " -$@"
$(IOP_AR) cru $(IOP_LIB) $(IOP_OBJS)
30 changes: 1 addition & 29 deletions modules/debug/ioptrap/Makefile
Original file line number Diff line number Diff line change
@@ -1,34 +1,6 @@
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
#
# $Id: Makefile 597 2004-09-21 16:15:05Z pixel $


IOP_BIN = ioptrap.irx

IOP_INCS += -I$(PS2SDK)/common/include
IOP_CFLAGS += -Wall -fno-builtin-printf #-DTEST_TRAP
IOP_LDFLAGS += -s

IOP_OBJS = ioptrap.o handler.o breakpoint.o imports.o exports.o
IOP_LIBS =

all: $(IOP_BIN)

clean:
rm -f $(IOP_BIN) $(IOP_OBJS)

rebuild: clean all

run:
ps2client -t 1 execiop host:$(IOP_BIN)


include $(PS2SDK)/Defs.make
include ../../Rules.bin.make
include ../../Rules.make

20 changes: 1 addition & 19 deletions modules/debug/ps2link/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
# _____ ___ ____
# ____| | ____| PSX2 OpenSource Project
# | ___| |____ (C)2002, David Ryan ( Oobles@hotmail.com )
# ------------------------------------------------------------------------

# Generated automatically from Makefile.in by configure.
#.SUFFIXES: .S .c .o .s .elf .irx

IOP_BIN = ps2link.irx
IOP_OBJS = net_fsys.o net_fio.o ps2link.o cmdHandler.o nprintf.o excepHandler.o imports.o

IOP_INCS += -I$(PS2SDK)/iop/include
IOP_LIBS +=
IOP_LDFLAGS += -s
IOP_CFLAGS += -Wall -fno-builtin

# Enable zero-copy on fileio writes.
ifeq ($(ZEROCOPY),1)
IOP_CFLAGS += -DZEROCOPY
Expand All @@ -28,11 +15,6 @@ ifeq ($(PWOFFONRESET),1)
IOP_CFLAGS += -DPWOFFONRESET
endif


all: $(IOP_BIN)

clean:
-rm -f $(IOP_OBJS) $(IOP_BIN)

include $(PS2SDK)/Defs.make
include ../../Rules.bin.make
include ../../Rules.make
19 changes: 3 additions & 16 deletions modules/debug/udptty-ingame/Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
IOP_BIN = udptty.irx

IOP_INCS += -I../../network/common
IOP_CFLAGS += -Wall -fno-builtin-printf -DKPRTTY
IOP_LDFLAGS += -s

IOP_OBJS = udptty.o imports.o exports.o
IOP_LIBS =

all: $(IOP_BIN)

clean:
rm -f $(IOP_BIN) $(IOP_OBJS)

rebuild: clean all

run:
ps2client -t 1 execiop host:$(IOP_BIN)

IOP_INCS += -I../../network/common
IOP_CFLAGS += -DKPRTTY

include $(PS2SDK)/Defs.make
include ../../Rules.bin.make
include ../../Rules.make
14 changes: 1 addition & 13 deletions modules/ds34bt/iop/Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
IOP_BIN = ds34bt.irx

IOP_INCS +=
IOP_CFLAGS += -Wall -fno-builtin
IOP_LDFLAGS += -s

IOP_OBJS = ds34bt.o smsutils.o imports.o
IOP_LIBS =

all: $(IOP_BIN)

clean:
rm -f $(IOP_BIN) $(IOP_OBJS)

rebuild: clean all

include $(PS2SDK)/Defs.make
include ../../Rules.bin.make
include ../../Rules.make
16 changes: 2 additions & 14 deletions modules/ds34usb/iop/Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
IOP_BIN = ds34usb.irx

IOP_INCS +=
IOP_CFLAGS += -Wall
IOP_LDFLAGS += -s

IOP_OBJS = ds34usb.o smsutils.o imports.o
IOP_LIBS =

all: $(IOP_BIN)

clean:
rm -f $(IOP_BIN) $(IOP_OBJS)

rebuild: clean all

include $(PS2SDK)/Defs.make
include $(PS2SDK)/samples/Makefile.iopglobal
include ../../Rules.bin.make
include ../../Rules.make
24 changes: 2 additions & 22 deletions modules/hdd/hdldsvr/Makefile
Original file line number Diff line number Diff line change
@@ -1,30 +1,10 @@
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
#
# $Id: $

IOP_BIN = hdldsvr.irx
IOP_OBJS = hdldsvr.o imports.o exports.o

ifeq ($(DEBUG),1)
DEBUG_FLAGS = -DDEBUG
IOP_CFLAGS += -DDEBUG
endif

IOP_INCS +=
IOP_CFLAGS += -Wall -fno-builtin $(DEBUG_FLAGS)
IOP_LDFLAGS += -s

all: $(IOP_BIN)

clean:
-rm -f $(IOP_OBJS) $(IOP_BIN)

rebuild: clean all

include $(PS2SDK)/Defs.make
include ../../Rules.bin.make
include ../../Rules.make
18 changes: 1 addition & 17 deletions modules/hdd/xhdd/Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
#

IOP_BIN = xhdd.irx
IOP_OBJS = xhdd.o xatad.o hdpro.o imports.o

IOP_CFLAGS += -Wall -fno-builtin $(DEBUG_FLAGS)
IOP_LDFLAGS += -s
IOP_INCS += -I../common

all: $(IOP_BIN)

clean:
-rm -f $(IOP_OBJS) $(IOP_BIN)

rebuild: clean all

include $(PS2SDK)/Defs.make
include ../../Rules.bin.make
include ../../Rules.make
24 changes: 4 additions & 20 deletions modules/iopcore/cdvdfsv/Makefile
Original file line number Diff line number Diff line change
@@ -1,28 +1,12 @@
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
#
# $Id: $

IOP_BIN = cdvdfsv.irx
IOP_OBJS = cdvdfsv.o imports.o exports.o

ifeq ($(DEBUG),1)
DEBUG_FLAGS = -DDEBUG
endif

IOP_INCS += -I../common
IOP_CFLAGS += -Wall -fno-builtin $(DEBUG_FLAGS)
IOP_LDFLAGS += -s

all: $(IOP_BIN)

clean:
-rm -f *.o *.irx cdvdfsv.map
ifeq ($(DEBUG),1)
IOP_CFLAGS += -DDEBUG
endif

include $(PS2SDK)/Defs.make
include ../../Rules.bin.make
include ../../Rules.make
27 changes: 1 addition & 26 deletions modules/iopcore/cdvdman/Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,3 @@
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
#
# $Id: $

IOP_OBJS = cdvdman.o streaming.o ioplib_util.o smsutils.o imports.o exports.o
USE_DEV9 ?= 0

Expand Down Expand Up @@ -48,12 +38,8 @@ USE_DEV9 = 1
endif
endif


IOP_LIBS =
IOP_INCS += -I../common

IOP_CFLAGS += -Wall -fno-builtin-printf

ifeq ($(IOPCORE_DEBUG),1)
IOP_CFLAGS += -D__IOPCORE_DEBUG
endif
Expand All @@ -65,17 +51,6 @@ endif

IOP_OBJS := $(IOP_OBJS:%=$(IOP_OBJS_DIR)%)

IOP_LDFLAGS += -s

all: OBJ_DIR $(IOP_BIN)

clean:
rm -f $(IOP_BIN) $(IOP_OBJS) cdvdman.map

rebuild: clean all

OBJ_DIR:
mkdir -p $(IOP_OBJS_DIR)

include $(PS2SDK)/Defs.make
include ../../Rules.bin.make
include ../../Rules.make
20 changes: 1 addition & 19 deletions modules/iopcore/eesync/Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
#
# $Id: Makefile 577 2004-09-14 14:41:46Z pixel $

IOP_BIN = eesync.irx
IOP_OBJS = eesync.o imports.o

IOP_INCS +=
IOP_CFLAGS += -Os -Wall -fno-builtin
IOP_LDFLAGS += -s

all: $(IOP_BIN)

clean:
-rm -f $(IOP_OBJS) $(IOP_BIN)

include $(PS2SDK)/Defs.make
include ../../Rules.bin.make
include ../../Rules.make
20 changes: 1 addition & 19 deletions modules/iopcore/imgdrv/Makefile
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@
# _____ ___ ____ ___ ____
# ____| | ____| | | |____|
# | ___| |____ ___| ____| | \ PS2DEV Open Source Project.
#-----------------------------------------------------------------------
# Copyright 2001-2004, ps2dev - http://www.ps2dev.org
# Licenced under Academic Free License version 2.0
# Review ps2sdk README & LICENSE files for further details.
#
# $Id: Makefile 577 2004-09-14 14:41:46Z pixel $

IOP_BIN = imgdrv.irx
IOP_OBJS = imgdrv.o imports.o

IOP_INCS +=
IOP_CFLAGS += -Wall -fno-builtin
IOP_LDFLAGS += -s

all: $(IOP_BIN)

clean:
-rm -f $(IOP_OBJS) $(IOP_BIN)

include $(PS2SDK)/Defs.make
include ../../Rules.bin.make
include ../../Rules.make
10 changes: 1 addition & 9 deletions modules/iopcore/patches/apemodpatch/Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
IOP_BIN = apemodpatch.irx
IOP_OBJS = main.o imports.o

IOP_INCS +=
IOP_CFLAGS += -Os -Wall -fno-builtin
IOP_LDFLAGS += -s

all: $(IOP_BIN)

clean:
-rm -f $(IOP_OBJS) $(IOP_BIN)

include $(PS2SDK)/Defs.make
include ../../../Rules.bin.make
include ../../../Rules.make

0 comments on commit 422fee7

Please sign in to comment.