2018-02-16 21:51:35 +01:00
|
|
|
DO_LOGGING := 0
|
|
|
|
|
2018-02-04 10:14:45 +01:00
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
.SUFFIXES:
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
ifeq ($(strip $(DEVKITPPC)),)
|
2018-02-16 21:51:35 +01:00
|
|
|
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC)
|
2018-02-04 10:14:45 +01:00
|
|
|
endif
|
2018-07-13 19:26:22 +02:00
|
|
|
ifeq ($(strip $(DEVKITPRO)),)
|
|
|
|
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>DEVKITPRO)
|
|
|
|
endif
|
2018-02-16 21:51:35 +01:00
|
|
|
|
2018-05-26 13:48:11 +02:00
|
|
|
export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
|
|
|
|
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
|
|
|
|
|
|
|
|
PREFIX := powerpc-eabi-
|
|
|
|
|
|
|
|
export AS := $(PREFIX)as
|
|
|
|
export CC := $(PREFIX)gcc
|
|
|
|
export CXX := $(PREFIX)g++
|
|
|
|
export AR := $(PREFIX)ar
|
|
|
|
export OBJCOPY := $(PREFIX)objcopy
|
|
|
|
|
|
|
|
include $(DEVKITPPC)/base_rules
|
2018-02-16 21:51:35 +01:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# BUILD is the directory where object files & intermediate files will be placed
|
|
|
|
# SOURCES is a list of directories containing source code
|
|
|
|
# INCLUDES is a list of directories containing extra header files
|
|
|
|
# DATA is a list of directories containing binary files
|
|
|
|
# LIBDIR is where the built library will be placed
|
|
|
|
# all directories are relative to this makefile
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
BUILD ?= release
|
|
|
|
SOURCES := src
|
|
|
|
|
|
|
|
INCLUDES := src \
|
|
|
|
wups_include
|
|
|
|
DATA :=
|
|
|
|
LIB := lib
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# options for code generation
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
CFLAGS = -g -Os -Wall -D__wiiu__ -D_GNU_SOURCE $(MACHDEP) $(INCLUDE)
|
|
|
|
CXXFLAGS = $(CFLAGS)
|
|
|
|
|
|
|
|
ifeq ($(DO_LOGGING), 1)
|
|
|
|
CFLAGS += -D__LOGGING__
|
|
|
|
CXXFLAGS += -D__LOGGING__
|
2018-02-04 10:14:45 +01:00
|
|
|
endif
|
|
|
|
|
2018-02-16 21:51:35 +01:00
|
|
|
ASFLAGS := -mregnames
|
|
|
|
|
|
|
|
export WIIUBIN := $(LIB)/libwups.a
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# any extra libraries we wish to link with the project
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
LIBS :=
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# list of directories containing libraries, this must be the top level containing
|
|
|
|
# include and lib
|
|
|
|
#---------------------------------------------------------------------------------
|
2018-06-20 16:16:16 +02:00
|
|
|
LIBDIRS :=
|
2018-02-16 21:51:35 +01:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# no real need to edit anything past this point unless you need to add additional
|
|
|
|
# rules for different file extensions
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
ifneq ($(BUILD),$(notdir $(CURDIR)))
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
export TOPDIR ?= $(CURDIR)/..
|
|
|
|
export DEPSDIR := $(CURDIR)/$(BUILD)
|
|
|
|
|
2018-02-20 12:41:58 +01:00
|
|
|
export INCLUDEDIR := $(PORTLIBS)/include/
|
2018-02-16 21:51:35 +01:00
|
|
|
|
|
|
|
export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
|
|
|
|
$(foreach dir,$(DATA),$(CURDIR)/$(dir))
|
|
|
|
|
|
|
|
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
|
|
|
|
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
|
|
|
|
sFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
|
|
|
|
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))
|
|
|
|
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*)))
|
|
|
|
|
|
|
|
|
|
|
|
export OFILES := $(addsuffix .o,$(BINFILES)) \
|
|
|
|
$(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) $(sFILES:.s=.o)
|
|
|
|
|
|
|
|
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
|
|
|
|
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \
|
2018-02-20 12:41:58 +01:00
|
|
|
-I$(CURDIR)/$(BUILD) -I$(PORTLIBS)/include
|
2018-02-16 21:51:35 +01:00
|
|
|
|
|
|
|
export LIBPATHS := $(foreach dir,$(LIBDIRS),-L$(dir)/lib)
|
|
|
|
|
|
|
|
.PHONY: $(BUILD) clean
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
$(BUILD):
|
|
|
|
@[ -d $@ ] || mkdir -p $@
|
|
|
|
@$(MAKE) --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
clean:
|
|
|
|
@echo clean ...
|
|
|
|
@rm -fr debug release $(LIB) include
|
|
|
|
|
|
|
|
all: $(WIIUBIN)
|
|
|
|
|
2018-02-04 10:14:45 +01:00
|
|
|
WUPSDIR := $(DEVKITPRO)/wups
|
|
|
|
|
|
|
|
# Rule to install wups.
|
|
|
|
PHONY += install
|
2018-06-28 22:15:32 +02:00
|
|
|
install : wups.ld
|
2018-02-04 10:14:45 +01:00
|
|
|
$(addprefix $Qrm -rf ,$(wildcard $(WUPSDIR)))
|
|
|
|
$Qmkdir $(WUPSDIR)
|
2018-02-16 21:51:35 +01:00
|
|
|
$Qmkdir $(WUPSDIR)/lib/
|
2018-02-04 10:14:45 +01:00
|
|
|
$Qcp -r wups_include $(WUPSDIR)/include
|
|
|
|
$Qcp -r wups.ld $(WUPSDIR)
|
2018-03-10 13:26:43 +01:00
|
|
|
$Qcp -r plugin_makefile.mk $(WUPSDIR)
|
2018-02-16 21:51:35 +01:00
|
|
|
@cp $(BUILD)/lib/libwups.a $(WUPSDIR)/lib/
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
else
|
|
|
|
|
|
|
|
DEPENDS := $(OFILES:.o=.d)
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
# main targets
|
|
|
|
#---------------------------------------------------------------------------------
|
|
|
|
$(WIIUBIN) : $(OFILES) $(LIB)
|
|
|
|
@rm -f "$(WIIUBIN)"
|
2018-02-20 12:41:58 +01:00
|
|
|
@$(AR) rcs "$(WIIUBIN)" $(OFILES)
|
2018-02-16 21:51:35 +01:00
|
|
|
@echo built ... $(notdir $@)
|
|
|
|
|
|
|
|
$(LIB):
|
|
|
|
mkdir $(LIB)
|
|
|
|
|
|
|
|
-include $(DEPENDS)
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------------------
|
|
|
|
endif
|
|
|
|
#---------------------------------------------------------------------------------------
|
|
|
|
|