2016-02-29 22:28:18 +01:00
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# Clear the implicit built in rules
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
.SUFFIXES:
|
|
|
|
|
2016-10-19 17:56:50 +02:00
|
|
|
ifeq ($(strip $(WUT_ROOT)),)
|
|
|
|
$(error "Please ensure WUT_ROOT is in your environment.")
|
|
|
|
endif
|
2016-02-29 22:28:18 +01:00
|
|
|
|
2016-10-19 17:56:50 +02:00
|
|
|
ifeq ($(findstring CYGWIN,$(shell uname -s)),CYGWIN)
|
|
|
|
ROOT := $(shell cygpath -w ${CURDIR})
|
|
|
|
WUT_ROOT := $(shell cygpath -w ${WUT_ROOT})
|
|
|
|
else
|
|
|
|
ROOT := $(CURDIR)
|
|
|
|
endif
|
2016-02-29 22:28:18 +01:00
|
|
|
|
|
|
|
|
2016-10-19 17:56:50 +02:00
|
|
|
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
|
2016-02-29 22:28:18 +01:00
|
|
|
|
2016-10-19 17:56:50 +02:00
|
|
|
include $(WUT_ROOT)/rules/rpl.mk
|
|
|
|
|
|
|
|
AS := $(PREFIX)as
|
|
|
|
|
|
|
|
TARGET := $(notdir $(CURDIR))
|
|
|
|
BUILD := build
|
|
|
|
SOURCE := src \
|
|
|
|
src/dynamic_libs \
|
|
|
|
src/fs \
|
|
|
|
src/game \
|
|
|
|
src/gui \
|
|
|
|
src/kernel \
|
|
|
|
src/loader \
|
|
|
|
src/menu \
|
|
|
|
src/network \
|
|
|
|
src/patcher \
|
|
|
|
src/resources \
|
|
|
|
src/settings \
|
|
|
|
src/sounds \
|
|
|
|
src/system \
|
|
|
|
src/utils \
|
|
|
|
src/video \
|
|
|
|
src/video/shaders
|
|
|
|
INCLUDE := src
|
|
|
|
DATA := data \
|
|
|
|
data/images \
|
|
|
|
data/fonts \
|
|
|
|
data/sounds
|
|
|
|
LIBS := -lgcc -lcrt -lcoreinit -lproc_ui -lnsysnet -lsndcore2 -lvpad -lgx2 -lgd -lpng -lz -lfreetype -lmad -lvorbisidec
|
|
|
|
|
|
|
|
CFLAGS += -O3 -std=gnu11 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing
|
|
|
|
CXXFLAGS += -O3 -std=gnu++11 -Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing
|
2016-02-29 22:28:18 +01:00
|
|
|
|
|
|
|
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
|
|
|
|
2016-10-19 17:56:50 +02:00
|
|
|
export OUTPUT := $(ROOT)/$(TARGET)
|
|
|
|
export VPATH := $(foreach dir,$(SOURCE),$(ROOT)/$(dir)) \
|
|
|
|
$(foreach dir,$(DATA),$(ROOT)/$(dir))
|
|
|
|
export BUILDDIR := $(ROOT)
|
|
|
|
export DEPSDIR := $(BUILDDIR)
|
|
|
|
|
|
|
|
CFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.c)))
|
|
|
|
CXXFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.cpp)))
|
|
|
|
SFILES := $(foreach dir,$(SOURCE),$(notdir $(wildcard $(dir)/*.S)))
|
2016-02-29 22:28:18 +01:00
|
|
|
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
|
|
|
|
2016-10-19 17:56:50 +02:00
|
|
|
ifeq ($(strip $(CXXFILES)),)
|
|
|
|
export LD := $(CC)
|
2016-02-29 22:28:18 +01:00
|
|
|
else
|
2016-10-19 17:56:50 +02:00
|
|
|
export LD := $(CXX)
|
2016-02-29 22:28:18 +01:00
|
|
|
endif
|
|
|
|
|
2016-10-19 17:56:50 +02:00
|
|
|
export OFILES := $(CFILES:.c=.o) \
|
|
|
|
$(CXXFILES:.cpp=.o) \
|
|
|
|
$(SFILES:.S=.o) \
|
|
|
|
$(addsuffix .o,$(BINFILES))
|
2016-02-29 22:28:18 +01:00
|
|
|
|
2016-10-19 17:56:50 +02:00
|
|
|
export INCLUDES := $(foreach dir,$(INCLUDE),-I$(ROOT)/$(dir)) \
|
|
|
|
-I$(ROOT)/$(BUILD) \
|
|
|
|
-I$(PORTLIBS)/include -I$(PORTLIBS)/include/freetype2
|
2016-02-29 22:28:18 +01:00
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# build a list of library paths
|
|
|
|
#---------------------------------------------------------------------------------
|
2016-10-19 17:56:50 +02:00
|
|
|
export LIB_DIRS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib) \
|
|
|
|
-L$(PORTLIBS)/lib
|
2016-02-29 22:28:18 +01:00
|
|
|
|
2016-10-19 17:56:50 +02:00
|
|
|
.PHONY: $(BUILD) clean
|
2016-02-29 22:28:18 +01:00
|
|
|
|
|
|
|
$(BUILD):
|
|
|
|
@[ -d $@ ] || mkdir -p $@
|
2016-10-19 17:56:50 +02:00
|
|
|
@$(MAKE) --no-print-directory -C $(BUILD) -f $(ROOT)/Makefile
|
2016-02-29 22:28:18 +01:00
|
|
|
|
|
|
|
clean:
|
2016-10-19 17:56:50 +02:00
|
|
|
@echo "[RM] $(notdir $(OUTPUT))"
|
|
|
|
@rm -rf $(BUILD) $(OUTPUT).elf $(OUTPUT).rpx $(OUTPUT).a
|
2016-02-29 22:28:18 +01:00
|
|
|
|
|
|
|
else
|
|
|
|
|
2016-10-19 17:56:50 +02:00
|
|
|
# workaround as wut overwrites the LIBPATHS with its rules -> not cool
|
|
|
|
export LIBPATHS := $(LIBPATHS) $(LIB_DIRS)
|
2016-02-29 22:28:18 +01:00
|
|
|
|
2016-10-19 17:56:50 +02:00
|
|
|
DEPENDS := $(OFILES:.o=.d)
|
2016-02-29 22:28:18 +01:00
|
|
|
|
2016-10-19 17:56:50 +02:00
|
|
|
$(OUTPUT).rpx: $(OUTPUT).elf
|
|
|
|
$(OUTPUT).elf: $(OFILES)
|
2016-02-29 22:28:18 +01:00
|
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
%.png.o : %.png
|
|
|
|
@echo $(notdir $<)
|
|
|
|
@bin2s -a 32 $< | $(AS) -o $(@)
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
%.jpg.o : %.jpg
|
|
|
|
@echo $(notdir $<)
|
|
|
|
@bin2s -a 32 $< | $(AS) -o $(@)
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
%.ttf.o : %.ttf
|
|
|
|
@echo $(notdir $<)
|
|
|
|
@bin2s -a 32 $< | $(AS) -o $(@)
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
%.bin.o : %.bin
|
|
|
|
@echo $(notdir $<)
|
|
|
|
@bin2s -a 32 $< | $(AS) -o $(@)
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
%.wav.o : %.wav
|
|
|
|
@echo $(notdir $<)
|
|
|
|
@bin2s -a 32 $< | $(AS) -o $(@)
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
%.mp3.o : %.mp3
|
|
|
|
@echo $(notdir $<)
|
|
|
|
@bin2s -a 32 $< | $(AS) -o $(@)
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
%.ogg.o : %.ogg
|
|
|
|
@echo $(notdir $<)
|
|
|
|
@bin2s -a 32 $< | $(AS) -o $(@)
|
|
|
|
|
|
|
|
-include $(DEPENDS)
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
endif
|
|
|
|
#---------------------------------------------------------------------------------
|