|
| 1 | +#--------------------------------------------------------------------------------- |
| 2 | +# Clear the implicit built in rules |
| 3 | +#--------------------------------------------------------------------------------- |
| 4 | +.SUFFIXES: |
| 5 | +#--------------------------------------------------------------------------------- |
| 6 | +ifeq ($(strip $(PSL1GHT)),) |
| 7 | +$(error "Please set PSL1GHT in your environment. export PSL1GHT=<path>") |
| 8 | +endif |
| 9 | + |
| 10 | +#--------------------------------------------------------------------------------- |
| 11 | +# TITLE, APPID, CONTENTID, ICON0 SFOXML before ppu_rules. |
| 12 | +#--------------------------------------------------------------------------------- |
| 13 | + |
| 14 | +TITLE := NTFS Test |
| 15 | +APPID := NTFS00001 |
| 16 | +CONTENTID := UP0001-$(APPID)_00-0000000000000000 |
| 17 | + |
| 18 | +include $(PSL1GHT)/ppu_rules |
| 19 | + |
| 20 | +# aditional scetool flags (--self-ctrl-flags, --self-cap-flags...) |
| 21 | +SCETOOL_FLAGS += --self-ctrl-flags 4000000000000000000000000000000000000000000000000000000000000002 |
| 22 | +SCETOOL_FLAGS += --self-cap-flags 00000000000000000000000000000000000000000000007B0000000100000000 |
| 23 | + |
| 24 | + |
| 25 | +#--------------------------------------------------------------------------------- |
| 26 | +# TARGET is the name of the output |
| 27 | +# BUILD is the directory where object files & intermediate files will be placed |
| 28 | +# SOURCES is a list of directories containing source code |
| 29 | +# INCLUDES is a list of directories containing extra header files |
| 30 | +#--------------------------------------------------------------------------------- |
| 31 | +TARGET := $(notdir $(CURDIR)) |
| 32 | +BUILD := build |
| 33 | +SOURCES := source |
| 34 | +DATA := datas |
| 35 | +SHADERS := shaders |
| 36 | +INCLUDES := include ../include |
| 37 | + |
| 38 | + |
| 39 | +#--------------------------------------------------------------------------------- |
| 40 | +# any extra libraries we wish to link with the project |
| 41 | +#--------------------------------------------------------------------------------- |
| 42 | +LIBS := ../../libntfs_ext.a -lc -lsysfs -lfont -ltiny3d -lsimdmath -lgcm_sys -lio -lsysutil -lrt -llv2 -lsysmodule -lm |
| 43 | + |
| 44 | + |
| 45 | +#--------------------------------------------------------------------------------- |
| 46 | +# options for code generation |
| 47 | +#--------------------------------------------------------------------------------- |
| 48 | + |
| 49 | +CFLAGS = -O2 -Wall -mcpu=cell $(MACHDEP) $(INCLUDE) |
| 50 | +CXXFLAGS = $(CFLAGS) |
| 51 | + |
| 52 | +LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map |
| 53 | + |
| 54 | + |
| 55 | +#--------------------------------------------------------------------------------- |
| 56 | +# list of directories containing libraries, this must be the top level containing |
| 57 | +# include and lib |
| 58 | +#--------------------------------------------------------------------------------- |
| 59 | +LIBDIRS := |
| 60 | + |
| 61 | +#--------------------------------------------------------------------------------- |
| 62 | +# no real need to edit anything past this point unless you need to add additional |
| 63 | +# rules for different file extensions |
| 64 | +#--------------------------------------------------------------------------------- |
| 65 | +ifneq ($(BUILD),$(notdir $(CURDIR))) |
| 66 | +#--------------------------------------------------------------------------------- |
| 67 | + |
| 68 | +export OUTPUT := $(CURDIR)/$(TARGET) |
| 69 | + |
| 70 | +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ |
| 71 | + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ |
| 72 | + $(foreach dir,$(SHADERS),$(CURDIR)/$(dir)) |
| 73 | + |
| 74 | +export DEPSDIR := $(CURDIR)/$(BUILD) |
| 75 | + |
| 76 | +export BUILDDIR := $(CURDIR)/$(BUILD) |
| 77 | + |
| 78 | +#--------------------------------------------------------------------------------- |
| 79 | +# automatically build a list of object files for our project |
| 80 | +#--------------------------------------------------------------------------------- |
| 81 | +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) |
| 82 | +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) |
| 83 | +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) |
| 84 | +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) |
| 85 | +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.bin))) |
| 86 | +VCGFILES := $(foreach dir,$(SHADERS),$(notdir $(wildcard $(dir)/*.vcg))) |
| 87 | +FCGFILES := $(foreach dir,$(SHADERS),$(notdir $(wildcard $(dir)/*.fcg))) |
| 88 | + |
| 89 | +VPOFILES := $(VCGFILES:.vcg=.vpo) |
| 90 | +FPOFILES := $(FCGFILES:.fcg=.fpo) |
| 91 | + |
| 92 | +#--------------------------------------------------------------------------------- |
| 93 | +# use CXX for linking C++ projects, CC for standard C |
| 94 | +#--------------------------------------------------------------------------------- |
| 95 | +ifeq ($(strip $(CPPFILES)),) |
| 96 | + export LD := $(CC) |
| 97 | +else |
| 98 | + export LD := $(CXX) |
| 99 | +endif |
| 100 | + |
| 101 | +export OFILES := $(addsuffix .o,$(BINFILES)) \ |
| 102 | + $(addsuffix .o,$(VPOFILES)) \ |
| 103 | + $(addsuffix .o,$(FPOFILES)) \ |
| 104 | + $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ |
| 105 | + $(sFILES:.s=.o) $(SFILES:.S=.o) |
| 106 | + |
| 107 | +#--------------------------------------------------------------------------------- |
| 108 | +# build a list of include paths |
| 109 | +#--------------------------------------------------------------------------------- |
| 110 | +export INCLUDE := $(foreach dir,$(INCLUDES), -I$(CURDIR)/$(dir)) \ |
| 111 | + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ |
| 112 | + $(LIBPSL1GHT_INC) \ |
| 113 | + -I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include |
| 114 | + |
| 115 | +#--------------------------------------------------------------------------------- |
| 116 | +# build a list of library paths |
| 117 | +#--------------------------------------------------------------------------------- |
| 118 | +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ |
| 119 | + $(LIBPSL1GHT_LIB) -L$(PORTLIBS)/lib |
| 120 | + |
| 121 | +export OUTPUT := $(CURDIR)/$(TARGET) |
| 122 | +.PHONY: $(BUILD) clean |
| 123 | + |
| 124 | + |
| 125 | +#--------------------------------------------------------------------------------- |
| 126 | +$(BUILD): |
| 127 | + @[ -d $@ ] || mkdir -p $@ |
| 128 | + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile |
| 129 | + |
| 130 | +#--------------------------------------------------------------------------------- |
| 131 | +clean: |
| 132 | + @echo clean ... |
| 133 | + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).self EBOOT.BIN |
| 134 | + |
| 135 | +#--------------------------------------------------------------------------------- |
| 136 | +run: |
| 137 | + ps3load $(OUTPUT).self |
| 138 | + |
| 139 | +#--------------------------------------------------------------------------------- |
| 140 | +#pkg: $(BUILD) $(OUTPUT).pkg |
| 141 | +pkg: $(BUILD) $(OUTPUT).pkg |
| 142 | + @echo Creating PKG... |
| 143 | + @mkdir -p $(BUILD)/pkg |
| 144 | + @mkdir -p $(BUILD)/pkg/USRDIR |
| 145 | + @cp $(ICON0) $(BUILD)/pkg/ |
| 146 | + @$(SELF_NPDRM) $(SCETOOL_FLAGS) --np-content-id=$(CONTENTID) --encrypt $(BUILDDIR)/$(basename $(notdir $(OUTPUT))).elf $(BUILDDIR)/../EBOOT.BIN |
| 147 | + @$(SFO) --title "$(TITLE)" --appid "$(APPID)" -f $(SFOXML) $(BUILD)/pkg/PARAM.SFO |
| 148 | + @$(PKG) --contentid $(CONTENTID) $(BUILD)/pkg/ $(OUTPUT).pkg |
| 149 | + |
| 150 | +#--------------------------------------------------------------------------------- |
| 151 | + |
| 152 | +npdrm: $(BUILD) |
| 153 | + @$(SELF_NPDRM) $(SCETOOL_FLAGS) --np-content-id=$(CONTENTID) --encrypt $(BUILDDIR)/$(basename $(notdir $(OUTPUT))).elf $(BUILDDIR)/../EBOOT.BIN |
| 154 | + |
| 155 | +#--------------------------------------------------------------------------------- |
| 156 | + |
| 157 | +else |
| 158 | + |
| 159 | +DEPENDS := $(OFILES:.o=.d) |
| 160 | + |
| 161 | +#--------------------------------------------------------------------------------- |
| 162 | +# main targets |
| 163 | +#--------------------------------------------------------------------------------- |
| 164 | +$(OUTPUT).self: $(OUTPUT).elf |
| 165 | +$(OUTPUT).elf: $(OFILES) |
| 166 | + |
| 167 | +#--------------------------------------------------------------------------------- |
| 168 | +# This rule links in binary data with the .bin extension |
| 169 | +#--------------------------------------------------------------------------------- |
| 170 | +%.bin.o : %.bin |
| 171 | +#--------------------------------------------------------------------------------- |
| 172 | + @echo $(notdir $<) |
| 173 | + @$(bin2o) |
| 174 | + |
| 175 | +#--------------------------------------------------------------------------------- |
| 176 | +%.vpo.o : %.vpo |
| 177 | +#--------------------------------------------------------------------------------- |
| 178 | + @echo $(notdir $<) |
| 179 | + @$(bin2o) |
| 180 | + |
| 181 | +#--------------------------------------------------------------------------------- |
| 182 | +%.fpo.o : %.fpo |
| 183 | +#--------------------------------------------------------------------------------- |
| 184 | + @echo $(notdir $<) |
| 185 | + @$(bin2o) |
| 186 | + |
| 187 | +-include $(DEPENDS) |
| 188 | + |
| 189 | +#--------------------------------------------------------------------------------- |
| 190 | +endif |
| 191 | +#--------------------------------------------------------------------------------- |
0 commit comments