|
1 | 1 | # Makefile for the FreeMcBoot Installer EE (Emotion Engine) application |
2 | 2 |
|
3 | | -# Target ELF name parts |
4 | | -# EE_BIN_DIR is the output directory for the ELFs. |
5 | | -# It's defined as './' here for local builds. |
6 | | -# The GitHub Actions workflow (compile-core.yml) overrides this to EE_BIN_DIR=../installer_res/ |
7 | 3 | EE_BIN_DIR = ./ |
8 | 4 | EE_BIN_BASE_NAME = UNC_FMCBInstaller |
9 | 5 | EE_BIN_PACKED_BASE_NAME = FMCBInstaller |
10 | 6 |
|
11 | | -# exFAT support option (0 = no, 1 = yes) - Can be overridden from command line, e.g., make EXFAT=1 |
12 | | -EXFAT ?= 0 # Default to 0 (no exFAT support) if not set externally |
13 | | - |
14 | | -# Determine suffix based on EXFAT option |
| 7 | +EXFAT ?= 0 |
15 | 8 | HAS_EXFAT = |
16 | 9 | ifeq ($(EXFAT), 1) |
17 | 10 | HAS_EXFAT = _EXFAT |
18 | 11 | endif |
19 | 12 |
|
20 | | -# Final ELF names. These will be placed in EE_BIN_DIR. |
21 | 13 | EE_BIN = $(EE_BIN_DIR)$(EE_BIN_BASE_NAME)$(HAS_EXFAT).elf |
22 | 14 | EE_BIN_PACKED = $(EE_BIN_DIR)$(EE_BIN_PACKED_BASE_NAME)$(HAS_EXFAT).elf |
23 | 15 |
|
24 | | -# Directory for pre-compiled IOP modules (referenced by bin2c rules) |
25 | 16 | IRX_DIR = irx/compiled |
26 | 17 |
|
27 | | -# IOP modules that are converted to C arrays and linked into the EE binary |
28 | 18 | EE_IOP_OBJS = IOPRP_img.o IOMANX_irx.o FILEXIO_irx.o SIO2MAN_irx.o PADMAN_irx.o MCMAN_irx.o \ |
29 | 19 | MCSERV_irx.o SECRSIF_irx.o MCTOOLS_irx.o USBD_irx.o POWEROFF_irx.o DEV9_irx.o \ |
30 | 20 | ATAD_irx.o HDD_irx.o PFS_irx.o |
31 | 21 |
|
32 | | -# Resource files (images) converted to C arrays |
33 | 22 | EE_RES_OBJS = background.o buttons.o |
34 | 23 |
|
35 | | -# EE Object files |
36 | | -# Added menu_opentuna.o to this list |
37 | 24 | EE_OBJS = main.o iop.o UI.o menu.o libsecr.o pad.o system.o graphics.o ReqSpaceCalc.o font.o \ |
38 | 25 | menu_opentuna.o \ |
39 | 26 | $(EE_RES_OBJS) $(EE_IOP_OBJS) mctools_rpc.o |
40 | 27 |
|
41 | | -# Include paths for EE compilation |
42 | 28 | EE_INCS := -I. \ |
43 | 29 | -I$(PS2SDK)/ports/include \ |
44 | 30 | -I$(PS2SDK)/ee/include \ |
45 | 31 | -I$(PS2SDK)/common/include \ |
46 | 32 | -I./irx/source/secrsif/src \ |
47 | 33 | -I./irx/source/mctools/src/ |
48 | 34 |
|
49 | | -# Linker flags for EE |
50 | 35 | EE_LDFLAGS := -L$(PS2SDK)/ports/lib \ |
51 | 36 | -L$(PS2SDK)/ee/lib \ |
52 | 37 | -L$(PS2DEV)/ee/ee/lib \ |
53 | 38 | -Tlinkfile \ |
54 | | - -s # Strip symbols from final ELF |
| 39 | + -s |
55 | 40 |
|
56 | | -# Libraries to link against for EE |
57 | 41 | EE_LIBS = -lgs -lpng -lz -lm -lfreetype -lpoweroff -lcdvd -lmc -lpadx -lhdd -lfileXio -lpatches -liopreboot -lc -lkernel |
58 | 42 |
|
59 | | -# GP value for MIPS architecture (optimizes access to global variables) |
60 | 43 | EE_GPVAL = -G8192 |
61 | 44 |
|
62 | | -# CFLAGS for EE compilation |
63 | | -# -Os for size optimization, -mgpopt for GP optimization |
64 | | -# Removed -Wno-string-plus-int as it's not recognized by the ps2dev ee-gcc |
65 | | -EE_CFLAGS += -Os -mgpopt $(EE_GPVAL) -Wall |
| 45 | +EE_CFLAGS += -Os -mgpopt $(EE_GPVAL) -Wall -std=gnu99 # <<< ENSURE -std=gnu99 IS HERE |
66 | 46 |
|
67 | | -# Conditional compilation for exFAT support |
68 | 47 | ifeq ($(EXFAT), 1) |
69 | 48 | EE_CFLAGS += -DEXFAT |
70 | 49 | EE_OBJS += usbmass_bd_irx.o bdm_irx.o bdmfs_fatfs_irx.o |
71 | 50 | else |
72 | 51 | EE_OBJS += USBHDFSD_irx.o |
73 | 52 | endif |
74 | 53 |
|
75 | | -# Conditional compilation for Debug TTY feedback |
76 | 54 | ifeq ($(DEBUG),1) |
77 | 55 | EE_CFLAGS += -DDEBUG_TTY_FEEDBACK |
78 | 56 | endif |
79 | 57 |
|
80 | | -# Conditional compilation for Installer Version |
81 | 58 | ifdef FMCB_INSTALLER_VERSION |
82 | 59 | EE_CFLAGS += -DFMCB_INSTALLER_VERSION=\"$(FMCB_INSTALLER_VERSION)\" |
83 | 60 | endif |
84 | 61 |
|
85 | | -# Default rule to build all (now defaults to the packed version) |
86 | 62 | all: $(EE_BIN_PACKED) |
87 | 63 |
|
88 | | -# Rule to compile .c files to .o |
89 | 64 | %.o : %.c |
90 | 65 | $(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@ |
91 | 66 |
|
92 | | -# Rule to compile .S (assembly with C preprocessor) files to .o |
93 | 67 | %.o : %.S |
94 | 68 | $(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@ |
95 | 69 |
|
96 | | -# Rule to compile .s (pure assembly) files to .o |
97 | 70 | %.o : %.s |
98 | 71 | $(EE_AS) $(EE_ASFLAGS) $< -o $@ |
99 | 72 |
|
100 | | -# Rule to link EE objects into the final ELF |
101 | | -# Standard order: crt0.o, then your objects, then libraries. |
102 | 73 | $(EE_BIN) : $(PS2SDK)/ee/startup/crt0.o $(EE_OBJS) |
103 | 74 | $(EE_CC) $(EE_CFLAGS) -nostartfiles $(EE_LDFLAGS) -o $(EE_BIN) $(PS2SDK)/ee/startup/crt0.o $(EE_OBJS) $(EE_LIBS) |
104 | 75 |
|
105 | | -# Rule to pack the ELF using ps2-packer |
106 | 76 | $(EE_BIN_PACKED): $(EE_BIN) |
107 | 77 | @echo " -- Compressing ELF $(EE_BIN) -> $(EE_BIN_PACKED) --" |
108 | 78 | ps2-packer -v $< $@ |
109 | 79 |
|
110 | | -# Rule to clean compiled files |
111 | 80 | clean: |
112 | 81 | @echo " -- Cleaning compiled files --" |
113 | 82 | rm -f $(EE_BIN) $(EE_BIN_PACKED) $(EE_OBJS) \ |
114 | 83 | IOPRP_img.c IOMANX_irx.c FILEXIO_irx.c SIO2MAN_irx.c PADMAN_irx.c MCMAN_irx.c \ |
115 | 84 | MCSERV_irx.c SECRSIF_irx.c MCTOOLS_irx.c USBD_irx.c POWEROFF_irx.c DEV9_irx.c \ |
116 | 85 | ATAD_irx.c HDD_irx.c PFS_irx.c \ |
117 | 86 | background.c buttons.c \ |
118 | | - usbmass_bd_irx.c bdm_irx.c bdmfs_fatfs_irx.c USBHDFSD_irx.c # Clean all possible generated .c files |
| 87 | + usbmass_bd_irx.c bdm_irx.c bdmfs_fatfs_irx.c USBHDFSD_irx.c |
119 | 88 |
|
120 | | -# Rule to rebuild (clean then build all) |
121 | 89 | rebuild: clean all |
122 | 90 |
|
123 | | -# Rules for converting binary resources/IRXs to C arrays using bin2c |
124 | | -# These .c files will then be compiled into .o files and linked. |
125 | | - |
| 91 | +# bin2c rules... (rest of your Makefile) |
126 | 92 | background.c: resources/background.png |
127 | 93 | bin2c $< $@ background |
128 | | - |
129 | 94 | buttons.c: resources/buttons.png |
130 | 95 | bin2c $< $@ buttons |
131 | | - |
132 | | -# Standard PS2SDK IRXs |
133 | 96 | POWEROFF_irx.c: $(PS2SDK)/iop/irx/poweroff.irx |
134 | 97 | bin2c $< $@ POWEROFF_irx |
135 | | - |
136 | 98 | DEV9_irx.c: $(PS2SDK)/iop/irx/ps2dev9.irx |
137 | 99 | bin2c $< $@ DEV9_irx |
138 | | - |
139 | 100 | IOMANX_irx.c: $(PS2SDK)/iop/irx/iomanX.irx |
140 | 101 | bin2c $< $@ IOMANX_irx |
141 | | - |
142 | 102 | FILEXIO_irx.c: $(PS2SDK)/iop/irx/fileXio.irx |
143 | 103 | bin2c $< $@ FILEXIO_irx |
144 | | - |
145 | 104 | SIO2MAN_irx.c: $(PS2SDK)/iop/irx/freesio2.irx |
146 | 105 | bin2c $< $@ SIO2MAN_irx |
147 | | - |
148 | 106 | PADMAN_irx.c: $(PS2SDK)/iop/irx/freepad.irx |
149 | 107 | bin2c $< $@ PADMAN_irx |
150 | | - |
151 | 108 | MCMAN_irx.c: $(PS2SDK)/iop/irx/mcman.irx |
152 | 109 | bin2c $< $@ MCMAN_irx |
153 | | - |
154 | 110 | MCSERV_irx.c: $(PS2SDK)/iop/irx/mcserv.irx |
155 | 111 | bin2c $< $@ MCSERV_irx |
156 | | - |
157 | 112 | USBD_irx.c: $(PS2SDK)/iop/irx/usbd.irx |
158 | 113 | bin2c $< $@ USBD_irx |
159 | | - |
160 | 114 | ATAD_irx.c: $(PS2SDK)/iop/irx/ps2atad.irx |
161 | 115 | bin2c $< $@ ATAD_irx |
162 | | - |
163 | 116 | HDD_irx.c: $(PS2SDK)/iop/irx/ps2hdd-osd.irx |
164 | 117 | bin2c $< $@ HDD_irx |
165 | | - |
166 | 118 | PFS_irx.c: $(PS2SDK)/iop/irx/ps2fs.irx |
167 | 119 | bin2c $< $@ PFS_irx |
168 | | - |
169 | | -# Custom/Project-specific IRXs (from IRX_DIR) |
170 | 120 | SECRSIF_irx.c: $(IRX_DIR)/secrsif.irx |
171 | 121 | bin2c $< $@ SECRSIF_irx |
172 | | - |
173 | 122 | MCTOOLS_irx.c: $(IRX_DIR)/mctools.irx |
174 | 123 | bin2c $< $@ MCTOOLS_irx |
175 | | - |
176 | 124 | IOPRP_img.c: $(IRX_DIR)/IOPRP.img |
177 | 125 | bin2c $< $@ IOPRP_img |
178 | | - |
179 | | -# Conditional IRX to C conversion based on EXFAT support |
180 | 126 | ifeq ($(EXFAT), 1) |
181 | 127 | usbmass_bd_irx.c: $(IRX_DIR)/usbmass_bd.irx |
182 | 128 | bin2c $< $@ usbmass_bd_irx |
183 | | - |
184 | 129 | bdm_irx.c: $(IRX_DIR)/bdm.irx |
185 | 130 | bin2c $< $@ bdm_irx |
186 | | - |
187 | 131 | bdmfs_fatfs_irx.c: $(IRX_DIR)/bdmfs_fatfs.irx |
188 | 132 | bin2c $< $@ bdmfs_fatfs_irx |
189 | 133 | else |
190 | | -# Standard USBHDFSD if not using exFAT |
191 | 134 | USBHDFSD_irx.c: $(PS2SDK)/iop/irx/usbhdfsd.irx |
192 | 135 | bin2c $< $@ USBHDFSD_irx |
193 | 136 | endif |
194 | 137 |
|
195 | | -# Include common PS2SDK makefile definitions |
196 | 138 | include $(PS2SDK)/Defs.make |
0 commit comments