|
| 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 | +include $(PSL1GHT)/ppu_rules |
| 11 | + |
| 12 | +#--------------------------------------------------------------------------------- |
| 13 | +# TARGET is the name of the output |
| 14 | +# BUILD is the directory where object files & intermediate files will be placed |
| 15 | +# SOURCES is a list of directories containing source code |
| 16 | +# INCLUDES is a list of directories containing extra header files |
| 17 | +#--------------------------------------------------------------------------------- |
| 18 | +TARGET := $(notdir $(CURDIR)) |
| 19 | +BUILD := build |
| 20 | +SOURCES := source ../debugfont_renderer/source |
| 21 | +DATA := data |
| 22 | +SHADERS := shaders ../debugfont_renderer/shaders |
| 23 | +INCLUDES := include ../debugfont_renderer/include |
| 24 | + |
| 25 | +TITLE := RSX Test - PSL1GHT |
| 26 | +APPID := RSX00003 |
| 27 | +CONTENTID := UP0001-$(APPID)_00-0000000000000000 |
| 28 | + |
| 29 | +#--------------------------------------------------------------------------------- |
| 30 | +# options for code generation |
| 31 | +#--------------------------------------------------------------------------------- |
| 32 | + |
| 33 | +CFLAGS = -Wall -mcpu=cell $(MACHDEP) $(INCLUDE) |
| 34 | +CXXFLAGS = $(CFLAGS) |
| 35 | + |
| 36 | +LDFLAGS = $(MACHDEP) -Wl,-Map,$(notdir $@).map |
| 37 | + |
| 38 | +#--------------------------------------------------------------------------------- |
| 39 | +# any extra libraries we wish to link with the project |
| 40 | +#--------------------------------------------------------------------------------- |
| 41 | +LIBS := -lsimdmath -lrsx -lgcm_sys -lio -lsysutil -lrt -llv2 -lm -lsysmodule -lpngdec |
| 42 | + |
| 43 | +#--------------------------------------------------------------------------------- |
| 44 | +# list of directories containing libraries, this must be the top level containing |
| 45 | +# include and lib |
| 46 | +#--------------------------------------------------------------------------------- |
| 47 | +LIBDIRS := |
| 48 | + |
| 49 | +#--------------------------------------------------------------------------------- |
| 50 | +# no real need to edit anything past this point unless you need to add additional |
| 51 | +# rules for different file extensions |
| 52 | +#--------------------------------------------------------------------------------- |
| 53 | +ifneq ($(BUILD),$(notdir $(CURDIR))) |
| 54 | +#--------------------------------------------------------------------------------- |
| 55 | + |
| 56 | +export OUTPUT := $(CURDIR)/$(TARGET) |
| 57 | + |
| 58 | +export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ |
| 59 | + $(foreach dir,$(DATA),$(CURDIR)/$(dir)) \ |
| 60 | + $(foreach dir,$(SHADERS),$(CURDIR)/$(dir)) |
| 61 | + |
| 62 | +export DEPSDIR := $(CURDIR)/$(BUILD) |
| 63 | + |
| 64 | +export BUILDDIR := $(CURDIR)/$(BUILD) |
| 65 | + |
| 66 | +#--------------------------------------------------------------------------------- |
| 67 | +# automatically build a list of object files for our project |
| 68 | +#--------------------------------------------------------------------------------- |
| 69 | +CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) |
| 70 | +CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) |
| 71 | +sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) |
| 72 | +SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S))) |
| 73 | +BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) |
| 74 | +VCGFILES := $(foreach dir,$(SHADERS),$(notdir $(wildcard $(dir)/*.vcg))) |
| 75 | +FCGFILES := $(foreach dir,$(SHADERS),$(notdir $(wildcard $(dir)/*.fcg))) |
| 76 | + |
| 77 | +VPOFILES := $(VCGFILES:.vcg=.vpo) |
| 78 | +FPOFILES := $(FCGFILES:.fcg=.fpo) |
| 79 | + |
| 80 | +#--------------------------------------------------------------------------------- |
| 81 | +# use CXX for linking C++ projects, CC for standard C |
| 82 | +#--------------------------------------------------------------------------------- |
| 83 | +ifeq ($(strip $(CPPFILES)),) |
| 84 | + export LD := $(CC) |
| 85 | +else |
| 86 | + export LD := $(CXX) |
| 87 | +endif |
| 88 | + |
| 89 | +export OFILES := $(addsuffix .o,$(BINFILES)) \ |
| 90 | + $(addsuffix .o,$(VPOFILES)) \ |
| 91 | + $(addsuffix .o,$(FPOFILES)) \ |
| 92 | + $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) \ |
| 93 | + $(sFILES:.s=.o) $(SFILES:.S=.o) |
| 94 | + |
| 95 | +#--------------------------------------------------------------------------------- |
| 96 | +# build a list of include paths |
| 97 | +#--------------------------------------------------------------------------------- |
| 98 | +export INCLUDE := $(foreach dir,$(INCLUDES), -I$(CURDIR)/$(dir)) \ |
| 99 | + $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ |
| 100 | + $(LIBPSL1GHT_INC) \ |
| 101 | + -I$(CURDIR)/$(BUILD) |
| 102 | + |
| 103 | +#--------------------------------------------------------------------------------- |
| 104 | +# build a list of library paths |
| 105 | +#--------------------------------------------------------------------------------- |
| 106 | +export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \ |
| 107 | + $(LIBPSL1GHT_LIB) |
| 108 | + |
| 109 | +export OUTPUT := $(CURDIR)/$(TARGET) |
| 110 | +.PHONY: $(BUILD) clean |
| 111 | + |
| 112 | +#--------------------------------------------------------------------------------- |
| 113 | +$(BUILD): |
| 114 | + @[ -d $@ ] || mkdir -p $@ |
| 115 | + @$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile |
| 116 | + |
| 117 | +#--------------------------------------------------------------------------------- |
| 118 | +clean: |
| 119 | + @echo clean ... |
| 120 | + @rm -fr $(BUILD) $(OUTPUT).elf $(OUTPUT).self $(OUTPUT).fake.self |
| 121 | + |
| 122 | +#--------------------------------------------------------------------------------- |
| 123 | +run: |
| 124 | + ps3load $(OUTPUT).self |
| 125 | + |
| 126 | +#--------------------------------------------------------------------------------- |
| 127 | +pkg: $(BUILD) $(OUTPUT).pkg |
| 128 | + |
| 129 | +#--------------------------------------------------------------------------------- |
| 130 | +else |
| 131 | + |
| 132 | +DEPENDS := $(OFILES:.o=.d) |
| 133 | + |
| 134 | +#--------------------------------------------------------------------------------- |
| 135 | +# main targets |
| 136 | +#--------------------------------------------------------------------------------- |
| 137 | +$(OUTPUT).self: $(OUTPUT).elf |
| 138 | +$(OUTPUT).elf: $(OFILES) |
| 139 | + |
| 140 | +#--------------------------------------------------------------------------------- |
| 141 | +# This rule links in binary data with the .bin extension |
| 142 | +#--------------------------------------------------------------------------------- |
| 143 | +%.bin.o : %.bin |
| 144 | +#--------------------------------------------------------------------------------- |
| 145 | + @echo $(notdir $<) |
| 146 | + @$(bin2o) |
| 147 | + |
| 148 | +#--------------------------------------------------------------------------------- |
| 149 | +%.vpo.o : %.vpo |
| 150 | +#--------------------------------------------------------------------------------- |
| 151 | + @echo $(notdir $<) |
| 152 | + @$(bin2o) |
| 153 | + |
| 154 | +#--------------------------------------------------------------------------------- |
| 155 | +%.fpo.o : %.fpo |
| 156 | +#--------------------------------------------------------------------------------- |
| 157 | + @echo $(notdir $<) |
| 158 | + @$(bin2o) |
| 159 | + |
| 160 | +-include $(DEPENDS) |
| 161 | + |
| 162 | +#--------------------------------------------------------------------------------- |
| 163 | +endif |
| 164 | +#--------------------------------------------------------------------------------- |
0 commit comments