Skip to content

Commit

Permalink
Refactored makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
EPICGameGuy committed Dec 30, 2023
1 parent 8fab8e6 commit f216649
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 63 deletions.
25 changes: 0 additions & 25 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,13 @@ LINKFLAGS = -O3 -g -Wl,-zmax-page-size=128

OUTPUT_DIR = build
ISO_FOLDER_DIR = build/iso
VU_OUTPUT_DIR = vu
VU_PROGS = $(addprefix $(OUTPUT_DIR)/$(VU_OUTPUT_DIR)/, $(patsubst %.vcl, %.o, $(VCL_FILES)))

PS2GL_DIR = dependencies/ps2gl
EE_INCS += -I$(PS2GL_DIR)/vu1

#
# Vector Unit assembler:
#
PS2_VU_DVP = dvp-as

#
# openvcl = Vector Command Line preprocessor.
# (get it at: https://github.com/jsvennevid/openvcl)
#
# vclpp = Vector assembly preprocessor
# (get it at: https://github.com/glampert/vclpp)
PS2_VCL = vcl
PS2_VCLPP = vclpp

#
# VCL/VU microprograms:
#
VCL_PATH = $(PREFIX)
VCL_FILES = renderer/ps2gl_renderers/vuprogs/general_pv_diff.vcl

include src/Makefile.iso
include src/Makefile.vuprogs

VUPROGS: $(addsuffix .vo, $(addprefix vu1/, $(RENDERERS)))
EE_OBJS := $(VUPROGS) $(EE_OBJS)

.PHONY: compile cleancompile
compile: $(EE_BIN)

Expand Down
39 changes: 16 additions & 23 deletions src/Makefile.iso
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,27 @@ $(ISO_FOLDER_DIR):
$(ISO_FOLDER_DIR)/SYSTEM.CNF: $(ISO_FOLDER_DIR)
cp SYSTEM.CNF $@

$(ISO_FOLDER_DIR)/AUDSRV.IRX: $(ISO_FOLDER_DIR)
cp $(PS2SDK)/iop/irx/audsrv.irx $@

$(ISO_FOLDER_DIR)/PS2SND.IRX: $(ISO_FOLDER_DIR)
cp $(PS2SDK)/iop/irx/ps2snd.irx $@

$(ISO_FOLDER_DIR)/DEV9.IRX: $(ISO_FOLDER_DIR)
cp $(PS2SDK)/iop/irx/ps2dev9.irx $@

$(ISO_FOLDER_DIR)/NETMAN.IRX: $(ISO_FOLDER_DIR)
cp $(PS2SDK)/iop/irx/netman.irx $@

$(ISO_FOLDER_DIR)/USBD.IRX: $(ISO_FOLDER_DIR)
cp $(PS2SDK)/iop/irx/usbd.irx $@

$(ISO_FOLDER_DIR)/PS2KBD.IRX: $(ISO_FOLDER_DIR)
cp $(PS2SDK)/iop/irx/ps2kbd.irx $@
IRX_FILES = \
audsrv.irx \
ps2snd.irx \
ps2dev9.irx \
netman.irx \
usbd.irx \
ps2kbd.irx \
smap.irx

IRX_SRC_FILES := $(addprefix $(PS2SDK)/iop/irx/, $(IRX_FILES))
IRX_TARGET_FILES := $(addprefix $(ISO_FOLDER_DIR)/, $(IRX_FILES))

$(IRX_TARGET_FILES): $(ISO_FOLDER_DIR)/%.irx: $(PS2SDK)/iop/irx/%.irx
cp $< $@

$(ISO_FOLDER_DIR)/SMAP.IRX: $(ISO_FOLDER_DIR)
cp $(PS2SDK)/iop/irx/smap.irx $@
copy_irx: $(IRX_TARGET_FILES)

$(ISO_FOLDER_DIR)/ps2client.exe: $(ISO_FOLDER_DIR)
cp assets/ps2client.exe $@

.PHONY: copy_libs
copy_libs: $(ISO_FOLDER_DIR)/AUDSRV.IRX $(ISO_FOLDER_DIR)/DEV9.IRX $(ISO_FOLDER_DIR)/NETMAN.IRX $(ISO_FOLDER_DIR)/SMAP.IRX $(ISO_FOLDER_DIR)/PS2SND.IRX $(ISO_FOLDER_DIR)/USBD.IRX $(ISO_FOLDER_DIR)/PS2KBD.IRX $(ISO_FOLDER_DIR)/ps2client.exe
copy_libs: copy_irx $(ISO_FOLDER_DIR)/ps2client.exe

# Sound files
AUDIO_FILE_TYPE = wav
Expand Down Expand Up @@ -66,13 +61,11 @@ $(LVL_DEST_FILES): $(ISO_FOLDER_DIR)/assets/%.lvl: assets/%.lvl
.PHONY: levels
levels: $(LVL_DEST_FILES)


# Asset Manifest compilation
.PHONY: manifestassets
manifestassets: sounds models levels

MANIFEST_CC = egg-ps2-manifest-generator
FORCE: ;

$(ISO_FOLDER_DIR)/MANIFEST.ISO: manifestassets
$(MANIFEST_CC) -i$(ISO_FOLDER_DIR)/assets -p assets/ -o$@
Expand Down
4 changes: 2 additions & 2 deletions src/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ void init(int argc, char* argv[])
load_asset_manifest();

{
int ret = SifLoadModule("USBD.IRX"_p.to_full_filepath(), 0, nullptr);
int ret = SifLoadModule("usbd.irx"_p.to_full_filepath(), 0, nullptr);
printf("ret: %d\n", ret);
checkf(ret >= 0, "USBD.IRX"_p.to_full_filepath());
checkf(ret >= 0, "usbd.irx"_p.to_full_filepath());
}

Stats::init();
Expand Down
4 changes: 2 additions & 2 deletions src/input/keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ void Keyboard::init()
memset(keyboard_status, sizeof(keyboard_status), 0);

{
int ret = SifLoadModule("PS2KBD.IRX"_p.to_full_filepath(), 0, nullptr);
int ret = SifLoadModule("ps2kbd.irx"_p.to_full_filepath(), 0, nullptr);
printf("ret: %d\n", ret);
checkf(ret >= 0, "PS2KBD.IRX"_p.to_full_filepath());
checkf(ret >= 0, "ps2kbd.irx"_p.to_full_filepath());
}

// Note: this depends on the USB modules being load (BSD.IRX)
Expand Down
6 changes: 3 additions & 3 deletions src/net/net.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,19 +279,19 @@ void Net::init()
// //sbv_patch_enable_lmb();

{
int ret = SifLoadModule("DEV9.IRX"_p.to_full_filepath(), 0, nullptr);
int ret = SifLoadModule("dev9.irx"_p.to_full_filepath(), 0, nullptr);
printf("ret: %d\n", ret);
check(ret >= 0);
}

{
int ret = SifLoadModule("NETMAN.IRX"_p.to_full_filepath(), 0, nullptr);
int ret = SifLoadModule("netman.irx"_p.to_full_filepath(), 0, nullptr);
printf("ret: %d\n", ret);
check(ret >= 0);
}

{
int ret = SifLoadModule("SMAP.IRX"_p.to_full_filepath(), 0, nullptr);
int ret = SifLoadModule("smap.irx"_p.to_full_filepath(), 0, nullptr);
printf("ret: %d\n", ret);
check(ret >= 0);
}
Expand Down
4 changes: 2 additions & 2 deletions src/sound/sound.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ static void create_audio_thread()
void init()
{
{
int ret = SifLoadModule("AUDSRV.IRX"_p.to_full_filepath(), 0, nullptr);
int ret = SifLoadModule("audsrv.irx"_p.to_full_filepath(), 0, nullptr);
printf("ret: %d\n", ret);
checkf(ret >= 0, "AUDSRV.IRX"_p.to_full_filepath());
checkf(ret >= 0, "audsrv.irx"_p.to_full_filepath());
}

printf("initializing audiosrv...\n");
Expand Down
13 changes: 7 additions & 6 deletions tools/ps2-mesh-converter/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,19 +200,19 @@ static void process()

static void parse_args(int argc, char** argv)
{
cxxopts::options options("egg-ps2-mesh-converter", "Converts .obj meshes into a mesh format that the ps2 can "
"understand by turning the mesh into strips.");
cxxopts::options options("egg-ps2-mesh-converter", "Converts json assets into a cooked asset format that the ps2 can "
"understand.");

options.add_options()("i,input", "path to the input obj mesh", cxxopts::value<std::string>());
options.add_options()("o,output", "output path for the mesh", cxxopts::value<std::string>());
options.add_options()("i,input", "path to the input file", cxxopts::value<std::string>());
options.add_options()("o,output", "output path for the file", cxxopts::value<std::string>());
options.add_options()("null", "null output, don't write file", cxxopts::value<bool>()->default_value("false"));
options.add_options()("h,help", "print usage", cxxopts::value<bool>());

options.parse_positional({"input", "output"});

options.positional_help("[input file] [output file]");

options.footer("If no output file is specified then the program will output the file to \"input path\" + .ps2_mesh");
options.footer("If no output file is specified then the program will output the file to \"input path\" + .type");

auto result = options.parse(argc, argv);

Expand Down Expand Up @@ -242,7 +242,8 @@ static void parse_args(int argc, char** argv)
}
else
{
output_path = input_path + ".ps2_mesh";
printf("Output path not specified\n");
exit(-1);
}
}

Expand Down

0 comments on commit f216649

Please sign in to comment.