Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/xeonliu/PSPDevNote
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Oct 9, 2023
2 parents f5f4113 + f670c6b commit 9712364
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions docs/makefilesample.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,23 @@
> 【其他】make到底干了些什么 http://bbs.chinaemu.org/read-htm-tid-86754-uid-12451.html
## EBOOT.PBP的构建流程
1. 编译生成.o可重定位目标程序(自己负责)。指定变量`OBJS`
2. 链接静态链接库(.a文件,在pspdev/psp/sdk/lib中)生成ELF文件。指定变量`LIBS`
1. 编译生成.o可重定位目标文件(自己负责)。指定变量`OBJS`
2. 链接静态链接库(.a文件,在pspdev/psp/sdk/lib中)生成ELF可执行目标文件。指定变量`LIBS`
```Makefile linenums="1" hl_lines="2"
$(TARGET).elf: $(OBJS) $(EXPORT_OBJ)
$(LINK.c) $^ $(LIBS) -o $@
$(FIXUP) $@
```
注:LINK.C是GNU MAKE 中默认的变量,会展开
注:参考 CSAPP 7.6.2 与静态库链接
3. 使用`psp-fixup-imports`修复ELF文件的导入表。
```Makefile linenums="1" hl_lines="3"
$(TARGET).elf: $(OBJS) $(EXPORT_OBJ)
$(LINK.c) $^ $(LIBS) -o $@
$(FIXUP) $@
```
4. 生成PSP上的可执行文件。PSP支持ELF和PRX两种可执行文件格式。
+ (选择1)使用psp-strip生成优化的ELF文件
+ (选择1)使用psp-strip删除ELF文件中的符号表信息
```Makefile
$(STRIP) $(TARGET).elf -o $(TARGET)_strip.elf
```
Expand Down

0 comments on commit 9712364

Please sign in to comment.