Suggestion for improved build.mak script

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
rasmus
Posts: 17
Joined: Wed Jul 21, 2004 9:30 am
Location: Göteborg, Sweden

Suggestion for improved build.mak script

Post by rasmus »

Hi!

I have made some changes to build.mak in pspsdk, for easier use on v1.5 psp.

In the target kxploit I have changed the path names in order to hide the "corrupted data" entries in the vsh.

I have added the target kx-install which installs the kx directories to the user specified PSP_MOUNT variable, which could be for example /cygdrive/e in cygwin or /mnt/psp in Linux.

Here is the patch. I have only tested it on cygwin so if anyone feels like testing it on Linux and MacOSX it would be great.

Code: Select all

--- build.mak   (revision 501)
+++ build.mak   (working copy)
@@ -90,16 +90,29 @@
 FINAL_TARGET = $(TARGET).elf
 endif
 
+KXTARGET = $(shell echo $(TARGET)000000 | cut -b1-6)
+KXDIR = $(KXTARGET)_________________________1
+KXDUMMY = $(KXTARGET)~1%
+
 all: $(EXTRA_TARGETS) $(FINAL_TARGET)
 
 kxploit: $(TARGET).elf $(PSP_EBOOT_SFO)
-       mkdir -p "$(TARGET)"
-       $(STRIP) $(TARGET).elf -o $(TARGET)/$(PSP_EBOOT)
-       mkdir -p "$(TARGET)%"
-       $(PACK_PBP) "$(TARGET)%/$(PSP_EBOOT)" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON)  \
+       mkdir -p "$(KXDIR)"
+       $(STRIP) $(TARGET).elf -o $(KXDIR)/$(PSP_EBOOT)
+       mkdir -p "$(KXDUMMY)"
+       $(PACK_PBP) "$(KXDUMMY)/$(PSP_EBOOT)" $(PSP_EBOOT_SFO) $(PSP_EBOOT_ICON)  \
                $(PSP_EBOOT_ICON1) $(PSP_EBOOT_UNKPNG) $(PSP_EBOOT_PIC1)  \
                $(PSP_EBOOT_SND0) NULL $(PSP_EBOOT_PSAR)
 
+kx-install: kxploit
+ifeq ($(PSP_MOUNT),)
+       @echo '*** Error: $$(PSP_MOUNT) undefined. Please set it to for example /cygdrive/e'
+       @echo if your PSP is mounted to E: in cygwin.
+else
+       cp -r $(KXDIR) $(PSP_MOUNT)/PSP/GAME/
+       cp -r $(KXDUMMY) $(PSP_MOUNT)/PSP/GAME/
+endif
+
 $(TARGET).elf: $(OBJS)
        $(LINK.c) $^ $(LIBS) -o $@
 
@@ -118,3 +131,4 @@
 
 clean: $(EXTRA_CLEAN)
        -rm -f $(FINAL_TARGET) $(OBJS) $(PSP_EBOOT_SFO) $(PSP_EBOOT)
+       -rm -r $(KXDIR) $(KXDUMMY)
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

We can go with the modifications to the kxploit target, but I don't want to add targets that do install.

It's easy to add custom targets yourself if you add your target after build.mak has been included in your Makefile. Chp's GU samples do this for binary data.
rinco
Posts: 255
Joined: Fri Jan 21, 2005 2:12 pm
Location: Canberra, Australia

Post by rinco »

why not make the install do the corrupt icon hiding trick... then no changes to build.mak are necessary.
User avatar
0x0001
Posts: 11
Joined: Thu Jul 21, 2005 10:02 am

Post by 0x0001 »

thanx for this patch rasmus :)
also yes i agree install should be
patched and not build.mak

something like

make kxploit -hide or
make kxploit -hidecor or

whatever naming change
would be very appreciated
or can this patch be applied
to say adding a operator in makefile

something along the lines of

EXTRA_TARGETS = EBOOT.PBP -HC

or is it more like

CFLAGS = -O2 -G0 -Wall -HC

this patch works like a charm :)
but would be more efficient if
this patch was not needed on build.mak
just in case of 1.0 EBOOT.PBPs
Post Reply